graphic backcolor

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

graphic backcolor

Post 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

User avatar
BChappy
Posts: 15
Joined: Fri Jun 19, 2009 11:03 pm
Location: Lincoln, UK.
Has thanked: 13 times
Been thanked: 7 times
Contact:

Re: graphic backcolor

Post by BChappy »

Hi,

Has this been resolved/ updated on here somewhere?
Having the same problem corrupting the program!

Thanks

Best regards

Brian
Is your Project Not Working? - Help and General Advice Click here!
Flowcode v8 forum topic - Click here!

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: graphic backcolor

Post 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 8)

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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: graphic backcolor

Post 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.

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: graphic backcolor

Post 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
testing backcolor.fcf
(10 KiB) Downloaded 281 times

Post Reply