src/display.cpp

changeset 53
74e85b34d26b
parent 51
d8042bff0e00
child 54
f6774bd0d570
--- a/src/display.cpp	Tue Nov 10 22:24:03 2020 +0100
+++ b/src/display.cpp	Thu Nov 12 20:26:35 2020 +0100
@@ -180,11 +180,15 @@
 					{
 						nbyte = flags[l].flag / 8;
 						nbit = flags[l].flag % 8;
+						if (flags[l].dimm)
+							color = fgcolor/4;
+						else
+							color = fgcolor;
 
 						if (intxt[nbyte] & (1 << nbit))
 						{  // draw the flag, possibly reversed fg/bg
-							foreground(flags[l].reverse ? bgcolor : fgcolor);
-							background(flags[l].reverse ? fgcolor : bgcolor);
+							foreground(flags[l].reverse ? bgcolor : color);
+							background(flags[l].reverse ? color : bgcolor);
 						}
 						else
 						{  // erase the flag
@@ -237,16 +241,17 @@
 void Display::set_flag(uint8_t flag, bool show, bool dimm)
 {
 	uint8_t i;
-	uint8_t bgcolor = 0x00, fgcolor = 0xFF;
+	uint8_t bgcolor = 0x00, fgcolor = 0x0F;
 
 	if (dimm)
-		fgcolor /= 2;
+		fgcolor = fgcolor / 4;
 
 	for (uint8_t l=0; l<(sizeof(flags)/sizeof(flags[0])); ++l)
 	{
 		if (flag == flags[l].flag)
 		{
-
+			set_font((unsigned char*)Terminal6x8);
+			::printf("  %s flag %x %s\n", show ? "show": "hide", flag, dimm ? "dimmed":"bright");
 			if (show)
 			{
 				foreground(flags[l].reverse ? bgcolor : fgcolor);
@@ -260,7 +265,8 @@
 			if (flags[l].msg != NULL)
 			{ // flag is a string
 				locate(flags[l].x, flags[l].y);
-				set_font((unsigned char*)Terminal6x8);
+				::printf("Move cursor at %dx%d\n", flags[l].x, flags[l].y);
+				::printf("  using fgcolor=%x\n", fgcolor);
 				this->printf(flags[l].msg);}
 			else
 			{ // flag is an icon
@@ -305,7 +311,7 @@
 	ThisThread::sleep_for(3ms);
 	cls();
 	printf("TEST DSP #3\r\n");
-
+	/*
 	for (uint8_t i=0; i<(sizeof(zones)/sizeof(zones[0])); i++)
 	{
 		z = &zones[i];
@@ -313,7 +319,7 @@
 		locate(z->x0+1, z->y0+1);
 		this->printf("%d", i);
 	}
-
+	*/
 	/*
 		for (uint8_t i=0; i<(sizeof(zones)/sizeof(zones[0])); i++)
 		{

mercurial