diff --git a/lib/obp60task/Atari16px8b.h b/lib/obp60task/Atari16px8b.h new file mode 100644 index 0000000..c12a5ba --- /dev/null +++ b/lib/obp60task/Atari16px8b.h @@ -0,0 +1,338 @@ +const uint8_t Atari16pxBitmaps[] PROGMEM = { + 0x00, 0xFF, 0xFF, 0x0F, 0xCF, 0x3C, 0xF3, 0xCF, 0x30, 0x66, 0x66, 0xFF, + 0xFF, 0x66, 0x66, 0xFF, 0xFF, 0x66, 0x66, 0x30, 0xC7, 0xFF, 0xC3, 0x0F, + 0x9F, 0x0C, 0x3F, 0xFE, 0x30, 0xC0, 0xCF, 0x3D, 0x86, 0x30, 0xC6, 0x1B, + 0xCF, 0x30, 0x38, 0xF9, 0xB3, 0x63, 0x87, 0x1C, 0x38, 0xDF, 0xBF, 0x36, + 0x6F, 0xEE, 0xC0, 0xFF, 0xF0, 0x36, 0xEC, 0xCC, 0xCC, 0xCE, 0x63, 0xC6, + 0x73, 0x33, 0x33, 0x37, 0x6C, 0x66, 0x66, 0x3C, 0x3C, 0xFF, 0xFF, 0x3C, + 0x3C, 0x66, 0x66, 0x30, 0xC3, 0x3F, 0xFC, 0xC3, 0x0C, 0x6D, 0xBD, 0x00, + 0xFF, 0xF0, 0xFF, 0x0C, 0x30, 0xC6, 0x18, 0xC3, 0x18, 0x63, 0x0C, 0x30, + 0x7B, 0xFC, 0xF3, 0xCF, 0x7E, 0xF3, 0xCF, 0x3F, 0xDE, 0x30, 0xC7, 0x1C, + 0x30, 0xC3, 0x0C, 0x30, 0xCF, 0xFF, 0x7B, 0xFC, 0xF3, 0x18, 0x63, 0x0C, + 0x61, 0x8F, 0xFF, 0xFF, 0xF1, 0x86, 0x30, 0xC1, 0x86, 0xCF, 0x3F, 0xDE, + 0x18, 0x63, 0x8E, 0x79, 0xED, 0xB6, 0xFF, 0xF1, 0x86, 0xFF, 0xFC, 0x30, + 0xFB, 0xF0, 0xC3, 0x0F, 0x3F, 0xDE, 0x39, 0xEE, 0x30, 0xC3, 0xEF, 0xF3, + 0xCF, 0x3F, 0xDE, 0xFF, 0xF0, 0xC3, 0x18, 0x63, 0x0C, 0x61, 0x86, 0x18, + 0x7B, 0xFC, 0xF3, 0x79, 0xEC, 0xF3, 0xCF, 0x3F, 0xDE, 0x7B, 0xFC, 0xF3, + 0xFD, 0xF0, 0xC3, 0x0C, 0x77, 0x9C, 0xFF, 0x0F, 0xF0, 0x6D, 0xB0, 0x1B, + 0x6F, 0x40, 0x0E, 0x38, 0xE3, 0x8E, 0x0E, 0x0E, 0x0E, 0x0E, 0xFF, 0xF0, + 0x00, 0xFF, 0xF0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE3, 0x8E, 0x38, 0xE0, 0x7B, + 0xFC, 0xF3, 0x18, 0x63, 0x0C, 0x30, 0x03, 0x0C, 0x38, 0xFB, 0x9E, 0x1D, + 0xBA, 0xF5, 0xEE, 0xC1, 0xC5, 0xF9, 0xE0, 0x31, 0xEF, 0xF3, 0xCF, 0x3F, + 0xFF, 0xCF, 0x3C, 0xF3, 0xFB, 0xFC, 0xF3, 0xFF, 0xEC, 0xF3, 0xCF, 0x3F, + 0xFE, 0x7B, 0xFC, 0xF3, 0xC3, 0x0C, 0x30, 0xCF, 0x3F, 0xDE, 0xF3, 0xED, + 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x7F, 0xBC, 0xFF, 0xFC, 0x30, 0xFB, 0xEC, + 0x30, 0xC3, 0x0F, 0xFF, 0xFF, 0xFC, 0x30, 0xFB, 0xEC, 0x30, 0xC3, 0x0C, + 0x30, 0x7F, 0xFC, 0x30, 0xDF, 0x7C, 0xF3, 0xCF, 0x3F, 0xDE, 0xCF, 0x3C, + 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, + 0x0C, 0x30, 0xCF, 0xFF, 0x0C, 0x30, 0xC3, 0x0C, 0x30, 0xC3, 0xCF, 0x3F, + 0xDE, 0xCD, 0x9B, 0x66, 0xCF, 0x1E, 0x36, 0x6C, 0xCD, 0x9B, 0x1E, 0x30, + 0xC3, 0x0C, 0x30, 0xC3, 0x0C, 0x30, 0xC3, 0x0F, 0xFF, 0xC7, 0x8F, 0xBF, + 0x7F, 0xFA, 0xF5, 0xE3, 0xC7, 0x8F, 0x1E, 0x30, 0xCF, 0x3C, 0xFB, 0xEF, + 0xFF, 0xF7, 0xDF, 0x3C, 0xF3, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, + 0x3F, 0xDE, 0xFB, 0xFC, 0xF3, 0xCF, 0x3F, 0xFE, 0xC3, 0x0C, 0x30, 0x7B, + 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x5F, 0x9B, 0xF9, 0xFB, 0x36, 0x6C, + 0xDF, 0xBE, 0x6C, 0xCD, 0x9B, 0x1E, 0x30, 0x7F, 0xFC, 0x30, 0xE1, 0xC3, + 0x87, 0x0C, 0x3F, 0xFE, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0x30, 0xC3, + 0x0C, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xCF, 0x3F, 0xDE, 0xCF, 0x3C, + 0xF3, 0xCF, 0x3C, 0xF3, 0x79, 0xE3, 0x0C, 0xC7, 0x8F, 0x1E, 0x3C, 0x7A, + 0xF5, 0xFF, 0xFF, 0xDF, 0x1C, 0x10, 0xCF, 0x3C, 0xDE, 0x78, 0xC3, 0x1E, + 0x7B, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0x79, 0xE3, 0x0C, 0x30, 0xC3, 0x0C, + 0xFF, 0xF1, 0x86, 0x30, 0xC6, 0x18, 0xC3, 0x0F, 0xFF, 0xFF, 0xCC, 0xCC, + 0xCC, 0xCC, 0xFF, 0xC3, 0x0C, 0x18, 0x60, 0xC3, 0x06, 0x18, 0x30, 0xC3, + 0xFF, 0x33, 0x33, 0x33, 0x33, 0xFF, 0x10, 0x20, 0xE1, 0xC6, 0xCD, 0xB1, + 0xE3, 0xFF, 0xFC, 0x86, 0x38, 0xE3, 0x8C, 0x20, 0x79, 0xF0, 0xDF, 0xFF, + 0x3C, 0xFF, 0x7C, 0xC3, 0x0C, 0x3E, 0xFF, 0x3C, 0xF3, 0xCF, 0x3F, 0xFE, + 0x7B, 0xEC, 0x30, 0xC3, 0x0C, 0x3F, 0x7C, 0x0C, 0x30, 0xDF, 0xFF, 0x3C, + 0xF3, 0xCF, 0x3F, 0xDF, 0x7B, 0xFC, 0xF3, 0xFF, 0x0C, 0x3F, 0x7C, 0x1C, + 0xF3, 0x0C, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0x7F, 0xFC, 0xF3, 0xCF, + 0x3F, 0xDF, 0x0F, 0xFF, 0x80, 0xC3, 0x0C, 0x3E, 0xFF, 0x3C, 0xF3, 0xCF, + 0x3C, 0xF3, 0x66, 0x0E, 0xE6, 0x66, 0x66, 0xFF, 0x18, 0xC0, 0x31, 0x8C, + 0x63, 0x18, 0xC6, 0x3F, 0xF8, 0xC1, 0x83, 0x06, 0x6D, 0xDF, 0x3C, 0x7C, + 0xD9, 0x9B, 0x3E, 0x30, 0xEE, 0x66, 0x66, 0x66, 0x66, 0xFF, 0x6D, 0xFF, + 0xFE, 0xBD, 0x7A, 0xF1, 0xE3, 0xC6, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, + 0xCC, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0xFB, 0xFC, 0xF3, 0xCF, + 0x3C, 0xFF, 0xFB, 0x0C, 0x00, 0x7F, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, + 0x30, 0xC0, 0xFB, 0xFC, 0xF0, 0xC3, 0x0C, 0x30, 0xC0, 0x7F, 0xFC, 0x38, + 0x78, 0x70, 0xFF, 0xF8, 0x30, 0xCF, 0xFF, 0x30, 0xC3, 0x0C, 0x30, 0xF1, + 0xC0, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0xCF, 0x3C, 0xF3, 0xCD, + 0xE7, 0x8C, 0x30, 0xC7, 0x8F, 0x5E, 0xBF, 0xFF, 0xFB, 0xE3, 0x82, 0xCF, + 0x37, 0x9E, 0x31, 0xE7, 0xB3, 0xCC, 0xCF, 0x3C, 0xF3, 0xCF, 0x3F, 0xDF, + 0x0F, 0xFF, 0x80, 0xFF, 0xF1, 0x8C, 0x31, 0x86, 0x3F, 0xFC, 0x0E, 0x30, + 0x60, 0xC1, 0x87, 0x3C, 0x78, 0x38, 0x30, 0x60, 0xC1, 0x81, 0xC0, 0xFF, + 0xFF, 0xFF, 0xF0, 0xE0, 0x60, 0xC1, 0x83, 0x07, 0x07, 0x8F, 0x38, 0x60, + 0xC1, 0x83, 0x1C, 0x00, 0x63, 0xE6, 0xFC, 0xE0, 0xFC, 0x63, 0x18, 0xC6, + 0x31, 0x8C, 0x7E, 0x00, 0xF3, 0xFF, 0xFF, 0x30, 0xC7, 0xBF, 0xCF, 0x0C, + 0x33, 0xFD, 0xE3, 0x0C, 0x0E, 0x1E, 0x38, 0x30, 0x30, 0x30, 0x30, 0xFE, + 0x30, 0x30, 0x30, 0x7F, 0xFF, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, + 0xCF, 0x3C, 0xF3, 0xFD, 0xE3, 0x3F, 0x30, 0xC3, 0x0C, 0xFC, 0x63, 0x18, + 0xC6, 0x31, 0x8C, 0x7E, 0x39, 0xB6, 0x4C, 0x7B, 0x3C, 0xDE, 0x32, 0x6D, + 0x9C, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0x7D, 0x8E, 0x0D, 0xDA, + 0x34, 0x68, 0xDD, 0x83, 0x8D, 0xF0, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, + 0x7C, 0x0F, 0xC0, 0x1A, 0x6D, 0xB6, 0xC6, 0xC6, 0xC6, 0x80, 0xFF, 0xF0, + 0xC3, 0x0C, 0xFF, 0x7D, 0x8E, 0x0D, 0xDA, 0xB6, 0x6E, 0xD5, 0x83, 0x8D, + 0xF0, 0xFF, 0xFC, 0x76, 0xE3, 0xB7, 0x00, 0x30, 0xC3, 0x3F, 0xFC, 0xC3, + 0x0C, 0x03, 0xFF, 0xC0, 0x69, 0x36, 0xCF, 0xF3, 0x63, 0x96, 0xFC, 0x63, + 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7F, + 0x5D, 0xC0, 0x80, 0x7B, 0x97, 0x2E, 0x5C, 0xB9, 0x5E, 0x85, 0x0A, 0x14, + 0x28, 0x50, 0x6F, 0xF6, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0xD5, + 0x50, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x0F, 0xC0, 0xB1, 0xB1, + 0xB1, 0xB6, 0xDB, 0x2C, 0x00, 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, + 0xFC, 0x63, 0x18, 0xC6, 0x31, 0x8C, 0x7E, 0xFC, 0x63, 0x18, 0xC6, 0x31, + 0x8C, 0x7E, 0x30, 0xC0, 0x0C, 0x30, 0xC6, 0x18, 0xCF, 0x3F, 0xDE, 0xC1, + 0x83, 0x00, 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0x0C, 0x63, + 0x00, 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0x31, 0xEC, 0xC0, + 0x7B, 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0x67, 0xD9, 0x80, 0x7B, + 0xFC, 0xF3, 0xFF, 0xFC, 0xF3, 0xCF, 0x30, 0xCF, 0x33, 0x1E, 0xFF, 0x3C, + 0xFF, 0xFF, 0x3C, 0xF3, 0xCC, 0x7B, 0x37, 0x8C, 0x7B, 0xFC, 0xF3, 0xFF, + 0xFC, 0xF3, 0xCF, 0x30, 0x3E, 0xFF, 0xE6, 0xCD, 0x9B, 0xF7, 0xFC, 0xF9, + 0xB3, 0x66, 0xFD, 0xE0, 0x7B, 0xFC, 0xF3, 0xC3, 0x0C, 0x30, 0xCF, 0x3F, + 0xDE, 0x19, 0xC0, 0xC1, 0x83, 0x00, 0xFF, 0xFC, 0x3E, 0xFB, 0x0C, 0x30, + 0xFF, 0xF0, 0x0C, 0x63, 0x00, 0xFF, 0xFC, 0x3E, 0xFB, 0x0C, 0x30, 0xFF, + 0xF0, 0x31, 0xEC, 0xC0, 0xFF, 0xFC, 0x3E, 0xFB, 0x0C, 0x30, 0xFF, 0xF0, + 0xCF, 0x30, 0x3F, 0xFF, 0x0F, 0xBE, 0xC3, 0x0C, 0x3F, 0xFC, 0xC1, 0x83, + 0x00, 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0xFF, 0xF0, 0x0C, 0x63, 0x00, + 0xFF, 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0xFF, 0xF0, 0x31, 0xEC, 0xC0, 0xFF, + 0xF3, 0x0C, 0x30, 0xC3, 0x0C, 0xFF, 0xF0, 0xCF, 0x30, 0x3F, 0xFC, 0xC3, + 0x0C, 0x30, 0xC3, 0x3F, 0xFC, 0x78, 0xF9, 0xBB, 0x36, 0x7E, 0xFD, 0xB3, + 0x66, 0xDD, 0xF3, 0xC0, 0x67, 0xD9, 0x80, 0xCF, 0x3E, 0xFF, 0xFF, 0x7C, + 0xF3, 0xCC, 0xC1, 0x83, 0x00, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, + 0xE0, 0x0C, 0x63, 0x00, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, + 0x31, 0xEC, 0xC0, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, 0x67, + 0xD9, 0x80, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, 0xCF, 0x30, + 0x1E, 0xFF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0xCD, 0xE3, 0x1E, 0xCC, + 0x01, 0x3D, 0x7E, 0x66, 0x66, 0x6E, 0x6E, 0x76, 0x76, 0x66, 0x66, 0x7E, + 0xBC, 0x80, 0xC1, 0x83, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, + 0xE0, 0x0C, 0x63, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, + 0x31, 0xEC, 0xC0, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xF3, 0xFD, 0xE0, 0xCF, + 0x30, 0x33, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x0C, 0x63, 0x00, + 0xCF, 0x3C, 0xF3, 0x79, 0xE3, 0x0C, 0x30, 0xC0, 0xC3, 0x0F, 0xBF, 0xCF, + 0x3C, 0xFF, 0xFB, 0x0C, 0x30, 0x31, 0xEC, 0xF3, 0xCF, 0xEC, 0xF3, 0xCF, + 0xED, 0xB0, 0x80, 0xC1, 0x83, 0x00, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, + 0x7C, 0x0C, 0x63, 0x00, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, 0x7C, 0x31, + 0xEC, 0xC0, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, 0x7C, 0x67, 0xD9, 0x80, + 0x79, 0xF0, 0xDF, 0xFF, 0x3C, 0xFF, 0x7C, 0xCF, 0x30, 0x1E, 0x7C, 0x37, + 0xFF, 0xCF, 0x3F, 0xDF, 0x39, 0xB3, 0x80, 0x79, 0xF0, 0xDF, 0xFF, 0x3C, + 0xFF, 0x7C, 0x76, 0x7F, 0x1B, 0x7B, 0xFF, 0xD8, 0xD8, 0xFF, 0x7F, 0x7B, + 0xEC, 0x30, 0xC3, 0x0C, 0x3F, 0x7C, 0x67, 0x00, 0xC1, 0x83, 0x00, 0x7B, + 0xFC, 0xF3, 0xFF, 0x0C, 0x3F, 0x7C, 0x0C, 0x63, 0x00, 0x7B, 0xFC, 0xF3, + 0xFF, 0x0C, 0x3F, 0x7C, 0x31, 0xEC, 0xC0, 0x7B, 0xFC, 0xF3, 0xFF, 0x0C, + 0x3F, 0x7C, 0xCF, 0x30, 0x1E, 0xFF, 0x3C, 0xFF, 0xC3, 0x0F, 0xDF, 0xC3, + 0x0C, 0x07, 0x38, 0xC6, 0x31, 0x8C, 0xF7, 0x80, 0x19, 0x98, 0x0E, 0x71, + 0x8C, 0x63, 0x19, 0xEF, 0x00, 0x31, 0xEC, 0xC0, 0x71, 0xC3, 0x0C, 0x30, + 0xC3, 0x1E, 0x78, 0xCF, 0x30, 0x1C, 0x70, 0xC3, 0x0C, 0x30, 0xC7, 0x9E, + 0x78, 0xC7, 0x86, 0x7F, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x67, 0xD9, + 0x80, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xF3, 0xCC, 0xC1, 0x83, 0x00, 0x7B, + 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, 0x0C, 0x63, 0x00, 0x7B, 0xFC, 0xF3, + 0xCF, 0x3C, 0xFF, 0x78, 0x31, 0xEC, 0xC0, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, + 0xFF, 0x78, 0x67, 0xD9, 0x80, 0x7B, 0xFC, 0xF3, 0xCF, 0x3C, 0xFF, 0x78, + 0xCF, 0x30, 0x1E, 0xFF, 0x3C, 0xF3, 0xCF, 0x3F, 0xDE, 0x30, 0xC0, 0x3F, + 0xFC, 0x03, 0x0C, 0x01, 0x3D, 0x7E, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x7E, + 0xBC, 0x80, 0xC1, 0x83, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, + 0x0C, 0x63, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0x31, 0xEC, + 0xC0, 0xCF, 0x3C, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0xCF, 0x30, 0x33, 0xCF, + 0x3C, 0xF3, 0xCF, 0x3F, 0xDF, 0x0C, 0x63, 0x00, 0xCF, 0x3C, 0xF3, 0xCF, + 0x3F, 0xDF, 0x0F, 0xFF, 0x80, 0xC3, 0x0C, 0x3E, 0xFF, 0x3C, 0xF3, 0xCF, + 0x3F, 0xFE, 0xC3, 0x00, 0xCF, 0x30, 0x33, 0xCF, 0x3C, 0xF3, 0xCF, 0xF7, + 0xC3, 0xFF, 0xE0 }; + +const GFXglyph Atari16pxGlyphs[] PROGMEM = { + { 0, 1, 1, 8, 0, 0 }, // 0x20 ' ' U+0020 + { 1, 2, 12, 8, 3, -11 }, // 0x21 '!' U+0021 + { 4, 6, 6, 8, 1, -11 }, // 0x22 '"' U+0022 + { 9, 8, 10, 8, 0, -11 }, // 0x23 '#' U+0023 + { 19, 6, 14, 8, 1, -13 }, // 0x24 '$' U+0024 + { 30, 6, 10, 8, 1, -11 }, // 0x25 '%' U+0025 + { 38, 7, 14, 8, 0, -13 }, // 0x26 '&' U+0026 + { 51, 2, 6, 8, 3, -11 }, // 0x27 ''' U+0027 + { 53, 4, 12, 8, 3, -11 }, // 0x28 '(' U+0028 + { 59, 4, 12, 8, 1, -11 }, // 0x29 ')' U+0029 + { 65, 8, 10, 8, 0, -11 }, // 0x2a '*' U+002A + { 75, 6, 8, 8, 1, -10 }, // 0x2b '+' U+002B + { 81, 3, 6, 8, 2, -3 }, // 0x2c ',' U+002C + { 84, 6, 2, 8, 1, -7 }, // 0x2d '-' U+002D + { 86, 2, 4, 8, 3, -3 }, // 0x2e '.' U+002E + { 87, 6, 12, 8, 1, -11 }, // 0x2f '/' U+002F + { 96, 6, 12, 8, 1, -11 }, // 0x30 '0' U+0030 + { 105, 6, 12, 8, 1, -11 }, // 0x31 '1' U+0031 + { 114, 6, 12, 8, 1, -11 }, // 0x32 '2' U+0032 + { 123, 6, 12, 8, 1, -11 }, // 0x33 '3' U+0033 + { 132, 6, 12, 8, 1, -11 }, // 0x34 '4' U+0034 + { 141, 6, 12, 8, 1, -11 }, // 0x35 '5' U+0035 + { 150, 6, 12, 8, 1, -11 }, // 0x36 '6' U+0036 + { 159, 6, 12, 8, 1, -11 }, // 0x37 '7' U+0037 + { 168, 6, 12, 8, 1, -11 }, // 0x38 '8' U+0038 + { 177, 6, 12, 8, 1, -11 }, // 0x39 '9' U+0039 + { 186, 2, 10, 8, 3, -9 }, // 0x3a ':' U+003A + { 189, 3, 12, 8, 2, -9 }, // 0x3b ';' U+003B + { 194, 7, 9, 8, 0, -10 }, // 0x3c '<' U+003C + { 202, 6, 6, 8, 1, -9 }, // 0x3d '=' U+003D + { 207, 7, 9, 8, 0, -10 }, // 0x3e '>' U+003E + { 215, 6, 12, 8, 1, -11 }, // 0x3f '?' U+003F + { 224, 7, 12, 8, 0, -11 }, // 0x40 '@' U+0040 + { 235, 6, 12, 8, 1, -11 }, // 0x41 'A' U+0041 + { 244, 6, 12, 8, 1, -11 }, // 0x42 'B' U+0042 + { 253, 6, 12, 8, 1, -11 }, // 0x43 'C' U+0043 + { 262, 6, 12, 8, 1, -11 }, // 0x44 'D' U+0044 + { 271, 6, 12, 8, 1, -11 }, // 0x45 'E' U+0045 + { 280, 6, 12, 8, 1, -11 }, // 0x46 'F' U+0046 + { 289, 6, 12, 8, 1, -11 }, // 0x47 'G' U+0047 + { 298, 6, 12, 8, 1, -11 }, // 0x48 'H' U+0048 + { 307, 6, 12, 8, 1, -11 }, // 0x49 'I' U+0049 + { 316, 6, 12, 8, 1, -11 }, // 0x4a 'J' U+004A + { 325, 7, 12, 8, 0, -11 }, // 0x4b 'K' U+004B + { 336, 6, 12, 8, 1, -11 }, // 0x4c 'L' U+004C + { 345, 7, 12, 8, 0, -11 }, // 0x4d 'M' U+004D + { 356, 6, 12, 8, 1, -11 }, // 0x4e 'N' U+004E + { 365, 6, 12, 8, 1, -11 }, // 0x4f 'O' U+004F + { 374, 6, 12, 8, 1, -11 }, // 0x50 'P' U+0050 + { 383, 6, 12, 8, 1, -11 }, // 0x51 'Q' U+0051 + { 392, 7, 12, 8, 0, -11 }, // 0x52 'R' U+0052 + { 403, 6, 12, 8, 1, -11 }, // 0x53 'S' U+0053 + { 412, 6, 12, 8, 1, -11 }, // 0x54 'T' U+0054 + { 421, 6, 12, 8, 1, -11 }, // 0x55 'U' U+0055 + { 430, 6, 12, 8, 1, -11 }, // 0x56 'V' U+0056 + { 439, 7, 12, 8, 0, -11 }, // 0x57 'W' U+0057 + { 450, 6, 12, 8, 1, -11 }, // 0x58 'X' U+0058 + { 459, 6, 12, 8, 1, -11 }, // 0x59 'Y' U+0059 + { 468, 6, 12, 8, 1, -11 }, // 0x5a 'Z' U+005A + { 477, 4, 12, 8, 3, -11 }, // 0x5b '[' U+005B + { 483, 6, 12, 8, 1, -11 }, // 0x5c '\' U+005C + { 492, 4, 12, 8, 1, -11 }, // 0x5d ']' U+005D + { 498, 7, 8, 8, 0, -12 }, // 0x5e '^' U+005E + { 505, 7, 2, 8, 0, -1 }, // 0x5f '_' U+005F + { 507, 5, 7, 8, 1, -13 }, // 0x60 '`' U+0060 + { 512, 6, 9, 8, 1, -8 }, // 0x61 'a' U+0061 + { 519, 6, 12, 8, 1, -11 }, // 0x62 'b' U+0062 + { 528, 6, 9, 8, 1, -8 }, // 0x63 'c' U+0063 + { 535, 6, 12, 8, 1, -11 }, // 0x64 'd' U+0064 + { 544, 6, 9, 8, 1, -8 }, // 0x65 'e' U+0065 + { 551, 6, 12, 8, 1, -11 }, // 0x66 'f' U+0066 + { 560, 6, 11, 8, 1, -8 }, // 0x67 'g' U+0067 + { 569, 6, 12, 8, 1, -11 }, // 0x68 'h' U+0068 + { 578, 4, 12, 8, 2, -11 }, // 0x69 'i' U+0069 + { 584, 5, 14, 8, 1, -11 }, // 0x6a 'j' U+006A + { 593, 7, 12, 8, 0, -11 }, // 0x6b 'k' U+006B + { 604, 4, 12, 8, 2, -11 }, // 0x6c 'l' U+006C + { 610, 7, 9, 8, 0, -8 }, // 0x6d 'm' U+006D + { 618, 6, 9, 8, 1, -8 }, // 0x6e 'n' U+006E + { 625, 6, 9, 8, 1, -8 }, // 0x6f 'o' U+006F + { 632, 6, 11, 8, 1, -8 }, // 0x70 'p' U+0070 + { 641, 6, 11, 8, 1, -8 }, // 0x71 'q' U+0071 + { 650, 6, 9, 8, 1, -8 }, // 0x72 'r' U+0072 + { 657, 6, 9, 8, 1, -8 }, // 0x73 's' U+0073 + { 664, 6, 11, 8, 1, -10 }, // 0x74 't' U+0074 + { 673, 6, 9, 8, 1, -8 }, // 0x75 'u' U+0075 + { 680, 6, 9, 8, 1, -8 }, // 0x76 'v' U+0076 + { 687, 7, 9, 8, 0, -8 }, // 0x77 'w' U+0077 + { 695, 6, 9, 8, 1, -8 }, // 0x78 'x' U+0078 + { 702, 6, 11, 8, 1, -8 }, // 0x79 'y' U+0079 + { 711, 6, 9, 8, 1, -8 }, // 0x7a 'z' U+007A + { 718, 7, 14, 8, 0, -12 }, // 0x7b '{' U+007B + { 731, 2, 14, 8, 3, -12 }, // 0x7c '|' U+007C + { 735, 7, 14, 8, 0, -12 }, // 0x7d '}' U+007D + { 748, 7, 4, 8, 0, -8 }, // 0x7e '~' U+007E + { 752, 5, 11, 8, 1, -10 }, // 0x7f 'REPLACEMENT CHARACTER *' U+2370 + { 759, 1, 1, 8, 0, 0 }, // 0x80 'NO-BREAK SPACE' U+00A0 + { 760, 2, 12, 8, 3, -10 }, // 0x81 'INVERTED EXCLAMATION MARK' U+00A1 + { 763, 6, 12, 8, 1, -11 }, // 0x82 'CENT SIGN' U+00A2 + { 772, 8, 13, 8, 0, -12 }, // 0x83 'POUND SIGN' U+00A3 + { 785, 5, 11, 8, 1, -10 }, // 0x84 'CURRENCY SIGN' U+00A4 + { 792, 6, 12, 8, 1, -11 }, // 0x85 'YEN SIGN' U+00A5 + { 801, 5, 11, 8, 1, -10 }, // 0x86 'BROKEN BAR' U+00A6 + { 808, 6, 12, 8, 1, -11 }, // 0x87 'SECTION SIGN' U+00A7 + { 817, 5, 11, 8, 1, -10 }, // 0x88 'DIAERESIS' U+00A8 + { 824, 7, 11, 8, 0, -11 }, // 0x89 'COPYRIGHT SIGN' U+00A9 + { 834, 6, 11, 8, 1, -9 }, // 0x8a 'FEMININE ORDINAL INDICATOR' U+00AA + { 843, 7, 7, 8, 0, -7 }, // 0x8b 'LEFT-POINTING DOUBLE ANGLE QUOTATION MARK' U+00AB + { 850, 6, 5, 8, 1, -4 }, // 0x8c 'NOT SIGN' U+00AC + { 854, 4, 2, 8, 2, -4 }, // 0x8d 'SOFT HYPHEN' U+00AD + { 855, 7, 11, 8, 0, -11 }, // 0x8e 'REGISTERED SIGN' U+00AE + { 865, 7, 2, 8, 0, -12 }, // 0x8f 'MACRON' U+00AF + { 867, 5, 5, 8, 1, -12 }, // 0x90 'DEGREE SIGN' U+00B0 + { 871, 6, 11, 8, 1, -10 }, // 0x91 'PLUS-MINUS SIGN' U+00B1 + { 880, 4, 6, 8, 1, -11 }, // 0x92 'SUPERSCRIPT TWO' U+00B2 + { 883, 4, 6, 8, 1, -11 }, // 0x93 'SUPERSCRIPT THREE' U+00B3 + { 886, 5, 11, 8, 1, -10 }, // 0x94 'ACUTE ACCENT' U+00B4 + { 893, 8, 10, 8, 0, -8 }, // 0x95 'MICRO SIGN' U+00B5 + { 903, 7, 12, 8, 0, -11 }, // 0x96 'PILCROW SIGN' U+00B6 + { 914, 4, 4, 8, 2, -6 }, // 0x97 'MIDDLE DOT' U+00B7 + { 916, 5, 11, 8, 1, -10 }, // 0x98 'CEDILLA' U+00B8 + { 923, 2, 6, 8, 1, -11 }, // 0x99 'SUPERSCRIPT ONE' U+00B9 + { 925, 6, 11, 8, 1, -9 }, // 0x9a 'MASCULINE ORDINAL INDICATOR' U+00BA + { 934, 7, 7, 8, 0, -7 }, // 0x9b 'RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK' U+00BB + { 941, 5, 11, 8, 1, -10 }, // 0x9c 'VULGAR FRACTION ONE QUARTER' U+00BC + { 948, 5, 11, 8, 1, -10 }, // 0x9d 'VULGAR FRACTION ONE HALF' U+00BD + { 955, 5, 11, 8, 1, -10 }, // 0x9e 'VULGAR FRACTION THREE QUARTERS' U+00BE + { 962, 6, 12, 8, 1, -11 }, // 0x9f 'INVERTED QUESTION MARK' U+00BF + { 971, 6, 14, 8, 1, -13 }, // 0xa0 'LATIN CAPITAL LETTER A WITH GRAVE' U+00C0 + { 982, 6, 14, 8, 1, -13 }, // 0xa1 'LATIN CAPITAL LETTER A WITH ACUTE' U+00C1 + { 993, 6, 14, 8, 1, -13 }, // 0xa2 'LATIN CAPITAL LETTER A WITH CIRCUMFLEX' U+00C2 + { 1004, 6, 14, 8, 1, -13 }, // 0xa3 'LATIN CAPITAL LETTER A WITH TILDE' U+00C3 + { 1015, 6, 13, 8, 1, -12 }, // 0xa4 'LATIN CAPITAL LETTER A WITH DIAERESIS' U+00C4 + { 1025, 6, 14, 8, 1, -13 }, // 0xa5 'LATIN CAPITAL LETTER A WITH RING ABOVE' U+00C5 + { 1036, 7, 13, 8, 0, -12 }, // 0xa6 'LATIN CAPITAL LETTER AE' U+00C6 + { 1048, 6, 14, 8, 1, -11 }, // 0xa7 'LATIN CAPITAL LETTER C WITH CEDILLA' U+00C7 + { 1059, 6, 14, 8, 1, -13 }, // 0xa8 'LATIN CAPITAL LETTER E WITH GRAVE' U+00C8 + { 1070, 6, 14, 8, 1, -13 }, // 0xa9 'LATIN CAPITAL LETTER E WITH ACUTE' U+00C9 + { 1081, 6, 14, 8, 1, -13 }, // 0xaa 'LATIN CAPITAL LETTER E WITH CIRCUMFLEX' U+00CA + { 1092, 6, 13, 8, 1, -12 }, // 0xab 'LATIN CAPITAL LETTER E WITH DIAERESIS' U+00CB + { 1102, 6, 14, 8, 1, -13 }, // 0xac 'LATIN CAPITAL LETTER I WITH GRAVE' U+00CC + { 1113, 6, 14, 8, 1, -13 }, // 0xad 'LATIN CAPITAL LETTER I WITH ACUTE' U+00CD + { 1124, 6, 14, 8, 1, -13 }, // 0xae 'LATIN CAPITAL LETTER I WITH CIRCUMFLEX' U+00CE + { 1135, 6, 13, 8, 1, -12 }, // 0xaf 'LATIN CAPITAL LETTER I WITH DIAERESIS' U+00CF + { 1145, 7, 12, 8, 0, -11 }, // 0xb0 'LATIN CAPITAL LETTER ETH' U+00D0 + { 1156, 6, 13, 8, 1, -12 }, // 0xb1 'LATIN CAPITAL LETTER N WITH TILDE' U+00D1 + { 1166, 6, 14, 8, 1, -13 }, // 0xb2 'LATIN CAPITAL LETTER O WITH GRAVE' U+00D2 + { 1177, 6, 14, 8, 1, -13 }, // 0xb3 'LATIN CAPITAL LETTER O WITH ACUTE' U+00D3 + { 1188, 6, 14, 8, 1, -13 }, // 0xb4 'LATIN CAPITAL LETTER O WITH CIRCUMFLEX' U+00D4 + { 1199, 6, 14, 8, 1, -13 }, // 0xb5 'LATIN CAPITAL LETTER O WITH TILDE' U+00D5 + { 1210, 6, 13, 8, 1, -12 }, // 0xb6 'LATIN CAPITAL LETTER O WITH DIAERESIS' U+00D6 + { 1220, 6, 5, 8, 1, -6 }, // 0xb7 'MULTIPLICATION SIGN' U+00D7 + { 1224, 8, 14, 8, 0, -12 }, // 0xb8 'LATIN CAPITAL LETTER O WITH STROKE' U+00D8 + { 1238, 6, 14, 8, 1, -13 }, // 0xb9 'LATIN CAPITAL LETTER U WITH GRAVE' U+00D9 + { 1249, 6, 14, 8, 1, -13 }, // 0xba 'LATIN CAPITAL LETTER U WITH ACUTE' U+00DA + { 1260, 6, 14, 8, 1, -13 }, // 0xbb 'LATIN CAPITAL LETTER U WITH CIRCUMFLEX' U+00DB + { 1271, 6, 13, 8, 1, -12 }, // 0xbc 'LATIN CAPITAL LETTER U WITH DIAERESIS' U+00DC + { 1281, 6, 14, 8, 1, -13 }, // 0xbd 'LATIN CAPITAL LETTER Y WITH ACUTE' U+00DD + { 1292, 6, 12, 8, 1, -11 }, // 0xbe 'LATIN CAPITAL LETTER THORN' U+00DE + { 1301, 6, 13, 8, 1, -11 }, // 0xbf 'LATIN SMALL LETTER SHARP S' U+00DF + { 1311, 6, 13, 8, 1, -12 }, // 0xc0 'LATIN SMALL LETTER A WITH GRAVE' U+00E0 + { 1321, 6, 13, 8, 1, -12 }, // 0xc1 'LATIN SMALL LETTER A WITH ACUTE' U+00E1 + { 1331, 6, 13, 8, 1, -12 }, // 0xc2 'LATIN SMALL LETTER A WITH CIRCUMFLEX' U+00E2 + { 1341, 6, 13, 8, 1, -12 }, // 0xc3 'LATIN SMALL LETTER A WITH TILDE' U+00E3 + { 1351, 6, 12, 8, 1, -11 }, // 0xc4 'LATIN SMALL LETTER A WITH DIAERESIS' U+00E4 + { 1360, 6, 13, 8, 1, -12 }, // 0xc5 'LATIN SMALL LETTER A WITH RING ABOVE' U+00E5 + { 1370, 8, 9, 8, 0, -8 }, // 0xc6 'LATIN SMALL LETTER AE' U+00E6 + { 1379, 6, 11, 8, 1, -8 }, // 0xc7 'LATIN SMALL LETTER C WITH CEDILLA' U+00E7 + { 1388, 6, 13, 8, 1, -12 }, // 0xc8 'LATIN SMALL LETTER E WITH GRAVE' U+00E8 + { 1398, 6, 13, 8, 1, -12 }, // 0xc9 'LATIN SMALL LETTER E WITH ACUTE' U+00E9 + { 1408, 6, 13, 8, 1, -12 }, // 0xca 'LATIN SMALL LETTER E WITH CIRCUMFLEX' U+00EA + { 1418, 6, 12, 8, 1, -11 }, // 0xcb 'LATIN SMALL LETTER E WITH DIAERESIS' U+00EB + { 1427, 5, 13, 8, 1, -12 }, // 0xcc 'LATIN SMALL LETTER I WITH GRAVE' U+00EC + { 1436, 5, 13, 8, 2, -12 }, // 0xcd 'LATIN SMALL LETTER I WITH ACUTE' U+00ED + { 1445, 6, 13, 8, 1, -12 }, // 0xce 'LATIN SMALL LETTER I WITH CIRCUMFLEX' U+00EE + { 1455, 6, 12, 8, 1, -11 }, // 0xcf 'LATIN SMALL LETTER I WITH DIAERESIS' U+00EF + { 1464, 6, 13, 8, 1, -12 }, // 0xd0 'LATIN SMALL LETTER ETH' U+00F0 + { 1474, 6, 13, 8, 1, -12 }, // 0xd1 'LATIN SMALL LETTER N WITH TILDE' U+00F1 + { 1484, 6, 13, 8, 1, -12 }, // 0xd2 'LATIN SMALL LETTER O WITH GRAVE' U+00F2 + { 1494, 6, 13, 8, 1, -12 }, // 0xd3 'LATIN SMALL LETTER O WITH ACUTE' U+00F3 + { 1504, 6, 13, 8, 1, -12 }, // 0xd4 'LATIN SMALL LETTER O WITH CIRCUMFLEX' U+00F4 + { 1514, 6, 13, 8, 1, -12 }, // 0xd5 'LATIN SMALL LETTER O WITH TILDE' U+00F5 + { 1524, 6, 12, 8, 1, -11 }, // 0xd6 'LATIN SMALL LETTER O WITH DIAERESIS' U+00F6 + { 1533, 6, 8, 8, 1, -10 }, // 0xd7 'DIVISION SIGN' U+00F7 + { 1539, 8, 11, 8, 0, -9 }, // 0xd8 'LATIN SMALL LETTER O WITH STROKE' U+00F8 + { 1550, 6, 13, 8, 1, -12 }, // 0xd9 'LATIN SMALL LETTER U WITH GRAVE' U+00F9 + { 1560, 6, 13, 8, 1, -12 }, // 0xda 'LATIN SMALL LETTER U WITH ACUTE' U+00FA + { 1570, 6, 13, 8, 1, -12 }, // 0xdb 'LATIN SMALL LETTER U WITH CIRCUMFLEX' U+00FB + { 1580, 6, 12, 8, 1, -11 }, // 0xdc 'LATIN SMALL LETTER U WITH DIAERESIS' U+00FC + { 1589, 6, 15, 8, 1, -12 }, // 0xdd 'LATIN SMALL LETTER Y WITH ACUTE' U+00FD + { 1601, 6, 14, 8, 1, -11 }, // 0xde 'LATIN SMALL LETTER THORN' U+00FE + { 1612, 6, 14, 8, 1, -11 } }; // 0xdf 'LATIN SMALL LETTER Y WITH DIAERESIS' U+000FF + +const GFXfont Atari16px PROGMEM = { + (uint8_t *)Atari16pxBitmaps, + (GFXglyph *)Atari16pxGlyphs, + 0x20, 0xDF, 16 }; + +// Approx. 2974 bytes diff --git a/lib/obp60task/Create_new_pages.txt b/lib/obp60task/Create_new_pages.txt index 5ad71fd..b318985 100644 --- a/lib/obp60task/Create_new_pages.txt +++ b/lib/obp60task/Create_new_pages.txt @@ -2,5 +2,5 @@ Craete new page for OBP60 1. Create page under /lib/obp60task/PageXXXX.cpp 2. Set page name in PageXXXX.cpp on file name 3. Register new page in /lib/obp60task/obp60task.cpp line 242 (registerAllPages) -4. Add new page in /lib/obp60task/config.json for each page type or add new page to gen_set.pl and run it to auto-generate the relevant section of config.json +4. Add new page in /lib/obp60task/config.json for each page type or add new page to gen_set.py and run it to auto-generate the relevant section of config.json diff --git a/lib/obp60task/LedSpiTask.h b/lib/obp60task/LedSpiTask.h index 171281e..c058503 100644 --- a/lib/obp60task/LedSpiTask.h +++ b/lib/obp60task/LedSpiTask.h @@ -32,6 +32,7 @@ static Color COLOR_BLACK=Color(0,0,0); Color setBrightness(const Color &color,uint8_t brightness); +enum BacklightMode {OFF, ON, SUN, BUS, TIME, KEY}; class LedInterface { private: @@ -91,4 +92,4 @@ class LedTaskData{ //task function void createSpiLedTask(LedTaskData *param); -#endif \ No newline at end of file +#endif diff --git a/lib/obp60task/OBP60Extensions.cpp b/lib/obp60task/OBP60Extensions.cpp index f908f58..153ecbb 100644 --- a/lib/obp60task/OBP60Extensions.cpp +++ b/lib/obp60task/OBP60Extensions.cpp @@ -22,6 +22,7 @@ #include "DSEG7Classic-BoldItalic30pt7b.h" #include "DSEG7Classic-BoldItalic42pt7b.h" #include "DSEG7Classic-BoldItalic60pt7b.h" +#include "Atari16px8b.h" // Key label font // E-Ink Display #define GxEPD_WIDTH 400 // Display width @@ -130,6 +131,21 @@ Color colorMapping(const String &colorString){ return color; } +BacklightMode backlightMapping(const String &backlightString) { + static std::map const table = { + {"Off", BacklightMode::OFF}, + {"Control by Bus", BacklightMode::BUS}, + {"Control by Time", BacklightMode::TIME}, + {"Control by Key", BacklightMode::KEY}, + {"On", BacklightMode::ON}, + }; + auto it = table.find(backlightString); + if (it != table.end()) { + return it->second; + } + return BacklightMode::OFF; +} + // All defined colors see pixeltypes.h in FastLED lib void setBacklightLED(uint brightness, const Color &color){ if (ledTaskData == nullptr) return; @@ -271,15 +287,11 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa if(commonData.config->getBool(commonData.config->statusLine) == true){ - if(commonData.config->getString(commonData.config->displaycolor) == "Normal"){ - textcolor = GxEPD_BLACK; - } - else{ - textcolor = GxEPD_WHITE; - } + // Header separator line (optional) + // getdisplay().drawLine(0, 19, 399, 19, commonData.fgcolor); // Show status info - getdisplay().setTextColor(textcolor); + getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(0, 15); if(commonData.status.wifiApOn){ @@ -314,20 +326,22 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa usbRxOld = commonData.status.usbRx; usbTxOld = commonData.status.usbTx; + // Display key lock status + if (commonData.keylock) { + getdisplay().drawXBitmap(170, 1, lock_bits, icon_width, icon_height, commonData.fgcolor); + } else { + getdisplay().drawXBitmap(166, 1, swipe_bits, swipe_width, swipe_height, commonData.fgcolor); + } + // Heartbeat as dot - getdisplay().setTextColor(textcolor); + getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(205, 14); - if(heartbeat == true){ - getdisplay().print("."); - } - else{ - getdisplay().print(" "); - } + getdisplay().print(heartbeat ? "." : " "); heartbeat = !heartbeat; // Date and time - getdisplay().setTextColor(textcolor); + getdisplay().setTextColor(commonData.fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); getdisplay().setCursor(230, 15); // Show date and time if date present @@ -357,6 +371,59 @@ void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatVa } } +void displayFooter(CommonData &commonData) { + + getdisplay().setFont(&Atari16px); + getdisplay().setTextColor(commonData.fgcolor); + + // Frame around key icon area + if (! commonData.keylock) { + // horizontal elements + const uint16_t top = 280; + const uint16_t bottom = 299; + getdisplay().drawLine(commonData.keydata[0].x, top, commonData.keydata[0].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[1].x-10, top, commonData.keydata[1].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[2].x-10, top, commonData.keydata[2].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[4].x-10, top, commonData.keydata[4].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[5].x-10, top, commonData.keydata[5].x+10, top, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[5].x + commonData.keydata[5].w - 10, top, commonData.keydata[5].x + commonData.keydata[5].w + 1, top, commonData.fgcolor); + // vertical key separators + getdisplay().drawLine(commonData.keydata[0].x + commonData.keydata[0].w, top, commonData.keydata[0].x + commonData.keydata[0].w, bottom, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[1].x + commonData.keydata[1].w, top, commonData.keydata[1].x + commonData.keydata[1].w, bottom, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[3].x + commonData.keydata[3].w, top, commonData.keydata[3].x + commonData.keydata[3].w, bottom, commonData.fgcolor); + getdisplay().drawLine(commonData.keydata[4].x + commonData.keydata[4].w, top, commonData.keydata[4].x + commonData.keydata[4].w, bottom, commonData.fgcolor); + for (int i = 0; i < 6; i++) { + uint16_t x, y; + if (commonData.keydata[i].label.length() > 0) { + // check if icon is enabled + String icon_name = commonData.keydata[i].label.substring(1); + if (commonData.keydata[i].label[0] == '#') { + if (iconmap.find(icon_name) != iconmap.end()) { + x = commonData.keydata[i].x + (commonData.keydata[i].w - icon_width) / 2; + y = commonData.keydata[i].y + (commonData.keydata[i].h - icon_height) / 2; + getdisplay().drawXBitmap(x, y, iconmap[icon_name], icon_width, icon_height, commonData.fgcolor); + } else { + // icon is missing, use name instead + x = commonData.keydata[i].x + commonData.keydata[i].w / 2; + y = commonData.keydata[i].y + commonData.keydata[i].h / 2; + drawTextCenter(x, y, icon_name); + } + } else { + x = commonData.keydata[i].x + commonData.keydata[i].w / 2; + y = commonData.keydata[i].y + commonData.keydata[i].h / 2; + drawTextCenter(x, y, commonData.keydata[i].label); + } + } + } + // Current page number in a small box + getdisplay().drawRect(190, 280, 23, 19, commonData.fgcolor); + drawTextCenter(200, 289, String(commonData.data.actpage)); + } else { + getdisplay().setCursor(65, 295); + getdisplay().print("Press 1 and 6 fast to unlock keys"); + } +} + // Sunset und sunrise calculation SunData calcSunsetSunrise(GwApi *api, double time, double date, double latitude, double longitude, double timezone){ GwLog *logger=api->getLogger(); diff --git a/lib/obp60task/OBP60Extensions.h b/lib/obp60task/OBP60Extensions.h index fcb1f29..a529da7 100644 --- a/lib/obp60task/OBP60Extensions.h +++ b/lib/obp60task/OBP60Extensions.h @@ -9,6 +9,8 @@ // FRAM address reservations 32kB: 0x0000 - 0x7FFF // 0x0000 - 0x03ff: single variables +#define FRAM_PAGE_NO 0x0002 +// Voltage page #define FRAM_VOLTAGE_AVG 0x000A #define FRAM_VOLTAGE_TREND 0x000B #define FRAM_VOLTAGE_MODE 0x000C @@ -22,7 +24,7 @@ extern Adafruit_FRAM_I2C fram; extern bool hasFRAM; -// Fonts declarations for display (#inclues see OBP60Extensions.cpp) +// Fonts declarations for display (#includes see OBP60Extensions.cpp) extern const GFXfont Ubuntu_Bold8pt7b; extern const GFXfont Ubuntu_Bold10pt7b; extern const GFXfont Ubuntu_Bold12pt7b; @@ -35,7 +37,7 @@ extern const GFXfont DSEG7Classic_BoldItalic30pt7b; extern const GFXfont DSEG7Classic_BoldItalic42pt7b; extern const GFXfont DSEG7Classic_BoldItalic60pt7b; -// Gloabl functions +// Global functions #ifdef DISPLAY_GDEW042T2 GxEPD2_BW & getdisplay(); #endif @@ -69,6 +71,7 @@ void togglePortPin(uint pin); // Toggle extension port pin Color colorMapping(const String &colorString); // Color mapping string to CHSV colors void setBacklightLED(uint brightness, const Color &color);// Set backlight LEDs void toggleBacklightLED(uint brightness,const Color &color);// Toggle backlight LEDs +BacklightMode backlightMapping(const String &backlightString);// Configuration string to value void setFlashLED(bool status); // Set flash LED void blinkingFlashLED(); // Blinking function for flash LED @@ -86,6 +89,7 @@ void displayTrendHigh(int16_t x, int16_t y, uint16_t size, uint16_t color); void displayTrendLow(int16_t x, int16_t y, uint16_t size, uint16_t color); void displayHeader(CommonData &commonData, GwApi::BoatValue *date, GwApi::BoatValue *time, GwApi::BoatValue *hdop); // Draw display header +void displayFooter(CommonData &commonData); SunData calcSunsetSunrise(GwApi *api, double time, double date, double latitude, double longitude, double timezone); // Calulate sunset and sunrise @@ -96,11 +100,82 @@ void startLedTask(GwApi *api); void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUMBER], AsyncWebServerRequest *request); -#define fram_width 16 -#define fram_height 16 -static unsigned char fram_bits[] = { +// Icons +#define icon_width 16 +#define icon_height 16 + +static unsigned char left_bits[] PROGMEM = { + 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0xf8, 0x01, 0xfc, 0x7f, + 0xfe, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, 0xf8, 0x01, + 0xf0, 0x01, 0xe0, 0x01, 0xc0, 0x01, 0x00, 0x00 }; + +static unsigned char right_bits[] PROGMEM = { + 0x00, 0x00, 0x80, 0x03, 0x80, 0x07, 0x80, 0x0f, 0x80, 0x1f, 0xfe, 0x3f, + 0xfe, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x3f, 0x80, 0x1f, + 0x80, 0x0f, 0x80, 0x07, 0x80, 0x03, 0x00, 0x00 }; + +static unsigned char lock_bits[] PROGMEM = { + 0xc0, 0x03, 0x60, 0x06, 0x30, 0x0c, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, + 0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, + 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f }; + +static unsigned char plus_bits[] PROGMEM = { + 0x00, 0x00, 0xe0, 0x01, 0x18, 0x06, 0x04, 0x08, 0xc4, 0x08, 0xc2, 0x10, + 0xf2, 0x13, 0xf2, 0x13, 0xc2, 0x10, 0xc4, 0x08, 0x04, 0x0c, 0x18, 0x1e, + 0xe0, 0x39, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0 }; + +static unsigned char minus_bits[] PROGMEM = { + 0x00, 0x00, 0xe0, 0x01, 0x18, 0x06, 0x04, 0x08, 0x04, 0x08, 0x02, 0x10, + 0xf2, 0x13, 0xf2, 0x13, 0x02, 0x10, 0x04, 0x08, 0x04, 0x0c, 0x18, 0x1e, + 0xe0, 0x39, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0 }; + +static unsigned char fram_bits[] PROGMEM = { 0xf8, 0x1f, 0xff, 0xff, 0x9f, 0xff, 0x98, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f }; +static unsigned char ap_bits[] = { + 0xe0, 0x03, 0x18, 0x0c, 0x04, 0x10, 0xc2, 0x21, 0x30, 0x06, 0x08, 0x08, + 0xc0, 0x01, 0x20, 0x02, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, + 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00 }; + +static unsigned char dish_bits[] PROGMEM= { + 0x3c, 0x00, 0x42, 0x18, 0xfa, 0x1b, 0x02, 0x04, 0x02, 0x0a, 0x02, 0x09, + 0x82, 0x08, 0x06, 0x0a, 0x0e, 0x1b, 0x9c, 0x2b, 0x38, 0x2b, 0x74, 0x20, + 0xec, 0x1f, 0x1c, 0x00, 0xf4, 0x00, 0xfe, 0x03 }; + +static std::map iconmap = { + {"LEFT", left_bits}, + {"RIGHT", right_bits}, + {"LOCK", lock_bits}, + {"PLUS", plus_bits}, + {"MINUS", minus_bits}, + {"DISH", dish_bits}, + {"AP", ap_bits} +}; + +// Other symbols +#define swipe_width 24 +#define swipe_height 16 +static unsigned char swipe_bits[] PROGMEM = { + 0x00, 0x06, 0x00, 0x24, 0x09, 0x24, 0x12, 0x09, 0x48, 0x7f, 0x09, 0xfe, + 0x12, 0xb9, 0x48, 0x24, 0xc9, 0x25, 0x40, 0x49, 0x02, 0xa0, 0x49, 0x06, + 0x20, 0x01, 0x0a, 0x20, 0x00, 0x08, 0x40, 0x00, 0x08, 0x40, 0x00, 0x08, + 0x80, 0x00, 0x04, 0x00, 0x01, 0x04, 0x00, 0x02, 0x02, 0x00, 0xfc, 0x01 }; + +#define exclamation_width 32 +#define exclamation_height 32 +static unsigned char exclamation_bits[] PROGMEM = { + 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0xb0, 0x0d, 0x00, + 0x00, 0xd8, 0x1b, 0x00, 0x00, 0xec, 0x37, 0x00, 0x00, 0xf6, 0x6f, 0x00, + 0x00, 0x3b, 0xdc, 0x00, 0x80, 0x3d, 0xbc, 0x01, 0xc0, 0x3e, 0x7c, 0x03, + 0x60, 0x3f, 0xfc, 0x06, 0xb0, 0x3f, 0xfc, 0x0d, 0xd8, 0x3f, 0xfc, 0x1b, + 0xec, 0x3f, 0xfc, 0x37, 0xf6, 0x3f, 0xfc, 0x6f, 0xfb, 0x3f, 0xfc, 0xdf, + 0xfd, 0x3f, 0xfc, 0xbf, 0xfd, 0x3f, 0xfc, 0xbf, 0xfb, 0x3f, 0xfc, 0xdf, + 0xf6, 0x3f, 0xfc, 0x6f, 0xec, 0x3f, 0xfc, 0x37, 0xd8, 0xff, 0xff, 0x1b, + 0xb0, 0xff, 0xff, 0x0d, 0x60, 0x3f, 0xfc, 0x06, 0xc0, 0x3e, 0x7c, 0x03, + 0x80, 0x3d, 0xbc, 0x01, 0x00, 0x3b, 0xdc, 0x00, 0x00, 0xf6, 0x6f, 0x00, + 0x00, 0xec, 0x37, 0x00, 0x00, 0xd8, 0x1b, 0x00, 0x00, 0xb0, 0x0d, 0x00, + 0x00, 0x60, 0x06, 0x00, 0x00, 0xc0, 0x03, 0x00 }; + #endif diff --git a/lib/obp60task/OBP60Keypad.h b/lib/obp60task/OBP60Keypad.h index 9a69089..65ceed8 100644 --- a/lib/obp60task/OBP60Keypad.h +++ b/lib/obp60task/OBP60Keypad.h @@ -20,6 +20,44 @@ int keydelay = 250; // Delay after key pressed in [ms] bool keylock = false; // Key lock after pressed key is valid (repeat protection by conginous pressing) long starttime = 0; // Start time point for pressed key +void initKeys(CommonData &commonData) { + // coordinates for virtual keyboard keys + + static uint16_t top = 281; + static uint16_t width = 65; + static uint16_t height = 18; + + commonData.keydata[0].x = 0; + commonData.keydata[0].y = top; + commonData.keydata[0].w = width + 1; + commonData.keydata[0].h = height; + + commonData.keydata[1].x = commonData.keydata[0].x + commonData.keydata[0].w + 1; + commonData.keydata[1].y = top; + commonData.keydata[1].w = width; + commonData.keydata[1].h = height; + + commonData.keydata[2].x = commonData.keydata[1].x + commonData.keydata[1].w + 1; + commonData.keydata[2].y = top; + commonData.keydata[2].w = width; + commonData.keydata[2].h = height; + + commonData.keydata[3].x = commonData.keydata[2].x + commonData.keydata[2].w + 1; + commonData.keydata[3].y = top; + commonData.keydata[3].w = width; + commonData.keydata[3].h = height; + + commonData.keydata[4].x = commonData.keydata[3].x + commonData.keydata[3].w + 1; + commonData.keydata[4].y = top; + commonData.keydata[4].w = width; + commonData.keydata[4].h = height; + + commonData.keydata[5].x = commonData.keydata[4].x + commonData.keydata[4].w + 1; + commonData.keydata[5].y = top; + commonData.keydata[5].w = width; + commonData.keydata[5].h = height; +} + #ifdef HARDWARE_V21 // Keypad functions for original OBP60 hardware int readKeypad(uint thSensitivity) { diff --git a/lib/obp60task/PageBME280.cpp b/lib/obp60task/PageBME280.cpp index d7893d2..f0f02c0 100644 --- a/lib/obp60task/PageBME280.cpp +++ b/lib/obp60task/PageBME280.cpp @@ -5,24 +5,24 @@ class PageBME280 : public Page { - bool keylock = false; // Keylock - public: PageBME280(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageBME280"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageBME280"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; double value1 = 0; double value2 = 0; @@ -42,7 +42,7 @@ class PageBME280 : public Page String name1 = "Temp"; // Value name name1 = name1.substring(0, 6); // String length limit for value name if(simulation == false){ - value1 = commonData.data.airTemperature; // Value as double in SI unit + value1 = commonData->data.airTemperature; // Value as double in SI unit } else{ value1 = 23.0 + float(random(0, 10)) / 10.0; @@ -60,7 +60,7 @@ class PageBME280 : public Page String name2 = "Humid"; // Value name name2 = name2.substring(0, 6); // String length limit for value name if(simulation == false){ - value2 = commonData.data.airHumidity; // Value as double in SI unit + value2 = commonData->data.airHumidity; // Value as double in SI unit } else{ value2 = 43 + float(random(0, 4)); @@ -78,7 +78,7 @@ class PageBME280 : public Page String name3 = "Press"; // Value name name3 = name3.substring(0, 6); // String length limit for value name if(simulation == false){ - value3 = commonData.data.airPressure; // Value as double in SI unit + value3 = commonData->data.airPressure; // Value as double in SI unit } else{ value3 = 1006 + float(random(0, 5)); @@ -107,7 +107,7 @@ class PageBME280 : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -131,7 +131,7 @@ class PageBME280 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -155,7 +155,7 @@ class PageBME280 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -176,23 +176,6 @@ class PageBME280 : public Page // Show bus data getdisplay().print(svalue3); // Real value as formated string - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageBattery.cpp b/lib/obp60task/PageBattery.cpp index 6322981..bbde098 100644 --- a/lib/obp60task/PageBattery.cpp +++ b/lib/obp60task/PageBattery.cpp @@ -5,12 +5,17 @@ class PageBattery : public Page { - bool keylock = false; // Keylock int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s public: PageBattery(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageBattery"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery"); + } + + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "AVG"; } virtual int handleKey(int key){ @@ -23,15 +28,15 @@ class PageBattery : public Page // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function double value1 = 0; @@ -58,19 +63,19 @@ class PageBattery : public Page // Switch average values switch (average) { case 0: - value1 = commonData.data.batteryVoltage; // Live data + value1 = commonData->data.batteryVoltage; // Live data break; case 1: - value1 = commonData.data.batteryVoltage10; // Average 10s + value1 = commonData->data.batteryVoltage10; // Average 10s break; case 2: - value1 = commonData.data.batteryVoltage60; // Average 60s + value1 = commonData->data.batteryVoltage60; // Average 60s break; case 3: - value1 = commonData.data.batteryVoltage300; // Average 300s + value1 = commonData->data.batteryVoltage300; // Average 300s break; default: - value1 = commonData.data.batteryVoltage; // Default + value1 = commonData->data.batteryVoltage; // Default break; } } @@ -87,19 +92,19 @@ class PageBattery : public Page if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){ switch (average) { case 0: - value2 = commonData.data.batteryCurrent; // Live data + value2 = commonData->data.batteryCurrent; // Live data break; case 1: - value2 = commonData.data.batteryCurrent10; // Average 10s + value2 = commonData->data.batteryCurrent10; // Average 10s break; case 2: - value2 = commonData.data.batteryCurrent60; // Average 60s + value2 = commonData->data.batteryCurrent60; // Average 60s break; case 3: - value2 = commonData.data.batteryCurrent300; // Average 300s + value2 = commonData->data.batteryCurrent300; // Average 300s break; default: - value2 = commonData.data.batteryCurrent; // Default + value2 = commonData->data.batteryCurrent; // Default break; } } @@ -116,19 +121,19 @@ class PageBattery : public Page if(String(powsensor1) == "INA219" || String(powsensor1) == "INA226"){ switch (average) { case 0: - value3 = commonData.data.batteryPower; // Live data + value3 = commonData->data.batteryPower; // Live data break; case 1: - value3 = commonData.data.batteryPower10; // Average 10s + value3 = commonData->data.batteryPower10; // Average 10s break; case 2: - value3 = commonData.data.batteryPower60; // Average 60s + value3 = commonData->data.batteryPower60; // Average 60s break; case 3: - value3 = commonData.data.batteryPower300; // Average 300s + value3 = commonData->data.batteryPower300; // Average 300s break; default: - value3 = commonData.data.batteryPower; // Default + value3 = commonData->data.batteryPower; // Default break; } } @@ -156,7 +161,7 @@ class PageBattery : public Page getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update // Show average settings - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold8pt7b); switch (average) { case 0: @@ -228,7 +233,7 @@ class PageBattery : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -257,7 +262,7 @@ class PageBattery : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -283,26 +288,6 @@ class PageBattery : public Page getdisplay().print("---"); // No sensor data (sensor is off) } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageBattery2.cpp b/lib/obp60task/PageBattery2.cpp index 8c3bd44..b8694a7 100644 --- a/lib/obp60task/PageBattery2.cpp +++ b/lib/obp60task/PageBattery2.cpp @@ -7,15 +7,21 @@ class PageBattery2 : public Page { bool init = false; // Marker for init done -bool keylock = false; // Keylock int average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s bool trend = true; // Trend indicator [0|1], 0=off, 1=on double raw = 0; public: PageBattery2(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageBattery2"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageBattery2"); } + + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "AVG"; + } + virtual int handleKey(int key){ // Change average if(key == 1){ @@ -32,16 +38,16 @@ public: // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Polynominal coefficients second order for battery energy level calculation // index 0 = Pb, 1 = Gel, 2 = AGM, 3 = LiFePo4 @@ -71,42 +77,42 @@ public: // Create trend value if(init == false){ // Load start values for first page run - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; init = true; } else{ // Reading trend value - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; } // Get raw value for trend indicator - raw = commonData.data.batteryVoltage; // Live data + raw = commonData->data.batteryVoltage; // Live data // Switch average values switch (average) { case 0: - value1 = commonData.data.batteryVoltage; // Live data - value2 = commonData.data.batteryCurrent; - value3 = commonData.data.batteryPower; + value1 = commonData->data.batteryVoltage; // Live data + value2 = commonData->data.batteryCurrent; + value3 = commonData->data.batteryPower; break; case 1: - value1 = commonData.data.batteryVoltage10; // Average 10s - value2 = commonData.data.batteryCurrent10; - value3 = commonData.data.batteryPower10; + value1 = commonData->data.batteryVoltage10; // Average 10s + value2 = commonData->data.batteryCurrent10; + value3 = commonData->data.batteryPower10; break; case 2: - value1 = commonData.data.batteryVoltage60; // Average 60s - value2 = commonData.data.batteryCurrent60; - value3 = commonData.data.batteryPower60; + value1 = commonData->data.batteryVoltage60; // Average 60s + value2 = commonData->data.batteryCurrent60; + value3 = commonData->data.batteryPower60; break; case 3: - value1 = commonData.data.batteryVoltage300; // Average 300s - value2 = commonData.data.batteryCurrent300; - value3 = commonData.data.batteryPower300; + value1 = commonData->data.batteryVoltage300; // Average 300s + value2 = commonData->data.batteryCurrent300; + value3 = commonData->data.batteryPower300; break; default: - value1 = commonData.data.batteryVoltage; // Default - value2 = commonData.data.batteryCurrent; - value3 = commonData.data.batteryPower; + value1 = commonData->data.batteryVoltage; // Default + value2 = commonData->data.batteryCurrent; + value3 = commonData->data.batteryPower; break; } bool valid1 = true; @@ -180,7 +186,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show name getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -219,7 +225,7 @@ public: getdisplay().print("Battery Type"); // Show battery with fill level - batteryGraphic(150, 45, batPercentage, commonData.fgcolor, commonData.bgcolor); + batteryGraphic(150, 45, batPercentage, commonData->fgcolor, commonData->bgcolor); // Show average settings getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -328,23 +334,6 @@ public: getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("W"); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageClock.cpp b/lib/obp60task/PageClock.cpp index c93949b..3442797 100644 --- a/lib/obp60task/PageClock.cpp +++ b/lib/obp60task/PageClock.cpp @@ -5,27 +5,26 @@ class PageClock : public Page { -bool keylock = false; // Keylock - public: PageClock(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageClock"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageClock"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -61,8 +60,8 @@ public: value1 = 38160; // Simulation data for time value 11:36 in seconds } // Other simulation data see OBP60Formater.cpp bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value if(valid1 == true){ svalue1old = svalue1; // Save old value unit1old = unit1; // Save old unit @@ -74,8 +73,8 @@ public: name2 = name2.substring(0, 6); // String length limit for value name value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value if(valid2 == true){ svalue2old = svalue2; // Save old value unit2old = unit2; // Save old unit @@ -87,8 +86,8 @@ public: name3 = name3.substring(0, 6); // String length limit for value name value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value if(valid3 == true){ svalue3old = svalue3; // Save old value unit3old = unit3; // Save old unit @@ -110,7 +109,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values GPS date getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -122,7 +121,7 @@ public: getdisplay().print("Date"); // Name // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values GPS time getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -136,7 +135,7 @@ public: // Show values sunrise String sunrise = "---"; if(valid1 == true && valid2 == true && valid3 == true){ - sunrise = String(commonData.sundata.sunriseHour) + ":" + String(commonData.sundata.sunriseMinute + 100).substring(1); + sunrise = String(commonData->sundata.sunriseHour) + ":" + String(commonData->sundata.sunriseMinute + 100).substring(1); svalue5old = sunrise; } @@ -149,12 +148,12 @@ public: getdisplay().print("SunR"); // Name // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values sunset String sunset = "---"; if(valid1 == true && valid2 == true && valid3 == true){ - sunset = String(commonData.sundata.sunsetHour) + ":" + String(commonData.sundata.sunsetMinute + 100).substring(1); + sunset = String(commonData->sundata.sunsetHour) + ":" + String(commonData->sundata.sunsetMinute + 100).substring(1); svalue6old = sunset; } @@ -172,8 +171,8 @@ public: int rInstrument = 110; // Radius of clock float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle for(int i=0; i<360; i=i+1) { @@ -214,7 +213,7 @@ public: if(i % 6 == 0){ float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); sinx=sin(i/180.0*pi); cosx=cos(i/180.0*pi); } @@ -228,10 +227,10 @@ public: float yy2 = -(rInstrument+10); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), - 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -270,7 +269,7 @@ public: float yy2 = -(rInstrument * 0.5); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -280,7 +279,7 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Draw minute pointer @@ -296,7 +295,7 @@ public: float yy2 = -(rInstrument - 15); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -306,28 +305,12 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); - -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageDST810.cpp b/lib/obp60task/PageDST810.cpp index 89f6e7b..0da67ff 100644 --- a/lib/obp60task/PageDST810.cpp +++ b/lib/obp60task/PageDST810.cpp @@ -5,24 +5,24 @@ class PageDST810 : public Page { - bool keylock = false; // Keylock - - public: +public: PageDST810(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageDST810"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageDST810"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -47,8 +47,8 @@ class PageDST810 : public Page name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -56,8 +56,8 @@ class PageDST810 : public Page name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -65,8 +65,8 @@ class PageDST810 : public Page name3 = name3.substring(0, 6); // String length limit for value name double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value // Get boat values #4 GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) @@ -74,8 +74,8 @@ class PageDST810 : public Page name4 = name4.substring(0, 6); // String length limit for value name double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information - String svalue4 = formatValue(bvalue4, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit4 = formatValue(bvalue4, commonData).unit; // Unit of value + String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -93,7 +93,7 @@ class PageDST810 : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -131,7 +131,7 @@ class PageDST810 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -169,7 +169,7 @@ class PageDST810 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -207,7 +207,7 @@ class PageDST810 : public Page // ############### Vertical Line ################ // Vertical line 3 pix - getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor); + getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); // ############### Value 4 ################ @@ -242,24 +242,6 @@ class PageDST810 : public Page unit4old = unit4; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFluid.cpp b/lib/obp60task/PageFluid.cpp index c01e83b..4c121da 100644 --- a/lib/obp60task/PageFluid.cpp +++ b/lib/obp60task/PageFluid.cpp @@ -57,33 +57,42 @@ static unsigned char gasoline_bits[] = { 0x98, 0xcf, 0x38, 0xe7, 0x78, 0xf0, 0xf8, 0xfa, 0xf8, 0xfa, 0x78, 0xf0, 0x38, 0xe7, 0x98, 0xcf, 0xf8, 0xff, 0xf0, 0x7f }; -class PageFluid : public Page{ - bool keylock = false; // Keylock +#define fish_width 16 +#define fish_height 16 +static unsigned char fish_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x37, + 0xfc, 0x7f, 0xfc, 0x7f, 0xec, 0x3f, 0xfc, 0x7f, 0xfc, 0x7f, 0xf8, 0x37, + 0xf0, 0x03, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00 }; + +class PageFluid : public Page +{ bool holdvalues = false; int fluidtype; public: PageFluid(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageFluid"); holdvalues = common.config->getBool(common.config->holdvalues); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayNew(CommonData &commonData, PageData &pageData){ - fluidtype = commonData.config->getInt("page" + String(pageData.pageNumber) + "fluid", 0); - commonData.logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype); + virtual void displayNew(PageData &pageData){ + fluidtype = commonData->config->getInt("page" + String(pageData.pageNumber) + "fluid", 0); + commonData->logger->logDebug(GwLog::LOG,"New PageFluid: fluidtype=%d", fluidtype); } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static double value1old; @@ -113,7 +122,7 @@ class PageFluid : public Page{ // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // descriptions getdisplay().setFont(&Ubuntu_Bold12pt7b); @@ -131,11 +140,11 @@ class PageFluid : public Page{ uint8_t r = 110; // circular frame - getdisplay().drawCircle(c.x, c.y, r+5, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, r+2, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, r-1, commonData.bgcolor); + getdisplay().drawCircle(c.x, c.y, r+5, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, r+2, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, r-1, commonData->bgcolor); // center of pointer as dot - getdisplay().fillCircle(c.x, c.y, 8, commonData.fgcolor); + getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); // value down centered char buffer[6]; @@ -149,19 +158,25 @@ class PageFluid : public Page{ // draw symbol (as bitmap) switch (fluidtype) { case 0: - getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, fuel_bits, fuel_width, fuel_height, commonData->fgcolor); break; case 1: - getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, water_bits, water_width, water_height, commonData->fgcolor); + break; + case 2: // gray water no symbol yet + // getdisplay().drawXBitmap(c.x-8, c.y-50, gray_bits, gray_width, gray_height, commonData->fgcolor); + break; + case 3: + getdisplay().drawXBitmap(c.x-8, c.y-50, fish_bits, fish_width, fish_height, commonData->fgcolor); break; case 4: - getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, oil_bits, oil_width, oil_height, commonData->fgcolor); break; case 5: - getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, waste_bits, waste_width, waste_height, commonData->fgcolor); break; case 6: - getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData.fgcolor); + getdisplay().drawXBitmap(c.x-8, c.y-50, gasoline_bits, gasoline_width, gasoline_height, commonData->fgcolor); break; } @@ -190,11 +205,11 @@ class PageFluid : public Page{ {c.x + 2, c.y - (r - 16)}, {c.x - 2, c.y - (r - 16)} }; - fillPoly4(rotatePoints(c, pts, -120), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, -60), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, 0), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, 60), commonData.fgcolor); - fillPoly4(rotatePoints(c, pts, 120), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, -120), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, -60), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, 0), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, 60), commonData->fgcolor); + fillPoly4(rotatePoints(c, pts, 120), commonData->fgcolor); // dots // rotate 0 to 360 in 12 degree steps @@ -203,7 +218,7 @@ class PageFluid : public Page{ continue; } p = rotatePoint(c, {c.x, c.y - r + 10}, angle); - getdisplay().fillCircle(p.x, p.y, 3, commonData.fgcolor); + getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); } // pointer @@ -214,26 +229,11 @@ class PageFluid : public Page{ {c.x + 6, c.y + 15}, {c.x - 6, c.y + 15} }; - fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, -120 + bvalue1->value * 2.4), commonData->fgcolor); // Pointer axis is white - getdisplay().fillCircle(c.x, c.y, 6, commonData.bgcolor); + getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 296); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 296); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 296); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFourValues.cpp b/lib/obp60task/PageFourValues.cpp index 1bad689..73329e4 100644 --- a/lib/obp60task/PageFourValues.cpp +++ b/lib/obp60task/PageFourValues.cpp @@ -5,24 +5,24 @@ class PageFourValues : public Page { - bool keylock = false; // Keylock - public: PageFourValues(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageFourValues"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -47,8 +47,8 @@ class PageFourValues : public Page name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -56,8 +56,8 @@ class PageFourValues : public Page name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -65,8 +65,8 @@ class PageFourValues : public Page name3 = name3.substring(0, 6); // String length limit for value name double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value // Get boat values #4 GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) @@ -74,8 +74,8 @@ class PageFourValues : public Page name4 = name4.substring(0, 6); // String length limit for value name double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information - String svalue4 = formatValue(bvalue4, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit4 = formatValue(bvalue4, commonData).unit; // Unit of value + String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -93,7 +93,7 @@ class PageFourValues : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -141,7 +141,7 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 80, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 80, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -189,7 +189,7 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 146, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 146, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -237,7 +237,7 @@ class PageFourValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 214, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 214, 400, 3, commonData->fgcolor); // ############### Value 4 ################ @@ -282,24 +282,6 @@ class PageFourValues : public Page unit4old = unit4; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageFourValues2.cpp b/lib/obp60task/PageFourValues2.cpp index c7f5a1a..6ac5981 100644 --- a/lib/obp60task/PageFourValues2.cpp +++ b/lib/obp60task/PageFourValues2.cpp @@ -5,24 +5,24 @@ class PageFourValues2 : public Page { - bool keylock = false; // Keylock - public: PageFourValues2(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageFourValues2"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageFourValues2"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; // Toggle keylock return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -47,8 +47,8 @@ class PageFourValues2 : public Page name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -56,8 +56,8 @@ class PageFourValues2 : public Page name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -65,8 +65,8 @@ class PageFourValues2 : public Page name3 = name3.substring(0, 6); // String length limit for value name double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value // Get boat values #4 GwApi::BoatValue *bvalue4 = pageData.values[3]; // Second element in list (only one value by PageOneValue) @@ -74,8 +74,8 @@ class PageFourValues2 : public Page name4 = name4.substring(0, 6); // String length limit for value name double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information - String svalue4 = formatValue(bvalue4, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit4 = formatValue(bvalue4, commonData).unit; // Unit of value + String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -93,7 +93,7 @@ class PageFourValues2 : public Page // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // ############### Value 1 ################ @@ -141,7 +141,7 @@ class PageFourValues2 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -189,7 +189,7 @@ class PageFourValues2 : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -237,7 +237,7 @@ class PageFourValues2 : public Page // ############### Vertical Line ################ // Vertical line 3 pix - getdisplay().fillRect(200, 195, 3, 75, commonData.fgcolor); + getdisplay().fillRect(200, 195, 3, 75, commonData->fgcolor); // ############### Value 4 ################ @@ -282,24 +282,6 @@ class PageFourValues2 : public Page unit4old = unit4; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageGenerator.cpp b/lib/obp60task/PageGenerator.cpp index aa8ac8d..20e7652 100644 --- a/lib/obp60task/PageGenerator.cpp +++ b/lib/obp60task/PageGenerator.cpp @@ -6,26 +6,24 @@ class PageGenerator : public Page { -bool init = false; // Marker for init done -bool keylock = false; // Keylock - public: PageGenerator(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageGenerator"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageGenerator"); } virtual int handleKey(int key){ // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data bool simulation = config->getBool(config->useSimuData); @@ -47,13 +45,13 @@ public: // Get raw value for trend indicator if(powerSensor != "off"){ - value1 = commonData.data.generatorVoltage; // Use voltage from external sensor + value1 = commonData->data.generatorVoltage; // Use voltage from external sensor } else{ - value1 = commonData.data.batteryVoltage; // Use internal voltage sensor + value1 = commonData->data.batteryVoltage; // Use internal voltage sensor } - value2 = commonData.data.generatorCurrent; - value3 = commonData.data.generatorPower; + value2 = commonData->data.generatorCurrent; + value3 = commonData->data.generatorPower; genPercentage = value3 * 100 / (double)genPower; // Load value // Limits for battery level if(genPercentage < 0) genPercentage = 0; @@ -87,7 +85,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show name getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -124,7 +122,7 @@ public: getdisplay().print("Power Modul"); // Show generator - generatorGraphic(200, 95, commonData.fgcolor, commonData.bgcolor); + generatorGraphic(200, 95, commonData->fgcolor, commonData->bgcolor); // Show load level in percent getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -205,21 +203,6 @@ public: getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("W"); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageKeelPosition.cpp b/lib/obp60task/PageKeelPosition.cpp index 1d02c3e..f3eac49 100644 --- a/lib/obp60task/PageKeelPosition.cpp +++ b/lib/obp60task/PageKeelPosition.cpp @@ -5,27 +5,26 @@ class PageKeelPosition : public Page { -bool keylock = false; // Keylock - public: PageKeelPosition(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageKeelPosition"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageKeelPosition"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; double value1 = 0; double value1old = 0; @@ -40,9 +39,9 @@ public: String rotfunction = config->getString(config->rotFunction); // Get boat values for Keel position - bool valid1 = commonData.data.validRotAngle; // Valid information + bool valid1 = commonData->data.validRotAngle; // Valid information if(simulation == false && rotsensor == "AS5600" && rotfunction == "Keel"){ - value1 = commonData.data.rotationAngle; // Raw value without unit convertion + value1 = commonData->data.rotationAngle; // Raw value without unit convertion } else{ value1 = 0; @@ -77,9 +76,9 @@ public: int rInstrument = 110; // Radius of KeelPosition float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle for(int i=90; i<=270; i=i+10) { @@ -117,7 +116,7 @@ public: // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -130,10 +129,10 @@ public: float yy2 = -(rInstrument+10); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), - 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -167,7 +166,7 @@ public: float yy2 = -(rInstrument * 0.6); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -177,17 +176,17 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); // Draw counterweight - getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor); + getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 140, startwidth + 22, commonData.bgcolor); - getdisplay().fillCircle(200, 140, startwidth + 20, commonData.fgcolor); // Boat circle - getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData.bgcolor); // Delete half top of boat circle - getdisplay().fillRect(150, 150, 100, 4, commonData.fgcolor); // Water line + getdisplay().fillCircle(200, 140, startwidth + 22, commonData->bgcolor); + getdisplay().fillCircle(200, 140, startwidth + 20, commonData->fgcolor); // Boat circle + getdisplay().fillRect(200 - 30, 140 - 30, 2 * 30, 30, commonData->bgcolor); // Delete half top of boat circle + getdisplay().fillRect(150, 150, 100, 4, commonData->fgcolor); // Water line // Print label getdisplay().setFont(&Ubuntu_Bold16pt7b); @@ -207,22 +206,6 @@ public: getdisplay().print("No sensor data"); // Info missing sensor } -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageOneValue.cpp b/lib/obp60task/PageOneValue.cpp index 708c611..84aff6d 100644 --- a/lib/obp60task/PageOneValue.cpp +++ b/lib/obp60task/PageOneValue.cpp @@ -3,25 +3,26 @@ #include "Pagedata.h" #include "OBP60Extensions.h" -class PageOneValue : public Page{ - bool keylock = false; // Keylock - +class PageOneValue : public Page +{ public: PageOneValue(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageOneValue"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageOneValue"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -40,8 +41,8 @@ class PageOneValue : public Page{ name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -60,7 +61,7 @@ class PageOneValue : public Page{ getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(20, 100); getdisplay().print(name1); // Page name @@ -101,21 +102,6 @@ class PageOneValue : public Page{ unit1old = unit1; // Save the old unit } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 40ba9f5..320e43f 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -5,27 +5,25 @@ class PageRollPitch : public Page { -bool keylock = false; // Keylock - public: PageRollPitch(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageRollPitch"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageRollPitch"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; double value1 = 0; double value2 = 0; @@ -120,7 +118,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show roll limit getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -136,7 +134,7 @@ public: getdisplay().print("DEG"); // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show roll value getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -151,7 +149,7 @@ public: getdisplay().print("Deg"); // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show pitch value getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -171,8 +169,8 @@ public: int rInstrument = 100; // Radius of instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle for(int i=0; i<360; i=i+10) { @@ -207,7 +205,7 @@ public: // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -220,10 +218,10 @@ public: float yy2 = -(rInstrument+10); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), - 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } } @@ -244,7 +242,7 @@ public: float yy2 = -(rInstrument * 0.7); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -254,26 +252,26 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); // Draw counterweight - getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData.fgcolor); + getdisplay().fillCircle(200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2), 5, commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 22, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 20, commonData.fgcolor); // Boat circle + getdisplay().fillCircle(200, 150, startwidth + 22, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 20, commonData->fgcolor); // Boat circle int x0 = 200; int y0 = 150; int x1 = x0 + 50*cos(value1); int y1 = y0 + 50*sin(value1); int x2 = x0 + 50*cos(value1 - pi/2); int y2 = y0 + 50*sin(value1 - pi/2); - getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (right triangle) + getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (right triangle) x1 = x0 + 50*cos(value1 + pi); y1 = y0 + 50*sin(value1 + pi); - getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData.bgcolor); // Clear half top side of boat circle (left triangle) - getdisplay().fillRect(150, 160, 100, 4, commonData.fgcolor); // Water line + getdisplay().fillTriangle(x0, y0, x1, y1, x2, y2, commonData->bgcolor); // Clear half top side of boat circle (left triangle) + getdisplay().fillRect(150, 160, 100, 4, commonData->fgcolor); // Water line // Draw roll pointer startwidth = 4; // Start width of pointer @@ -288,7 +286,7 @@ public: float yy2 = -(rInstrument - 15); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -298,7 +296,7 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } else{ // Print sensor info @@ -307,22 +305,6 @@ public: getdisplay().print("No sensor data"); // Info missing sensor } -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageRudderPosition.cpp b/lib/obp60task/PageRudderPosition.cpp index 5f88f0e..6ed0d4c 100644 --- a/lib/obp60task/PageRudderPosition.cpp +++ b/lib/obp60task/PageRudderPosition.cpp @@ -5,27 +5,25 @@ class PageRudderPosition : public Page { -bool keylock = false; // Keylock - public: PageRudderPosition(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Show PageRudderPosition"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String unit1old = ""; double value1 = 0.1; @@ -44,8 +42,8 @@ public: name1 = name1.substring(0, 6); // String length limit for value name value1 = bvalue1->value; // Raw value without unit convertion bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value if(valid1 == true){ value1old = value1; // Save old value unit1old = unit1; // Save old unit @@ -82,9 +80,9 @@ public: int rInstrument = 110; // Radius of RudderPosition float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillRect(0, 30, 400, 122, commonData.bgcolor); // Delete half top circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillRect(0, 30, 400, 122, commonData->bgcolor); // Delete half top circle for(int i=90; i<=270; i=i+10) { @@ -122,7 +120,7 @@ public: // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -135,10 +133,10 @@ public: float yy2 = -(rInstrument+10); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), - 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -190,7 +188,7 @@ public: float yy2 = -(rInstrument * 0.5); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -200,28 +198,12 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); - -//******************************************************************************************* - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageSolar.cpp b/lib/obp60task/PageSolar.cpp index d3b1acd..646a568 100644 --- a/lib/obp60task/PageSolar.cpp +++ b/lib/obp60task/PageSolar.cpp @@ -6,26 +6,23 @@ class PageSolar : public Page { -bool init = false; // Marker for init done -bool keylock = false; // Keylock - public: PageSolar(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageSolar"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageSolar"); } virtual int handleKey(int key){ // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data bool simulation = config->getBool(config->useSimuData); @@ -47,13 +44,13 @@ public: // Get raw value for trend indicator if(powerSensor != "off"){ - value1 = commonData.data.solarVoltage; // Use voltage from external sensor + value1 = commonData->data.solarVoltage; // Use voltage from external sensor } else{ - value1 = commonData.data.batteryVoltage; // Use internal voltage sensor + value1 = commonData->data.batteryVoltage; // Use internal voltage sensor } - value2 = commonData.data.solarCurrent; - value3 = commonData.data.solarPower; + value2 = commonData->data.solarCurrent; + value3 = commonData->data.solarPower; solPercentage = value3 * 100 / (double)solPower; // Load value // Limits for battery level if(solPercentage < 0) solPercentage = 0; @@ -87,7 +84,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show name getdisplay().setFont(&Ubuntu_Bold20pt7b); @@ -121,7 +118,7 @@ public: getdisplay().print("Solar Modul"); // Show solar panel - solarGraphic(150, 45, commonData.fgcolor, commonData.bgcolor); + solarGraphic(150, 45, commonData->fgcolor, commonData->bgcolor); // Show load level in percent getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -202,21 +199,6 @@ public: getdisplay().setFont(&Ubuntu_Bold16pt7b); getdisplay().print("W"); - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageThreeValues.cpp b/lib/obp60task/PageThreeValues.cpp index 08de8f3..c740b30 100644 --- a/lib/obp60task/PageThreeValues.cpp +++ b/lib/obp60task/PageThreeValues.cpp @@ -5,24 +5,24 @@ class PageThreeValues : public Page { - bool keylock = false; // Keylock - public: PageThreeValues(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageThreeValue"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageThreeValue"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -45,8 +45,8 @@ class PageThreeValues : public Page name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -54,8 +54,8 @@ class PageThreeValues : public Page name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value // Get boat values #3 GwApi::BoatValue *bvalue3 = pageData.values[2]; // Second element in list (only one value by PageOneValue) @@ -63,8 +63,8 @@ class PageThreeValues : public Page name3 = name3.substring(0, 6); // String length limit for value name double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -85,7 +85,7 @@ class PageThreeValues : public Page // ############### Value 1 ################ // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold20pt7b); getdisplay().setCursor(20, 55); getdisplay().print(name1); // Page name @@ -129,7 +129,7 @@ class PageThreeValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 105, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 105, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -177,7 +177,7 @@ class PageThreeValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 195, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 195, 400, 3, commonData->fgcolor); // ############### Value 3 ################ @@ -222,24 +222,6 @@ class PageThreeValues : public Page unit3old = unit3; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageTwoValues.cpp b/lib/obp60task/PageTwoValues.cpp index 01469d9..6b8d0d1 100644 --- a/lib/obp60task/PageTwoValues.cpp +++ b/lib/obp60task/PageTwoValues.cpp @@ -5,24 +5,24 @@ class PageTwoValues : public Page { - bool keylock = false; // Keylock - public: PageTwoValues(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageTwoValue"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageTwoValue"); } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Old values for hold function static String svalue1old = ""; @@ -43,8 +43,8 @@ class PageTwoValues : public Page name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Get boat values #2 GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (only one value by PageOneValue) @@ -52,8 +52,8 @@ class PageTwoValues : public Page name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -74,7 +74,7 @@ class PageTwoValues : public Page // ############### Value 1 ################ // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold20pt7b); getdisplay().setCursor(20, 80); getdisplay().print(name1); // Page name @@ -118,7 +118,7 @@ class PageTwoValues : public Page // ############### Horizontal Line ################ // Horizontal line 3 pix - getdisplay().fillRect(0, 145, 400, 3, commonData.fgcolor); + getdisplay().fillRect(0, 145, 400, 3, commonData->fgcolor); // ############### Value 2 ################ @@ -163,24 +163,6 @@ class PageTwoValues : public Page unit2old = unit2; // Save the old unit } - - // ############### Key Layout ################ - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageVoltage.cpp b/lib/obp60task/PageVoltage.cpp index cdee817..cc77b01 100644 --- a/lib/obp60task/PageVoltage.cpp +++ b/lib/obp60task/PageVoltage.cpp @@ -7,7 +7,6 @@ class PageVoltage : public Page { bool init = false; // Marker for init done -bool keylock = false; // Keylock uint8_t average = 0; // Average type [0...3], 0=off, 1=10s, 2=60s, 3=300s bool trend = true; // Trend indicator [0|1], 0=off, 1=on double raw = 0; @@ -15,6 +14,7 @@ char mode = 'D'; // display mode (A)nalog | (D)igital public: PageVoltage(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageVoltage"); if (hasFRAM) { average = fram.read(FRAM_VOLTAGE_AVG); @@ -22,6 +22,14 @@ public: mode = fram.read(FRAM_VOLTAGE_MODE); } } + + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "AVG"; + commonData->keydata[1].label = "MODE"; + commonData->keydata[4].label = "TRD"; + } + virtual int handleKey(int key){ // Change average if(key == 1){ @@ -51,7 +59,7 @@ public: // Code for keylock if(key == 11){ - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; @@ -92,10 +100,9 @@ public: getdisplay().fillRect(x + 16, y + 11, 6, 3, color); } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data bool simulation = config->getBool(config->useSimuData); @@ -113,32 +120,32 @@ public: // Create trend value if(init == false){ // Load start values for first page run - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; init = true; } else{ // Reading trend value - valueTrend = commonData.data.batteryVoltage10; + valueTrend = commonData->data.batteryVoltage10; } // Get raw value for trend indicator - raw = commonData.data.batteryVoltage; // Live data + raw = commonData->data.batteryVoltage; // Live data // Switch average values switch (average) { case 0: - value1 = commonData.data.batteryVoltage; // Live data + value1 = commonData->data.batteryVoltage; // Live data break; case 1: - value1 = commonData.data.batteryVoltage10; // Average 10s + value1 = commonData->data.batteryVoltage10; // Average 10s break; case 2: - value1 = commonData.data.batteryVoltage60; // Average 60s + value1 = commonData->data.batteryVoltage60; // Average 60s break; case 3: - value1 = commonData.data.batteryVoltage300; // Average 300s + value1 = commonData->data.batteryVoltage300; // Average 300s break; default: - value1 = commonData.data.batteryVoltage; // Default + value1 = commonData->data.batteryVoltage; // Default break; } bool valid1 = true; @@ -193,7 +200,7 @@ public: // Display mode digital // Show name - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); getdisplay().setFont(&Ubuntu_Bold32pt7b); getdisplay().setCursor(20, 100); getdisplay().print(name1); // Value name @@ -243,22 +250,16 @@ public: } } - // Trend indicator // Show trend indicator if(trend == true){ - getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area - getdisplay().fillRect(315, 183, 35, 4, commonData.fgcolor); // Draw separator + getdisplay().fillRect(315, 183, 35, 4, commonData->fgcolor); // Draw separator if(int(raw * 10) > int(valueTrend * 10)){ - displayTrendHigh(320, 174, 11, commonData.fgcolor); // Show high indicator + displayTrendHigh(320, 174, 11, commonData->fgcolor); // Show high indicator } if(int(raw * 10) < int(valueTrend * 10)){ - displayTrendLow(320, 195, 11, commonData.fgcolor); // Show low indicator + displayTrendLow(320, 195, 11, commonData->fgcolor); // Show low indicator } } - // No trend indicator - else{ - getdisplay().fillRect(310, 240, 40, 120, commonData.bgcolor); // Clear area - } } else { @@ -272,9 +273,9 @@ public: std::vector pts; // Instrument - getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData.fgcolor); - getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData.fgcolor); - getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData.fgcolor); + getdisplay().drawCircleHelper(c.x, c.y, r + 2, 0x01, commonData->fgcolor); + getdisplay().drawCircleHelper(c.x, c.y, r + 1, 0x01, commonData->fgcolor); + getdisplay().drawCircleHelper(c.x, c.y, r , 0x01, commonData->fgcolor); // Scale // angle to voltage scale mapping @@ -290,14 +291,14 @@ public: getdisplay().setFont(&Ubuntu_Bold10pt7b); for (int angle = 3; angle < 90; angle += 3) { if (angle % 15 == 0) { - fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); p1 = rotatePoint(c, {c.x - r + 30, c.y}, angle); drawTextCenter(p1.x, p1.y, mapping[angle]); } else { p1 = rotatePoint(c, {c.x - r, c.y}, angle); p2 = rotatePoint(c, {c.x - r + 6, c.y}, angle); - getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData.fgcolor); + getdisplay().drawLine(p1.x, p1.y, p2.x, p2.y, commonData->fgcolor); } } @@ -326,7 +327,7 @@ public: {c.x - r + 38, c.y - 2}, {c.x - 2, c.y - 3} }; - fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); // thin part pts = { {c.x - r + 40, c.y + 1}, @@ -334,14 +335,14 @@ public: {c.x - r + 5, c.y -1}, {c.x - r + 40, c.y - 1}, }; - fillPoly4(rotatePoints(c, pts, angle), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, angle), commonData->fgcolor); // base - getdisplay().fillCircle(c.x, c.y, 7, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, 4, commonData.bgcolor); + getdisplay().fillCircle(c.x, c.y, 7, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, 4, commonData->bgcolor); // Symbol - printVoltageSymbol(40, 60, commonData.fgcolor); + printVoltageSymbol(40, 60, commonData->fgcolor); // Additional information at right side getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -361,33 +362,11 @@ public: // FRAM indicator if (hasFRAM) { - getdisplay().drawXBitmap(300, 240, fram_bits, fram_width, fram_height, commonData.fgcolor); + getdisplay().drawXBitmap(300, 240, fram_bits, icon_width, icon_height, commonData->fgcolor); } } - // Key Layout - getdisplay().setTextColor(commonData.fgcolor); - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[AVG]"); - getdisplay().setCursor(62, 290); - getdisplay().print("[MODE]"); - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - getdisplay().setCursor(293, 290); - getdisplay().print("[TRD]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageWhite.cpp b/lib/obp60task/PageWhite.cpp index e941732..4c9d0c7 100644 --- a/lib/obp60task/PageWhite.cpp +++ b/lib/obp60task/PageWhite.cpp @@ -3,17 +3,17 @@ #include "Pagedata.h" #include "OBP60Extensions.h" -class PageWhite : public Page{ - bool keylock = false; // Keylock - +class PageWhite : public Page +{ public: PageWhite(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageWhite"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite"); } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data String flashLED = config->getString(config->flashLED); @@ -60,4 +60,4 @@ PageDescription registerPageWhite( false // Show display header on/off ); -#endif \ No newline at end of file +#endif diff --git a/lib/obp60task/PageWind.cpp b/lib/obp60task/PageWind.cpp index d37801a..3702613 100644 --- a/lib/obp60task/PageWind.cpp +++ b/lib/obp60task/PageWind.cpp @@ -220,6 +220,7 @@ char source = 'A'; // data source (A)pparent | (T)rue public: PageWind(CommonData &common){ + commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageWind"); if (hasFRAM) { lp = fram.read(FRAM_WIND_SIZE); @@ -228,6 +229,17 @@ public: } } + virtual void setupKeys(){ + Page::setupKeys(); + commonData->keydata[0].label = "MODE"; + if (mode == 'X') { + commonData->keydata[1].label = "#MINUS"; + commonData->keydata[4].label = "#PLUS"; + } else { + commonData->keydata[1].label = "SRC"; + } + } + // Key functions virtual int handleKey(int key){ @@ -240,26 +252,28 @@ public: mode = 'N'; } if (hasFRAM) fram.write(FRAM_WIND_MODE, mode); + setupKeys(); return 0; // Commit the key } - if(key == 3){ // Source switch - if(source == 'A'){ - source = 'T'; + // Set source or reduce instrument size + if(key == 2){ + if(mode == 'X'){ + // Code for reduce + lp = lp - 10; + if(lp < 10){ + lp = 10; + } + if (hasFRAM) fram.write(FRAM_WIND_SIZE, lp); } else { - source = 'A'; + // Code for set source + if(source == 'A'){ + source = 'T'; + } else { + source = 'A'; + } + if (hasFRAM) fram.write(FRAM_WIND_SRC, source); } - if (hasFRAM) fram.write(FRAM_WIND_SRC, source); - return 0; // Commit the key - } - - // Reduce instrument size - if(key == 2 && mode == 'X'){ // Code for reduce - lp = lp - 10; - if(lp < 10){ - lp = 10; - } - if (hasFRAM) fram.write(FRAM_WIND_SIZE, lp); return 0; // Commit the key } @@ -275,16 +289,16 @@ public: // Keylock function if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) + virtual void displayPage(PageData &pageData) { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -311,8 +325,8 @@ public: name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit // bool valid1 = bvalue1->valid; // Valid information - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value // Get boat values for angle (AWD/TWD) if (source == 'A') { @@ -324,8 +338,8 @@ public: name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit // bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value // Optical warning by limit violation (unused) if(String(flashLED) == "Limit Violation"){ @@ -343,7 +357,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); if (mode == 'X') { @@ -384,8 +398,8 @@ public: Point c = {200, 145}; // Draw instrument - getdisplay().fillCircle(c.x, c.y, lp + 5, commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, lp + 1, commonData.bgcolor); + getdisplay().fillCircle(c.x, c.y, lp + 5, commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, lp + 1, commonData->bgcolor); // Wind pointer if (bvalue2->valid) { @@ -398,7 +412,7 @@ public: {c.x, c.y - lp + lp1}, {c.x + 7, c.y - lp + lp0} }; - fillPoly4(rotatePoints(c, pts, RadToDeg(value2)), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, RadToDeg(value2)), commonData->fgcolor); } else { getdisplay().setFont(&Ubuntu_Bold12pt7b); drawTextCenter(c.x, c.y, "no data"); @@ -427,13 +441,13 @@ public: p = rotatePoint(c, {c.x, c.y - r + 40}, i); drawTextCenter(p.x, p.y, String(angle)); angle += 10; - fillPoly4(rotatePoints(c, pts, i), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor); } // dots for (int i = 30; i < 138; i += 6) { if (i % 15 != 0) { p = rotatePoint(c, {c.x, c.y - r + 5}, i); - getdisplay().fillCircle(p.x, p.y, 2, commonData.fgcolor); + getdisplay().fillCircle(p.x, p.y, 2, commonData->fgcolor); } } @@ -444,13 +458,13 @@ public: p = rotatePoint(c, {c.x, c.y - r + 40}, i); drawTextCenter(p.x, p.y, String(angle)); angle -= 10; - fillPoly4(rotatePoints(c, pts, i), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor); } // dots for (int i = 228; i < 330; i += 6) { if (i % 15 != 0) { p = rotatePoint(c, {c.x, c.y - r + 5}, i); - getdisplay().fillCircle(p.x, p.y, 2, commonData.fgcolor); + getdisplay().fillCircle(p.x, p.y, 2, commonData->fgcolor); } } @@ -480,15 +494,15 @@ public: alpha *= -1; } - getdisplay().fillCircle(c.x, c.y, 8, commonData.fgcolor); + getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); pts = { {c.x - 1, c.y - (r - 20)}, {c.x + 1, c.y - (r - 20)}, {c.x + 6, c.y + 15}, {c.x - 6, c.y + 15} }; - fillPoly4(rotatePoints(c, pts, alpha), commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, 6, commonData.bgcolor); + fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); } else { getdisplay().setFont(&Ubuntu_Bold12pt7b); drawTextCenter(c.x, c.y, "no data"); @@ -520,7 +534,7 @@ public: } // draw ship front symbol (as bitmap) - getdisplay().drawXBitmap(140, 30, front_bits, front_width, front_height, commonData.fgcolor); + getdisplay().drawXBitmap(140, 30, front_bits, front_width, front_height, commonData->fgcolor); Point c = {200, 155}; uint16_t r = 150; @@ -539,13 +553,13 @@ public: for (int i = 30; i < 150; i += 30) { p = rotatePoint(c, {c.x, c.y - r + 40}, i); drawTextCenter(p.x, p.y, String(i)); - fillPoly4(rotatePoints(c, pts, i), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor); } // dots for (int i = 30; i < 150; i += 10) { if (i % 30 != 0) { p = rotatePoint(c, {c.x, c.y - r + 5}, i); - getdisplay().fillCircle(p.x, p.y, 3, commonData.fgcolor); + getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); } } @@ -556,13 +570,13 @@ public: p = rotatePoint(c, {c.x, c.y - r + 40}, i); drawTextCenter(p.x, p.y, String(angle)); angle -= 30; - fillPoly4(rotatePoints(c, pts, i), commonData.fgcolor); + fillPoly4(rotatePoints(c, pts, i), commonData->fgcolor); } // dots for (int i = 210; i < 340; i += 10) { if (i % 30 != 0) { p = rotatePoint(c, {c.x, c.y - r + 5}, i); - getdisplay().fillCircle(p.x, p.y, 3, commonData.fgcolor); + getdisplay().fillCircle(p.x, p.y, 3, commonData->fgcolor); } } @@ -582,15 +596,15 @@ public: // Wind pointer (angle) if (bvalue2->valid) { float alpha = RadToDeg(value2); - getdisplay().fillCircle(c.x, c.y, 8, commonData.fgcolor); + getdisplay().fillCircle(c.x, c.y, 8, commonData->fgcolor); pts = { {c.x - 1, c.y - (r - 20)}, {c.x + 1, c.y - (r - 20)}, {c.x + 6, c.y + 15}, {c.x - 6, c.y + 15} }; - fillPoly4(rotatePoints(c, pts, alpha), commonData.fgcolor); - getdisplay().fillCircle(c.x, c.y, 6, commonData.bgcolor); + fillPoly4(rotatePoints(c, pts, alpha), commonData->fgcolor); + getdisplay().fillCircle(c.x, c.y, 6, commonData->bgcolor); } else { getdisplay().setFont(&Ubuntu_Bold12pt7b); drawTextCenter(c.x, c.y, "no data"); @@ -598,31 +612,6 @@ public: } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(10, 290); - getdisplay().print("[MODE]"); - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - - if (mode == 'X') { - getdisplay().setCursor(85, 290); - getdisplay().print("[ - ]"); - getdisplay().setCursor(295, 290); - getdisplay().print("[ + ]"); - } - - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/PageWindRose.cpp b/lib/obp60task/PageWindRose.cpp index 82700f3..88c490f 100644 --- a/lib/obp60task/PageWindRose.cpp +++ b/lib/obp60task/PageWindRose.cpp @@ -5,28 +5,27 @@ class PageWindRose : public Page { -bool keylock = false; // Keylock int16_t lp = 80; // Pointer length public: PageWindRose(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageWindRose"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRose"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -54,9 +53,9 @@ public: name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - value1 = formatValue(bvalue1, commonData).value;// Format only nesaccery for simulation data for pointer - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value if(valid1 == true){ svalue1old = svalue1; // Save old value unit1old = unit1; // Save old unit @@ -68,8 +67,8 @@ public: name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value if(valid2 == true){ svalue2old = svalue2; // Save old value unit2old = unit2; // Save old unit @@ -81,8 +80,8 @@ public: name3 = name3.substring(0, 6); // String length limit for value name double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value if(valid3 == true){ svalue3old = svalue3; // Save old value unit3old = unit3; // Save old unit @@ -94,8 +93,8 @@ public: name4 = name4.substring(0, 6); // String length limit for value name double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information - String svalue4 = formatValue(bvalue4, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit4 = formatValue(bvalue4, commonData).unit; // Unit of value + String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value if(valid4 == true){ svalue4old = svalue4; // Save old value unit4old = unit4; // Save old unit @@ -107,8 +106,8 @@ public: name5 = name5.substring(0, 6); // String length limit for value name double value5 = bvalue5->value; // Value as double in SI unit bool valid5 = bvalue5->valid; // Valid information - String svalue5 = formatValue(bvalue5, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit5 = formatValue(bvalue5, commonData).unit; // Unit of value + String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value if(valid5 == true){ svalue5old = svalue5; // Save old value unit5old = unit5; // Save old unit @@ -120,8 +119,8 @@ public: name6 = name6.substring(0, 6); // String length limit for value name double value6 = bvalue6->value; // Value as double in SI unit bool valid6 = bvalue6->valid; // Valid information - String svalue6 = formatValue(bvalue6, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit6 = formatValue(bvalue6, commonData).unit; // Unit of value + String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value if(valid6 == true){ svalue6old = svalue6; // Save old value unit6old = unit6; // Save old unit @@ -143,7 +142,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values AWA getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -163,7 +162,7 @@ public: } // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values AWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -205,7 +204,7 @@ public: } // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values TWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -230,10 +229,10 @@ public: int rInstrument = 110; // Radius of grafic instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle - getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle for(int i=0; i<360; i=i+10) { @@ -271,7 +270,7 @@ public: // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -284,10 +283,10 @@ public: float yy2 = -(rInstrument+10); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), - 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -304,7 +303,7 @@ public: float yy2 = -(rInstrument-15); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -314,12 +313,12 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* @@ -351,21 +350,6 @@ public: getdisplay().print(unit6old); // Unit } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageWindRoseFlex.cpp b/lib/obp60task/PageWindRoseFlex.cpp index 7689777..ba4b029 100644 --- a/lib/obp60task/PageWindRoseFlex.cpp +++ b/lib/obp60task/PageWindRoseFlex.cpp @@ -5,28 +5,27 @@ class PageWindRoseFlex : public Page { -bool keylock = false; // Keylock int16_t lp = 80; // Pointer length public: PageWindRoseFlex(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageWindRoseFlex"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageWindRoseFlex"); } // Key functions virtual int handleKey(int key){ - // Keylock function - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData) - { - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; static String svalue1old = ""; static String unit1old = ""; @@ -54,9 +53,9 @@ public: name1 = name1.substring(0, 6); // String length limit for value name double value1 = bvalue1->value; // Value as double in SI unit bool valid1 = bvalue1->valid; // Valid information - value1 = formatValue(bvalue1, commonData).value;// Format only nesaccery for simulation data for pointer - String svalue1 = formatValue(bvalue1, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit1 = formatValue(bvalue1, commonData).unit; // Unit of value + value1 = formatValue(bvalue1, *commonData).value;// Format only nesaccery for simulation data for pointer + String svalue1 = formatValue(bvalue1, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit1 = formatValue(bvalue1, *commonData).unit; // Unit of value if(valid1 == true){ svalue1old = svalue1; // Save old value unit1old = unit1; // Save old unit @@ -68,8 +67,8 @@ public: name2 = name2.substring(0, 6); // String length limit for value name double value2 = bvalue2->value; // Value as double in SI unit bool valid2 = bvalue2->valid; // Valid information - String svalue2 = formatValue(bvalue2, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit2 = formatValue(bvalue2, commonData).unit; // Unit of value + String svalue2 = formatValue(bvalue2, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit2 = formatValue(bvalue2, *commonData).unit; // Unit of value if(valid2 == true){ svalue2old = svalue2; // Save old value unit2old = unit2; // Save old unit @@ -81,8 +80,8 @@ public: name3 = name3.substring(0, 6); // String length limit for value name double value3 = bvalue3->value; // Value as double in SI unit bool valid3 = bvalue3->valid; // Valid information - String svalue3 = formatValue(bvalue3, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit3 = formatValue(bvalue3, commonData).unit; // Unit of value + String svalue3 = formatValue(bvalue3, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit3 = formatValue(bvalue3, *commonData).unit; // Unit of value if(valid3 == true){ svalue3old = svalue3; // Save old value unit3old = unit3; // Save old unit @@ -94,8 +93,8 @@ public: name4 = name4.substring(0, 6); // String length limit for value name double value4 = bvalue4->value; // Value as double in SI unit bool valid4 = bvalue4->valid; // Valid information - String svalue4 = formatValue(bvalue4, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit4 = formatValue(bvalue4, commonData).unit; // Unit of value + String svalue4 = formatValue(bvalue4, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit4 = formatValue(bvalue4, *commonData).unit; // Unit of value if(valid4 == true){ svalue4old = svalue4; // Save old value unit4old = unit4; // Save old unit @@ -107,8 +106,8 @@ public: name5 = name5.substring(0, 6); // String length limit for value name double value5 = bvalue5->value; // Value as double in SI unit bool valid5 = bvalue5->valid; // Valid information - String svalue5 = formatValue(bvalue5, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit5 = formatValue(bvalue5, commonData).unit; // Unit of value + String svalue5 = formatValue(bvalue5, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit5 = formatValue(bvalue5, *commonData).unit; // Unit of value if(valid5 == true){ svalue5old = svalue5; // Save old value unit5old = unit5; // Save old unit @@ -120,8 +119,8 @@ public: name6 = name6.substring(0, 6); // String length limit for value name double value6 = bvalue6->value; // Value as double in SI unit bool valid6 = bvalue6->valid; // Valid information - String svalue6 = formatValue(bvalue6, commonData).svalue; // Formatted value as string including unit conversion and switching decimal places - String unit6 = formatValue(bvalue6, commonData).unit; // Unit of value + String svalue6 = formatValue(bvalue6, *commonData).svalue; // Formatted value as string including unit conversion and switching decimal places + String unit6 = formatValue(bvalue6, *commonData).unit; // Unit of value if(valid6 == true){ svalue6old = svalue6; // Save old value unit6old = unit6; // Save old unit @@ -143,7 +142,7 @@ public: // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // Show values AWA getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -163,7 +162,7 @@ public: } // Horizintal separator left - getdisplay().fillRect(0, 149, 60, 3, commonData.fgcolor); + getdisplay().fillRect(0, 149, 60, 3, commonData->fgcolor); // Show values AWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -206,7 +205,7 @@ public: } // Horizintal separator right - getdisplay().fillRect(340, 149, 80, 3, commonData.fgcolor); + getdisplay().fillRect(340, 149, 80, 3, commonData->fgcolor); // Show values TWS getdisplay().setFont(&DSEG7Classic_BoldItalic20pt7b); @@ -231,10 +230,10 @@ public: int rInstrument = 110; // Radius of grafic instrument float pi = 3.141592; - getdisplay().fillCircle(200, 150, rInstrument + 10, commonData.fgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument + 7, commonData.bgcolor); // Outer circle - getdisplay().fillCircle(200, 150, rInstrument - 10, commonData.fgcolor); // Inner circle - getdisplay().fillCircle(200, 150, rInstrument - 13, commonData.bgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument + 10, commonData->fgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument + 7, commonData->bgcolor); // Outer circle + getdisplay().fillCircle(200, 150, rInstrument - 10, commonData->fgcolor); // Inner circle + getdisplay().fillCircle(200, 150, rInstrument - 13, commonData->bgcolor); // Inner circle for(int i=0; i<360; i=i+10) { @@ -272,7 +271,7 @@ public: // Draw sub scale with dots float x1c = 200 + rInstrument*sin(i/180.0*pi); float y1c = 150 - rInstrument*cos(i/180.0*pi); - getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData.fgcolor); + getdisplay().fillCircle((int)x1c, (int)y1c, 2, commonData->fgcolor); float sinx=sin(i/180.0*pi); float cosx=cos(i/180.0*pi); @@ -285,10 +284,10 @@ public: float yy2 = -(rInstrument+10); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2),commonData->fgcolor); getdisplay().fillTriangle(200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), 200+(int)(cosx*xx1-sinx*yy2),150+(int)(sinx*xx1+cosx*yy2), - 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*xx2-sinx*yy2),150+(int)(sinx*xx2+cosx*yy2),commonData->fgcolor); } } @@ -305,7 +304,7 @@ public: float yy2 = -(rInstrument-15); getdisplay().fillTriangle(200+(int)(cosx*xx1-sinx*yy1),150+(int)(sinx*xx1+cosx*yy1), 200+(int)(cosx*xx2-sinx*yy1),150+(int)(sinx*xx2+cosx*yy1), - 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*yy2),150+(int)(sinx*0+cosx*yy2),commonData->fgcolor); // Inverted pointer // Pointer as triangle with center base 2*width float endwidth = 2; // End width of pointer @@ -315,12 +314,12 @@ public: float iy2 = -endwidth; getdisplay().fillTriangle(200+(int)(cosx*ix1-sinx*iy1),150+(int)(sinx*ix1+cosx*iy1), 200+(int)(cosx*ix2-sinx*iy1),150+(int)(sinx*ix2+cosx*iy1), - 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData.fgcolor); + 200+(int)(cosx*0-sinx*iy2),150+(int)(sinx*0+cosx*iy2),commonData->fgcolor); } // Center circle - getdisplay().fillCircle(200, 150, startwidth + 6, commonData.bgcolor); - getdisplay().fillCircle(200, 150, startwidth + 4, commonData.fgcolor); + getdisplay().fillCircle(200, 150, startwidth + 6, commonData->bgcolor); + getdisplay().fillCircle(200, 150, startwidth + 4, commonData->fgcolor); //******************************************************************************************* @@ -352,21 +351,6 @@ public: getdisplay().print(unit6old); // Unit } - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 290); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 290); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 290); - getdisplay().print(" [ Keylock active ]"); - } - // Update display getdisplay().nextPage(); // Partial update (fast) }; diff --git a/lib/obp60task/PageXTETrack.cpp b/lib/obp60task/PageXTETrack.cpp index 91afff1..7b5f487 100644 --- a/lib/obp60task/PageXTETrack.cpp +++ b/lib/obp60task/PageXTETrack.cpp @@ -26,12 +26,12 @@ static unsigned char ship_bits[] PROGMEM = { 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00 }; -class PageXTETrack : public Page{ - bool keylock = false; // Keylock - +class PageXTETrack : public Page +{ public: PageXTETrack(CommonData &common){ - common.logger->logDebug(GwLog::LOG,"Show PageXTETrack"); + commonData = &common; + common.logger->logDebug(GwLog::LOG,"Instantiate PageXTETrack"); } void drawSegment(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, @@ -52,16 +52,17 @@ class PageXTETrack : public Page{ } virtual int handleKey(int key){ - if(key == 11){ // Code for keylock - keylock = !keylock; // Toggle keylock + // Code for keylock + if(key == 11){ + commonData->keylock = !commonData->keylock; return 0; // Commit the key } return key; } - virtual void displayPage(CommonData &commonData, PageData &pageData){ - GwConfigHandler *config = commonData.config; - GwLog *logger=commonData.logger; + virtual void displayPage(PageData &pageData){ + GwConfigHandler *config = commonData->config; + GwLog *logger = commonData->logger; // Get config data String flashLED = config->getString(config->flashLED); @@ -85,7 +86,7 @@ class PageXTETrack : public Page{ // Set display in partial refresh mode getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update - getdisplay().setTextColor(commonData.fgcolor); + getdisplay().setTextColor(commonData->fgcolor); // descriptions getdisplay().setFont(&Ubuntu_Bold8pt7b); @@ -105,25 +106,25 @@ class PageXTETrack : public Page{ uint16_t w, h; GwApi::BoatValue *bv_xte = pageData.values[0]; // XTE - String sval_xte = formatValue(bv_xte, commonData).svalue; + String sval_xte = formatValue(bv_xte, *commonData).svalue; getdisplay().getTextBounds(sval_xte, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(160-w, 170); getdisplay().print(sval_xte); GwApi::BoatValue *bv_cog = pageData.values[1]; // COG - String sval_cog = formatValue(bv_cog, commonData).svalue; + String sval_cog = formatValue(bv_cog, *commonData).svalue; getdisplay().getTextBounds(sval_cog, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(360-w, 170); getdisplay().print(sval_cog); GwApi::BoatValue *bv_dtw = pageData.values[2]; // DTW - String sval_dtw = formatValue(bv_dtw, commonData).svalue; + String sval_dtw = formatValue(bv_dtw, *commonData).svalue; getdisplay().getTextBounds(sval_dtw, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(160-w, 257); getdisplay().print(sval_dtw); GwApi::BoatValue *bv_btw = pageData.values[3]; // BTW - String sval_btw = formatValue(bv_btw, commonData).svalue; + String sval_btw = formatValue(bv_btw, *commonData).svalue; getdisplay().getTextBounds(sval_btw, 0, 0, &x, &y, &w, &h); getdisplay().setCursor(360-w, 257); getdisplay().print(sval_btw); @@ -133,7 +134,7 @@ class PageXTETrack : public Page{ // XTETrack view // draw ship symbol (as bitmap) - getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData.fgcolor); + getdisplay().drawXBitmap(184, 68, ship_bits, ship_width, ship_height, commonData->fgcolor); // draw next waypoint name String sval_wpname = "no data"; @@ -188,28 +189,13 @@ class PageXTETrack : public Page{ } // left segments - drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData.fgcolor, seg[2]); - drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData.fgcolor, seg[1]); - drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData.fgcolor,seg[0]); + drawSegment(0, 54, 46, 24, 75, 24, 0, 90, commonData->fgcolor, seg[2]); + drawSegment(0, 100, 82, 24, 112, 24, 50, 100, commonData->fgcolor, seg[1]); + drawSegment(60, 100, 117, 24, 147, 24, 110, 100, commonData->fgcolor,seg[0]); // right segments - drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData.fgcolor, seg[3]); - drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData.fgcolor, seg[4]); - drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData.fgcolor, seg[5]); - - // Key Layout - getdisplay().setFont(&Ubuntu_Bold8pt7b); - if(keylock == false){ - getdisplay().setCursor(130, 296); - getdisplay().print("[ <<<< " + String(commonData.data.actpage) + "/" + String(commonData.data.maxpage) + " >>>> ]"); - if(String(backlightMode) == "Control by Key"){ // Key for illumination - getdisplay().setCursor(343, 296); - getdisplay().print("[ILUM]"); - } - } - else{ - getdisplay().setCursor(130, 296); - getdisplay().print(" [ Keylock active ]"); - } + drawSegment(340, 100, 283, 24, 253, 24, 290, 100, commonData->fgcolor, seg[3]); + drawSegment(399, 100, 318, 24, 289, 24, 350, 100, commonData->fgcolor, seg[4]); + drawSegment(399, 54, 354, 24, 325, 24, 399, 90, commonData->fgcolor, seg[5]); // Update display getdisplay().nextPage(); // Partial update (fast) diff --git a/lib/obp60task/Pagedata.h b/lib/obp60task/Pagedata.h index d18452f..2a72ba6 100644 --- a/lib/obp60task/Pagedata.h +++ b/lib/obp60task/Pagedata.h @@ -3,6 +3,7 @@ #include "GwApi.h" #include #include +#include "LedSpiTask.h" #define MAX_PAGE_NUMBER 10 // Max number of pages for show data @@ -63,23 +64,56 @@ typedef struct{ bool sunDown = true; } SunData; +typedef struct{ + String label = ""; + bool selected = false; // for virtual keyboard function + uint16_t x; + uint16_t y; + uint16_t w; + uint16_t h; +} TouchKeyData; + +typedef struct{ + Color color; // red, orange, yellow, green, blue, aqua, violet, white + BacklightMode mode; // off, on, sun, bus, time, key + uint8_t brightness; // 0% (off), user setting from 20% to 100% full power + bool on; // fast on/off detector +} BacklightData; + typedef struct{ GwApi::Status status; GwLog *logger=NULL; GwConfigHandler *config=NULL; SensorData data; SunData sundata; + TouchKeyData keydata[6]; + BacklightData backlight; GwApi::BoatValue *time=NULL; GwApi::BoatValue *date=NULL; uint16_t fgcolor; uint16_t bgcolor; + bool keylock = false; } CommonData; //a base class that all pages must inherit from class Page{ + protected: + CommonData *commonData; public: - virtual void displayPage(CommonData &commonData, PageData &pageData)=0; - virtual void displayNew(CommonData &commonData, PageData &pageData){} + virtual void displayPage(PageData &pageData)=0; + virtual void displayNew(PageData &pageData){} + virtual void setupKeys() { + commonData->keydata[0].label = ""; + commonData->keydata[1].label = ""; + commonData->keydata[2].label = "#LEFT"; + commonData->keydata[3].label = "#RIGHT"; + commonData->keydata[4].label = ""; + if (commonData->backlight.mode == KEY) { + commonData->keydata[5].label = "ILUM"; + } else { + commonData->keydata[5].label = ""; + } + } //return -1 if handled by the page virtual int handleKey(int key){return key;} }; diff --git a/lib/obp60task/gen_set.pl b/lib/obp60task/gen_set.pl deleted file mode 100755 index 3c74904..0000000 --- a/lib/obp60task/gen_set.pl +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/perl -w -#A tool to generate the part of config.json that deals with pages and fields. -#DEPRECATED, moved to get_set.py -die "Please use gen_set.py instead"; -#List of all pages and the number of parameters they expect. -%NoOfFieldsPerPage=qw( - ApparentWind 0 - XTETrack 0 - Battery2 0 - Battery 0 - BME280 0 - Clock 0 - DST810 0 - FourValues2 4 - FourValues 4 - Generator 0 - KeelPosition 0 - OneValue 1 - RollPitch 0 - RudderPosition 0 - Solar 0 - ThreeValues 3 - TwoValues 2 - Voltage 0 - White 0 - WindRose 0 - WindRoseFlex 6 - ); -# No changes needed beyond this point -#max number of pages supported by OBP60 -$NoOfPages=10; -#Default selection for each page -@Defaults=qw(Voltage WindRose OneValue TwoValues ThreeValues FourValues FourValues2 Clock RollPitch Battery2); -@Numbers=qw(one two three four five six seven eight nine ten); -@Pages=sort(keys(%NoOfFieldsPerPage)); -$MaxNoOfFieldsPerPage=0; # inital value, gets updated with maximum entry from %NoOfFieldsPerPage - - -#find max. number of fields without additional modules - foreach (values(%NoOfFieldsPerPage)){ - if ($_ > $MaxNoOfFieldsPerPage){ - $MaxNoOfFieldsPerPage=$_; - } - } - -for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ - print "{\n"; - print "\t","\"name\": \"page", $PageNo,"type\",\n"; - print "\t","\"label\": \"Type\",\n"; - print "\t",'"type": "list",',"\n"; - print "\t",'"default": "'; - print "$Defaults[$PageNo-1]"; - print'"',"\n"; - print "\t",'"description": "Type of page for page ',$PageNo,'",',"\n"; - print "\t",'"list": ['; - for ($p=0;$p<=$#Pages;$p++) { - print '"', $Pages[$p], '"' ; - if ($p < $#Pages){print ","} - } - print "]\n"; - print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; - print "\t",'"capabilities": {',"\n"; - print "\t\t",'"obp60":"true"',"\n"; - print "\t",'}',"\n"; - print "\t",'"condition":['; - for ($vp=$PageNo;$vp<=$NoOfPages;$vp++){ - print '"{visiblePages":"',$vp,'"},'; - } - print "\b",']',"\n"; - print '},',"\n"; - for ($FieldNo=1; $FieldNo<=$MaxNoOfFieldsPerPage;$FieldNo++){ - print "{\n"; - print "\t",'"name": "page',$PageNo,'value',$FieldNo,'",',"\n"; - print "\t",'"label": "Field ',$FieldNo,'",',"\n"; - print "\t",'"type": "boatData",',"\n"; - print "\t",'"default": "",',"\n"; - print "\t",'"description": "The display for field ',$Numbers[$FieldNo-1],'",',"\n"; - print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; - print "\t",'"capabilities": {',"\n"; - print "\t",' "obp60":"true"',"\n"; - print "\t",'}, ',"\n"; - print "\t",'"condition":['; - foreach $page (@Pages) { - if($NoOfFieldsPerPage{$page}>=$FieldNo){ - print '{"page',$PageNo,'type":"',$page,'"},'; - } - } - print "\b],\n"; - print '},',"\n"; - } - print "{\n"; - print "\t","\"name\": \"page", $PageNo,"fluid\",\n"; - print "\t",'"label": "Fluid type",',"\n"; - print "\t",'"type": "list",',"\n"; - print "\t",'"default": "0",',"\n"; - print "\t",'"list": [',"\n"; - print "\t",'{"l":"Fuel (0)","v":"0"},',"\n"; - print "\t",'{"l":"Water (1)","v":"1"},',"\n"; - print "\t",'{"l":"Gray Water (2)","v":"2"},',"\n"; - print "\t",'{"l":"Live Well (3)","v":"3"},',"\n"; - print "\t",'{"l":"Oil (4)","v":"4"},',"\n"; - print "\t",'{"l":"Black Water (5)","v":"5"},',"\n"; - print "\t",'{"l":"Fuel Gasoline (6)","v":"6"}',"\n"; - print "\t",'],',"\n"; - print "\t",'"description": "Fluid type in tank",',"\n"; - print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; - print "\t",'"capabilities": {',"\n"; - print "\t",'"obp60":"true"',"\n"; - print "\t",'},',"\n"; - print "\t",'"condition":[{"page',$PageNo,'type":"Fluid"}]',"\n"; - print '},',"\n"; -} diff --git a/lib/obp60task/gen_set.py b/lib/obp60task/gen_set.py index d0ff7e5..bf40b6c 100755 --- a/lib/obp60task/gen_set.py +++ b/lib/obp60task/gen_set.py @@ -1,18 +1,22 @@ #!/usr/bin/env python3 # A tool to generate that part of config.json that deals with pages and fields. +# +#Usage: 1. modify this script (e.g.add a page, change number of fields, etc.) +# 2. Delete all lines from config.json from the curly backet before "name": "page1type" to o the end of the file (as of today, delete from line 917 to the end of the File) +# 3. run ./gen_set.py >> config.json import json # List of all pages and the number of parameters they expect. no_of_fields_per_page = { - "ApparentWind": 0, + "Wind": 0, "XTETrack": 0, "Battery2": 0, "Battery": 0, "BME280": 0, "Clock": 0, "DST810": 0, - "Fluid": 0, + "Fluid": 1, "FourValues2": 4, "FourValues": 4, "Generator": 0, @@ -27,6 +31,7 @@ no_of_fields_per_page = { "White": 0, "WindRose": 0, "WindRoseFlex": 6, + "SixValues" : 6, } # No changes needed beyond this point @@ -119,5 +124,7 @@ for page_no in range(1, no_of_pages + 1): json_output = json.dumps(output, indent=4) # print omitting first and last line containing [ ] of JSON array -print(json_output[1:-1]) +#print(json_output[1:-1]) +# print omitting first line containing [ of JSON array +print(json_output[1:]) # print(",") \ No newline at end of file diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 7f3b730..769d7c6 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -116,10 +116,10 @@ void OBP60Init(GwApi *api){ if(String(backlightMode) == "On"){ setBacklightLED(brightness, colorMapping(backlightColor)); } - if(String(backlightMode) == "Off"){ + else if(String(backlightMode) == "Off"){ setBacklightLED(0, COLOR_BLACK); // Backlight LEDs off (blue without britghness) } - if(String(backlightMode) == "Control by Key"){ + else if(String(backlightMode) == "Control by Key"){ setBacklightLED(0, COLOR_BLUE); // Backlight LEDs off (blue without britghness) } @@ -327,13 +327,16 @@ void OBP60Task(GwApi *api){ commonData.logger=logger; commonData.config=config; + // Keyboard coordinates for page footer + initKeys(commonData); + tN2kMsg N2kMsg; LOG_DEBUG(GwLog::LOG,"obp60task started"); for (auto it=allPages.pages.begin();it != allPages.pages.end();it++){ LOG_DEBUG(GwLog::LOG,"found registered page %s",(*it)->pageName.c_str()); } - + // Init E-Ink display String displaymode = api->getConfig()->getConfigItem(api->getConfig()->display,true)->asString(); String displaycolor = api->getConfig()->getConfigItem(api->getConfig()->displaycolor,true)->asString(); @@ -458,12 +461,13 @@ void OBP60Task(GwApi *api){ // Configuration values for main loop String gpsFix = api->getConfig()->getConfigItem(api->getConfig()->flashLED,true)->asString(); - String backlight = api->getConfig()->getConfigItem(api->getConfig()->backlight,true)->asString(); String gpsOn=api->getConfig()->getConfigItem(api->getConfig()->useGPS,true)->asString(); String tz = api->getConfig()->getConfigItem(api->getConfig()->timeZone,true)->asString(); - String backlightColor = api->getConfig()->getConfigItem(api->getConfig()->blColor,true)->asString(); - Color color = colorMapping(backlightColor); - uint brightness = 2.55 * uint(api->getConfig()->getConfigItem(api->getConfig()->blBrightness,true)->asInt()); + + commonData.backlight.mode = backlightMapping(config->getConfigItem(config->backlight,true)->asString()); + commonData.backlight.color = colorMapping(config->getConfigItem(config->blColor,true)->asString()); + commonData.backlight.brightness = 2.55 * uint(config->getConfigItem(config->blBrightness,true)->asInt()); + bool uvoltage = api->getConfig()->getConfigItem(api->getConfig()->underVoltage,true)->asBoolean(); String cpuspeed = api->getConfig()->getConfigItem(api->getConfig()->cpuSpeed,true)->asString(); uint hdopAccuracy = uint(api->getConfig()->getConfigItem(api->getConfig()->hdopAccuracy,true)->asInt()); @@ -490,7 +494,9 @@ void OBP60Task(GwApi *api){ long starttime3 = millis(); // Display update all 1s long starttime4 = millis(); // Delayed display update after 4s when select a new page long starttime5 = millis(); // Calculate sunrise and sunset all 1s - + + pages[pageNumber].page->setupKeys(); // Initialize keys for first page + // Main loop runs with 100ms //#################################################################################### @@ -547,14 +553,15 @@ void OBP60Task(GwApi *api){ { // Decoding all key codes // #6 Backlight on if key controled - if(String(backlight) == "Control by Key"){ + if (commonData.backlight.mode == BacklightMode::KEY) { + // if(String(backlight) == "Control by Key"){ if(keyboardMessage == 6){ LOG_DEBUG(GwLog::LOG,"Toggle Backlight LED"); - toggleBacklightLED(brightness, color); + toggleBacklightLED(commonData.backlight.brightness, commonData.backlight.color); } } - // #9 Swipe right - if (keyboardMessage == 9) + // #9 Swipe right or #4 key right + if ((keyboardMessage == 9) or (keyboardMessage == 4)) { pageNumber++; if (pageNumber >= numPages){ @@ -563,8 +570,8 @@ void OBP60Task(GwApi *api){ commonData.data.actpage = pageNumber + 1; commonData.data.maxpage = numPages; } - // #10 Swipe left - if (keyboardMessage == 10) + // #10 Swipe left or #3 key left + if ((keyboardMessage == 10) or (keyboardMessage == 3)) { pageNumber--; if (pageNumber < 0){ @@ -591,9 +598,10 @@ void OBP60Task(GwApi *api){ // Provide sundata to all pages commonData.sundata = calcSunsetSunrise(api, time->value , date->value, lat->value, lon->value, tz.toDouble()); // Backlight with sun control - if(String(backlight) == "Control by Sun"){ + if (commonData.backlight.mode == BacklightMode::SUN) { + // if(String(backlight) == "Control by Sun"){ if(commonData.sundata.sunDown == true){ - setBacklightLED(brightness, color); + setBacklightLED(commonData.backlight.brightness, commonData.backlight.color); } else{ setBacklightLED(0, COLOR_BLUE); // Backlight LEDs off (blue without britghness) @@ -658,11 +666,11 @@ void OBP60Task(GwApi *api){ // Show header if enabled getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), commonData.bgcolor); // Clear display if (pages[pageNumber].description && pages[pageNumber].description->header){ - //build some header and footer using commonData - getdisplay().fillScreen(commonData.bgcolor); // Clear display - displayHeader(commonData, date, time, hdop); // Sown header + // build header using commonData + getdisplay().fillScreen(commonData.bgcolor); // Clear display + displayHeader(commonData, date, time, hdop); // Show page header } - + // Call the particular page Page *currentPage=pages[pageNumber].page; if (currentPage == NULL){ @@ -671,12 +679,18 @@ void OBP60Task(GwApi *api){ } else{ if (lastPage != pageNumber){ - currentPage->displayNew(commonData,pages[pageNumber].parameters); + if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember page for device restart + currentPage->setupKeys(); + currentPage->displayNew(pages[pageNumber].parameters); lastPage=pageNumber; } //call the page code LOG_DEBUG(GwLog::DEBUG,"calling page %d",pageNumber); - currentPage->displayPage(commonData,pages[pageNumber].parameters); + // Show footer if enabled (together with header) + if (pages[pageNumber].description && pages[pageNumber].description->header){ + displayFooter(commonData); + } + currentPage->displayPage(pages[pageNumber].parameters); } } } diff --git a/lib/obp60task/platformio.ini.light b/lib/obp60task/platformio.ini.light index d11edcf..6d6ae65 100644 --- a/lib/obp60task/platformio.ini.light +++ b/lib/obp60task/platformio.ini.light @@ -40,7 +40,7 @@ lib_deps = build_flags= #https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL # -D ARDUINO_USB_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device) -# -D ARDUINO_USB_CDC_ON_BOOT=1 #0=JTAG, 1=CDC (serial device) + -D ARDUINO_USB_CDC_ON_BOOT=0 #Serial output via RX/TX # -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device) # -D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC) -D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib diff --git a/webinstall/cibuild.html b/webinstall/cibuild.html index 4f41c1a..78ce76d 100644 --- a/webinstall/cibuild.html +++ b/webinstall/cibuild.html @@ -1,5 +1,5 @@ - + @@ -83,4 +83,4 @@ - \ No newline at end of file + diff --git a/webinstall/cibuild.js b/webinstall/cibuild.js index 26443b0..690da1d 100644 --- a/webinstall/cibuild.js +++ b/webinstall/cibuild.js @@ -867,5 +867,27 @@ class PipelineInfo{ buildSelectors(ROOT_PATH,structure.config.children,true); if (! isRunning()) findPipeline(); updateStatus(); + const translationCheck=()=>{ + const lang = document.documentElement.lang; + if (lang != "en"){ + alert( + "This page will not work correctly with translation enabled" + ); + } + } + // Works at least for Chrome, Firefox, Safari and probably more. Not Microsoft + // Edge though. They're special. + // Yell at clouds if a translator doesn't change it + const observer = new MutationObserver(() => { + translationCheck(); + }); + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ['lang'], + childList: false, + characterData: false, + }); + translationCheck(); + } })(); \ No newline at end of file