Page 1 of 1
graphic backcolor
Posted: Mon Apr 29, 2013 8:02 am
by brandonb
with the eb076 is the change back color broken, when i use the icon it corrupts the program, would be nice to be able to use that to change the back color behind printing numbers, currently i dim the forcolor to the back color to make the area behind the strings match when i print " " when number digits change... printing boxes over it would be a pain to do
Re: graphic backcolor
Posted: Thu Jun 20, 2013 10:01 am
by BChappy
Hi,
Has this been resolved/ updated on here somewhere?
Having the same problem corrupting the program!
Thanks
Best regards
Brian
Re: graphic backcolor
Posted: Thu Jun 20, 2013 6:23 pm
by brandonb
i haven't had a chance to try it but have to send a asci 'B' then 16bits of color and wait for a 0x6||0x15 to return, it kind of sucks when printing with transparent 0 it prints the background color of what ever was choosen from the glcd properties, ben help us out
Code: Select all
3.1.4
Replace Background Colour - 42hex
Serial Cmd
cmd, colour
(msb:lsb)
4DSL Cmd
ReplaceBackground(colour)
cmd
42
(hex) or
B
(ascii) : Command header byte
colour
2 bytes (16 bits) define the background colour in RGB format:
R4R3R2R1R0
G5G4G3
G2G1G0
B4B3B2B1B0
where:
msb :
R4R3R2R1R0
G5G4G3
lsb :
G2G1G0
B4B3B2B1B0
Response
acknowledge
acknowledge
06
(hex) : ACK byte if operation successful
15
(hex) : NAK byte if unsuccessful
Description
This command changes the current background colour. Once this command is sent, only
the background colour will change. Any other object on the screen with a different colour
value will not be affected.
Serial Example
Command Data:
42hex, FFhex, FFhex
This example sets the background colour value to FFFFhex (White).
4DSL Example
Refer to the General.4DScript sample script file
Re: graphic backcolor
Posted: Fri Jun 21, 2013 2:56 pm
by Benj
Hello,
I think I may see the problem. If you select the glcd component and then select custom code, select the SetBackColour macro and click edit.
Then comment out these lines of code.
Code: Select all
%a_UART_Send(msb); // Send msb
%a_UART_Send(lsb); // Send lsb
%a_UART_Receive(255); // Try to collect Ack
Should end up with this.
Code: Select all
char msb, lsb;
Red = Red >> 3;
Green = Green >> 2;
Blue = Blue >> 3;
lsb = Blue | (Green << 5);
msb = (Green >> 3) | (Red << 3);
//%a_UART_Send(msb); // Send msb
//%a_UART_Send(lsb); // Send lsb
//%a_UART_Receive(255); // Try to collect Ack
%a_GFX_Back_Color = lsb | (msb << 8);
Then hopefully the macro will work correctly without corrupting the glcd.
I can see where the corruption is coming from I am sending the msb and lsb to the display without issuing a command first. Adding the correct command code before sending the parameters should also have a better outcome.
Let me know how you get on as I will also make this change to the v6 code if required.
Re: graphic backcolor
Posted: Sat Jun 22, 2013 5:59 pm
by brandonb
hey ben, it didn't work with your code mod but it works with this
Code: Select all
char msb, lsb;
Red = Red >> 3;
Green = Green >> 2;
Blue = Blue >> 3;
lsb = Blue | (Green << 5);
msb = (Green >> 3) | (Red << 3);
%a_UART_Send('B');// send backcolor command 'B'
%a_UART_Send(msb);// Send msb
%a_UART_Send(lsb);// Send lsb
%a_UART_Receive(255);// Try to collect Ack
%a_GFX_Back_Color = lsb | (msb << 8);
have a couple of questions about this, i don't see anywhere in the code that your call a 0x42 in c code except in initialization,
with that in mind if look at the Forcolor macro i don't see where the command was sent to change that either but it works?
on the back color i didn't realize it would completely redraw the screen with red, but that would make sense after the fact