# HG changeset patch # User David Douard # Date 1604773324 -3600 # Node ID a4a007b3c42edc1f8728f44cfb509b1f3cb5c3bb # Parent 2da50a3d4e9fd5101b0b60cc7772e430b853a245 Fix display of flags and improve dimm char handling diff -r 2da50a3d4e9f -r a4a007b3c42e src/display.cpp --- a/src/display.cpp Sat Nov 07 19:20:39 2020 +0100 +++ b/src/display.cpp Sat Nov 07 19:22:04 2020 +0100 @@ -42,42 +42,42 @@ // dimm the char number of the currently displayed string of the main area; // do this by printing a modifed version of the last displayed string // but only alphanumeric chars should be counted (not the punctuation) - static char txt[64]; char c; uint8_t len, i, j; // for which we need to look for the entry in the table for (i=0; i= len) break; // nothing to do - strncpy(txt, table[i].buffer, table[i].maxsize); - // look for the actual position of the char in the string (only alphanum) - // XXX very poor implementation... - for (j=0; (jn; j--) - { - txt[j+2] = txt[j]; - } - txt[n+2] = '\t'; - txt[n+1] = txt[n]; - txt[n] = '\t'; - txt[len+2] = 0x00; // make sure the string will be terminated - - ::printf("with '%s'\n", txt); - // now display this string - show(0x00, txt, 0); - break; } } } @@ -103,6 +103,7 @@ } else { + pixel_buffer_mutex.lock(); for (i=0; i 0) @@ -173,6 +174,7 @@ { uint8_t nbyte; uint8_t nbit; + uint16_t color; // flags for (uint8_t l=0; l<(sizeof(flags)/sizeof(flags[0])); ++l) { @@ -203,8 +205,9 @@ // draw frames (Alarm and Channel) for (uint8_t l=0; l<(sizeof(frames)/sizeof(frames[0])); ++l) { - uint16_t color; - if (intxt[0] & (1 << frames[l].flag)) // frame flags are on the 1st byte only + nbyte = frames[l].flag / 8; + nbit = frames[l].flag % 8; + if (intxt[nbyte] & (1 << nbit)) color = fgcolor/6; else color = bgcolor; @@ -223,6 +226,8 @@ break; } } + pixel_buffer_mutex.unlock(); + //free(txt); //this->copy_to_lcd(); } diff -r 2da50a3d4e9f -r a4a007b3c42e src/display.h --- a/src/display.h Sat Nov 07 19:20:39 2020 +0100 +++ b/src/display.h Sat Nov 07 19:22:04 2020 +0100 @@ -123,12 +123,12 @@ { 0x0f, 129, 28+16, false, "AVG"}, // F2.7 00 80 00 00 { 0x05, 154+0, 17+10, false, "Alarm"}, // F1.5 20 00 00 00 - { 0x06, 154+0, 17+20, false, "H"}, // F1.6 40 00 00 00 - { 0x0b, 154+6, 17+20, false, "1"}, // F2.3 00 08 00 00 - { 0x08, 154+12, 17+20, false, "2"}, // F2.0 00 01 00 00 - { 0x0a, 154+18, 17+20, false, "3"}, // F2.2 00 04 00 00 + { 0x08, 154+0, 17+20, false, "H"}, // F1.6 40 00 00 00 + { 0x07, 154+6, 17+20, false, "1"}, // F2.3 00 08 00 00 + { 0x06, 154+12, 17+20, false, "2"}, // F2.0 00 01 00 00 + { 0x04, 154+18, 17+20, false, "3"}, // F2.2 00 04 00 00 { 0x09, 154+24, 17+20, false, "4"}, // F2.1 00 02 00 00 - { 0x04, 154+30, 17+20, false, "L"}, // F1.4 00 10 00 00 + { 0x0a, 154+30, 17+20, false, "L"}, // F1.4 00 10 00 00 { 0x80, 224, 54, true, "SHIFT"}, // not an actual command, managed by the front panel }; @@ -151,7 +151,7 @@ static const FRAME frames[] = { { 0x02, 194, 30, 243, 53}, // F1.2 - channel frame - { 0x07, 151, 30, 192, 46}, // F1.7 - alarm frame + { 0x0b, 151, 30, 192, 46}, // F1.7 - alarm frame };