diff --git a/Arduino/BTCDieselHeater/src/OLED/DetailedScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/DetailedScreen.cpp index 78c0692..fc6b4d0 100644 --- a/Arduino/BTCDieselHeater/src/OLED/DetailedScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/DetailedScreen.cpp @@ -136,20 +136,20 @@ CDetailedScreen::animate() if(_animatePump) { // erase region of fuel icon - _display.fillRect(X_FUEL_ICON, Y_FUEL_ICON, W_FUEL_ICON, H_FUEL_ICON + 4, BLACK); - _display.drawBitmap(X_FUEL_ICON, Y_FUEL_ICON+(_dripAnimationState/2), FuelIcon, W_FUEL_ICON, H_FUEL_ICON, WHITE); + _display.fillRect(X_FUEL_ICON, Y_FUEL_ICON, FuelIconInfo.width, FuelIconInfo.height + 4, BLACK); + _drawBitmap(X_FUEL_ICON, Y_FUEL_ICON+(_dripAnimationState/2), FuelIconInfo); _dripAnimationState++; _dripAnimationState &= 0x07; } if(_animateRPM) { // erase region of fuel icon - _display.fillRect(X_FAN_ICON, Y_FAN_ICON, W_FAN_ICON, H_FAN_ICON, BLACK); + _display.fillRect(X_FAN_ICON, Y_FAN_ICON, FanIcon1Info.width, FanIcon1Info.height, BLACK); switch(_fanAnimationState) { - case 0: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon1, W_FAN_ICON, H_FAN_ICON, WHITE); break; - case 1: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon2, W_FAN_ICON, H_FAN_ICON, WHITE); break; - case 2: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon3, W_FAN_ICON, H_FAN_ICON, WHITE); break; - case 3: _display.drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon4, W_FAN_ICON, H_FAN_ICON, WHITE); break; + case 0: _drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon1Info); break; + case 1: _drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon2Info); break; + case 2: _drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon3Info); break; + case 3: _drawBitmap(X_FAN_ICON, Y_FAN_ICON, FanIcon4Info); break; } _fanAnimationState++; _fanAnimationState &= 0x03; @@ -157,8 +157,8 @@ CDetailedScreen::animate() if(_animateGlow) { _display.fillRect(X_GLOW_ICON, Y_GLOW_ICON, 17, 10, BLACK); - _display.drawBitmap(X_GLOW_ICON, Y_GLOW_ICON, GlowPlugIcon, 16, 9, WHITE); - _display.drawBitmap(X_GLOW_ICON, Y_GLOW_ICON + 2 + _heatAnimationState, GlowHeatIcon, 17, 2, WHITE); + _drawBitmap(X_GLOW_ICON, Y_GLOW_ICON, GlowPlugIconInfo); + _drawBitmap(X_GLOW_ICON, Y_GLOW_ICON + 2 + _heatAnimationState, GlowHeatIconInfo); _heatAnimationState -= 2; _heatAnimationState &= 0x07; } @@ -264,7 +264,7 @@ CDetailedScreen::showThermometer(float desired, float actual) { char msg[16]; // draw bulb design - _display.drawBitmap(X_BULB, Y_BULB, ambientThermometerIcon, W_BULB_ICON, H_BULB_ICON, WHITE); + _drawBitmap(X_BULB, Y_BULB, AmbientThermometerIconInfo, WHITE); if(actual > 0) { // draw mercury @@ -294,11 +294,11 @@ CDetailedScreen::showThermometer(float desired, float actual) // draw target setting if(desired) { - _display.drawBitmap(X_TARGET_ICON, Y_TARGET_ICON, TargetIcon, W_TARGET_ICON, H_TARGET_ICON, WHITE); // set indicator against bulb + _drawBitmap(X_TARGET_ICON, Y_TARGET_ICON, TargetIconInfo); // set indicator against bulb char msg[16]; if(desired > 0) { int yPos = Y_BULB + TEMP_YPOS(desired) - 2; - _display.drawBitmap(X_BULB-1, yPos, thermoPtr, 3, 5, WHITE); // set indicator against bulb + _drawBitmap(X_BULB-1, yPos, ThermoPtrIconInfo); // set indicator against bulb if(NVstore.getDegFMode()) { desired = desired * 9 / 5 + 32; sprintf(msg, "%.0f`F", desired); @@ -313,7 +313,7 @@ CDetailedScreen::showThermometer(float desired, float actual) #ifdef MINI_TARGETLABEL CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font #endif - _printMenuText(X_TARGET_ICON + (W_TARGET_ICON/2), Y_BASELINE, msg, false, eCentreJustify); + _printMenuText(X_TARGET_ICON + (TargetIconInfo.width/2), Y_BASELINE, msg, false, eCentreJustify); } } @@ -322,7 +322,7 @@ void CDetailedScreen::showBodyThermometer(int actual) { // draw bulb design - _display.drawBitmap(X_BODY_BULB, Y_BULB, bodyThermometerIcon, 8, 50, WHITE); + _drawBitmap(X_BODY_BULB, Y_BULB, BodyThermometerIconInfo); // draw mercury int yPos = Y_BULB + BODY_YPOS(actual); _display.drawLine(X_BODY_BULB + 3, yPos, X_BODY_BULB + 3, Y_BULB + 42, WHITE); @@ -350,15 +350,15 @@ CDetailedScreen::showBodyThermometer(int actual) void CDetailedScreen::showGlowPlug(float power) { - _display.drawBitmap(X_GLOW_ICON, Y_GLOW_ICON, GlowPlugIcon, W_GLOW_ICON, H_GLOW_ICON, WHITE); + _drawBitmap(X_GLOW_ICON, Y_GLOW_ICON, GlowPlugIconInfo); // _animateGlow = true; char msg[16]; sprintf(msg, "%.0fW", power); #ifdef MINI_GLOWLABEL CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font #endif - _printMenuText(X_GLOW_ICON + (W_GLOW_ICON/2), - Y_GLOW_ICON + H_GLOW_ICON + 3, + _printMenuText(X_GLOW_ICON + (GlowPlugIconInfo.width/2), + Y_GLOW_ICON + GlowPlugIconInfo.height + 3, msg, false, eCentreJustify); } @@ -374,7 +374,7 @@ CDetailedScreen::showFan(int RPM) #ifdef MINI_FANLABEL CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font #endif - _printMenuText(X_FAN_ICON + (W_FAN_ICON/2), Y_BASELINE, msg, false, eCentreJustify); + _printMenuText(X_FAN_ICON + (FanIcon1Info.width/2), Y_BASELINE, msg, false, eCentreJustify); } void @@ -389,7 +389,7 @@ CDetailedScreen::showFanV(float volts) #ifdef MINI_FANLABEL CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font #endif - _printMenuText(X_FAN_ICON + (W_FAN_ICON/2), Y_BASELINE, msg, false, eCentreJustify); + _printMenuText(X_FAN_ICON + (FanIcon1Info.width/2), Y_BASELINE, msg, false, eCentreJustify); } void @@ -403,7 +403,7 @@ CDetailedScreen::showFuel(float rate) #ifdef MINI_FUELLABEL CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font #endif - _printMenuText(X_FUEL_ICON + (W_FUEL_ICON/2), Y_BASELINE, msg, false, eCentreJustify); + _printMenuText(X_FUEL_ICON + (FuelIconInfo.width/2), Y_BASELINE, msg, false, eCentreJustify); } } diff --git a/Arduino/BTCDieselHeater/src/OLED/GPIOScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/GPIOScreen.cpp index 0b716d1..20f8513 100644 --- a/Arduino/BTCDieselHeater/src/OLED/GPIOScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/GPIOScreen.cpp @@ -85,10 +85,7 @@ CGPIOScreen::show() } else { _printInverted(_display.xCentre(), 0, " GPIO Settings ", true, eCentreJustify); - _display.drawBitmap(10, 14, GPIOIcon, GPIOWidth, GPIOHeight, WHITE); -// _printMenuText(55, Line3, "Inputs:", false, eRightJustify); -// _printMenuText(55, Line2, "Outputs:", false, eRightJustify); -// _printMenuText(55, Line1, "Analogue:", false, eRightJustify); + _drawBitmap(10, 14, GPIOIconInfo); { const char* msgText = NULL; switch(_GPIOinMode) { @@ -321,11 +318,11 @@ CGPIOInfoScreen::show() _printMenuText(55, Line1, "Analogue:", false, eRightJustify); - _display.drawBitmap(4, 29, GPIOin.getState(0) ? CloseIcon : OpenIcon, CloseIconWidth, CloseIconHeight, WHITE); - _display.drawBitmap(27, 29, GPIOin.getState(1) ? CloseIcon : OpenIcon, CloseIconWidth, CloseIconHeight, WHITE); + _drawBitmap(4, 29, GPIOin.getState(0) ? CloseIconInfo : OpenIconInfo); + _drawBitmap(27, 29, GPIOin.getState(1) ? CloseIconInfo : OpenIconInfo); - _display.drawBitmap(86, 29, GPIOout.getState(0) ? BulbOnIcon : BulbOffIcon, BulbOnIconWidth, BulbOnIconHeight, WHITE); - _display.drawBitmap(113, 29, GPIOout.getState(1) ? BulbOnIcon : BulbOffIcon, BulbOnIconWidth, BulbOnIconHeight, WHITE); + _drawBitmap(86, 29, GPIOout.getState(0) ? BulbOnIconInfo : BulbOffIconInfo); + _drawBitmap(113, 29, GPIOout.getState(1) ? BulbOnIconInfo : BulbOffIconInfo); sprintf(msg, "%d", GPIOalg.getValue()); _printMenuText(58, Line1, msg); diff --git a/Arduino/BTCDieselHeater/src/OLED/HomeMenuSelScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/HomeMenuSelScreen.cpp index 6fa5d81..b1f2a18 100644 --- a/Arduino/BTCDieselHeater/src/OLED/HomeMenuSelScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/HomeMenuSelScreen.cpp @@ -65,7 +65,7 @@ CHomeMenuSelScreen::show() _printInverted(_display.xCentre(), 0, " Home Menu Actions ", true, eCentreJustify); // _printMenuText(66, 14, "On timeout:", false, eRightJustify); - _display.drawBitmap(30, 14, timeoutIcon, timeoutWidth, timeoutHeight, WHITE); + _drawBitmap(30, 14, TimeoutIconInfo); switch(_action.onTimeout) { case 0: strcpy(msg, "Default"); break; case 1: strcpy(msg, "Detailed"); break; @@ -75,7 +75,7 @@ CHomeMenuSelScreen::show() _printMenuText(50, 14, msg, _rowSel == 3); // _printMenuText(66, 26, "On start:", false, eRightJustify); - _display.drawBitmap(32, 26, startIcon, startWidth, startHeight, WHITE); + _drawBitmap(32, 26, StartIconInfo); switch(_action.onStart) { case 0: strcpy(msg, "Default"); break; case 1: strcpy(msg, "Detailed"); break; @@ -85,7 +85,7 @@ CHomeMenuSelScreen::show() _printMenuText(50, 26, msg, _rowSel == 2); // _printMenuText(66, 38, "On stop:", false, eRightJustify); - _display.drawBitmap(31, 38, stopIcon, stopWidth, stopHeight, WHITE); + _drawBitmap(31, 38, StopIconInfo); switch(_action.onStop) { case 0: strcpy(msg, "Default"); break; case 1: strcpy(msg, "Detailed"); break; diff --git a/Arduino/BTCDieselHeater/src/OLED/OtherOptionsScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/OtherOptionsScreen.cpp index 919e921..2d0f46b 100644 --- a/Arduino/BTCDieselHeater/src/OLED/OtherOptionsScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/OtherOptionsScreen.cpp @@ -68,12 +68,12 @@ COtherOptionsScreen::show() _printInverted(_display.xCentre(), 0, " Time Intervals ", true, eCentreJustify); // data frame refresh rate - _display.drawBitmap(15, 13, refreshIcon, refreshWidth, refreshHeight, WHITE); + _drawBitmap(15, 13, RefreshIconInfo); sprintf(msg, "%dms", _frameRate); _printMenuText(40, 14, msg, _rowSel == 3); // display timeout - _display.drawBitmap(10, 26, displayTimeoutIcon, displayTimeoutWidth, displayTimeoutHeight, WHITE); + _drawBitmap(10, 26, DisplayTimeoutIconInfo); if(_dispTimeout) { float mins = float(abs(_dispTimeout)) / 60000.f; sprintf(msg, "%s %0.1f min%s", (_dispTimeout < 0) ? "Blank" : "Dim", mins, mins < 2 ? "" : "s"); @@ -83,7 +83,7 @@ COtherOptionsScreen::show() _printMenuText(40, 26, "Always on", _rowSel == 2); // menu timeout - _display.drawBitmap(10, 38, menuTimeoutIcon, menuTimeoutWidth, menuTimeoutHeight, WHITE); + _drawBitmap(10, 38, MenuTimeoutIconInfo); if(_menuTimeout) { float mins = float(abs(_menuTimeout)) / 60000.f; sprintf(msg, "Home %0.1f min%s", mins, mins < 2 ? "" : "s"); diff --git a/Arduino/BTCDieselHeater/src/OLED/Screen.cpp b/Arduino/BTCDieselHeater/src/OLED/Screen.cpp index a5587ba..cc19abb 100644 --- a/Arduino/BTCDieselHeater/src/OLED/Screen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/Screen.cpp @@ -151,6 +151,13 @@ CScreen::_reqOEMWarning() _showOEMerror = 10; } +void +CScreen::_drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t colour) +{ + _display.drawBitmap(x, y, info.pBitmap, info.width, info.height, colour); +} + + // a class used for temporary alternate fonts usage // Reverts to standard inbuilt font when the instance falls out of scope CTransientFont::CTransientFont(C128x64_OLED& disp, const FONT_INFO* pFont) : diff --git a/Arduino/BTCDieselHeater/src/OLED/Screen.h b/Arduino/BTCDieselHeater/src/OLED/Screen.h index d284b49..245aab9 100644 --- a/Arduino/BTCDieselHeater/src/OLED/Screen.h +++ b/Arduino/BTCDieselHeater/src/OLED/Screen.h @@ -28,6 +28,17 @@ #include "fonts/FontTypes.h" #include "../Utility/UtilClasses.h" +struct BITMAP_INFO { + uint8_t width; + uint8_t height; + const uint8_t* pBitmap; + BITMAP_INFO(uint8_t w, uint8_t h, const uint8_t* pBmp) { + width = w; + height = h; + pBitmap = pBmp; + }; +}; + enum eJUSTIFY { eLeftJustify, eCentreJustify, eRightJustify }; @@ -46,6 +57,7 @@ protected: void _drawMenuSelection(CRect extents, const char* str, int border = 3, int radius = 4); void _scrollMessage(int y, const char* str, int& charOffset); void _reqOEMWarning(); + void _drawBitmap(int x, int y, const BITMAP_INFO& info, uint16_t color = WHITE); public: CScreen(C128x64_OLED& disp, CScreenManager& mgr); virtual ~CScreen(); diff --git a/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp b/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp index 7eea584..eb5f8c6 100644 --- a/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/ScreenHeader.cpp @@ -114,10 +114,10 @@ CScreenHeader::animate() switch(_animateCount) { case 0: case 2: - _display.fillRect(xPos, yPos, W_TIMER_ICON+3, H_TIMER_ICON, BLACK); + _display.fillRect(xPos, yPos, TimerIconInfo.width+3, TimerIconInfo.height, BLACK); break; case 1: - _display.drawBitmap(xPos+6, yPos, updateIcon, updateWidth, updateHeight, WHITE); + _drawBitmap(xPos+6, yPos, UpdateIconInfo); break; default: showTimers(); @@ -127,11 +127,8 @@ CScreenHeader::animate() if((isWifiConnected() || isWifiAP()) && isWebClientConnected()) { - int xPos = X_WIFI_ICON + W_WIFI_ICON; - if(isWifiAP()) { - xPos += 4; - } - + int xPos = X_WIFI_ICON + WifiIconInfo.width; + // UP arrow animation // int yPos = 0; @@ -140,8 +137,8 @@ CScreenHeader::animate() if(NVstore.getOTAEnabled()) _display.fillRect(X_WIFI_ICON +12, Y_WIFI_ICON, 12, 5, BLACK); else - _display.fillRect(xPos, yPos, W_WIFIIN_ICON, H_WIFIIN_ICON, BLACK); - _display.drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, wifiIcon, W_WIFI_ICON, H_WIFI_ICON, WHITE); + _display.fillRect(xPos, yPos, WifiInIconInfo.width, WifiInIconInfo.height, BLACK); + _drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, WifiIconInfo, WHITE); retval = true; _clearUpAnimation = false; } @@ -150,21 +147,21 @@ CScreenHeader::animate() if(NVstore.getOTAEnabled()) _display.fillRect(X_WIFI_ICON +12, Y_WIFI_ICON, 12, 5, BLACK); else - _display.fillRect(xPos, yPos, W_WIFIIN_ICON, H_WIFIIN_ICON, BLACK); - _display.drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, wifiIcon, W_WIFI_ICON, H_WIFI_ICON, WHITE); - _display.drawBitmap(xPos, yPos, wifiOutIcon, W_WIFIIN_ICON, H_WIFIIN_ICON, WHITE); + _display.fillRect(xPos, yPos, WifiInIconInfo.width, WifiInIconInfo.height, BLACK); + _drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, WifiIconInfo, WHITE); + _drawBitmap(xPos, yPos, WifiOutIconInfo); _clearUpAnimation = true; // clear arrow upon next iteration retval = true; } // DOWN arrow animation // - yPos = H_WIFI_ICON - H_WIFIIN_ICON + 1; + yPos = WifiIconInfo.height - WifiInIconInfo.height + 1; if(_clearDnAnimation) { // arrow was drawn in the prior iteration, now erase it _display.fillRect(X_WIFI_ICON + 12, Y_WIFI_ICON + 6, 12, 5, BLACK); // _display.fillRect(xPos, yPos, W_WIFIOUT_ICON, H_WIFIOUT_ICON, BLACK); - _display.drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, wifiIcon, W_WIFI_ICON, H_WIFI_ICON, WHITE); + _drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, WifiIconInfo, WHITE); retval = true; _clearDnAnimation = false; } @@ -172,8 +169,8 @@ CScreenHeader::animate() // we have receievd data from the web client, show an DOWN arrow _display.fillRect(X_WIFI_ICON + 12, Y_WIFI_ICON + 6, 12, 5, BLACK); // _display.fillRect(xPos, yPos, W_WIFIOUT_ICON, H_WIFIOUT_ICON, BLACK); - _display.drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, wifiIcon, W_WIFI_ICON, H_WIFI_ICON, WHITE); - _display.drawBitmap(xPos, yPos, wifiInIcon, W_WIFIOUT_ICON, H_WIFIOUT_ICON, WHITE); + _drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, WifiIconInfo, WHITE); + _drawBitmap(xPos, yPos, WifiInIconInfo, WHITE); _clearDnAnimation = true; // clear arrow upon next iteration retval = true; } @@ -185,7 +182,7 @@ void CScreenHeader::showBTicon() { if(getBluetoothClient().isConnected()) { - _display.drawBitmap(X_BT_ICON, Y_BT_ICON, BTicon, W_BT_ICON, H_BT_ICON, WHITE); + _drawBitmap(X_BT_ICON, Y_BT_ICON, BluetoothIconInfo, WHITE); } } @@ -193,7 +190,7 @@ void CScreenHeader::showWifiIcon() { if(isWifiConnected() || isWifiAP()) { - _display.drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, wifiIcon, W_WIFI_ICON, H_WIFI_ICON, WHITE); + _drawBitmap(X_WIFI_ICON, Y_WIFI_ICON, WifiIconInfo, WHITE); if(isWifiButton()) { _display.fillRect(X_WIFI_ICON + 11, Y_WIFI_ICON + 5, 15, 7, BLACK); CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font @@ -229,19 +226,19 @@ CScreenHeader::showWifiIcon() void CScreenHeader::showBatteryIcon(float voltage) { - _display.drawBitmap(X_BATT_ICON, Y_BATT_ICON, BatteryIcon, W_BATT_ICON, H_BATT_ICON, WHITE); + _drawBitmap(X_BATT_ICON, Y_BATT_ICON, BatteryIconInfo); char msg[16]; sprintf(msg, "%.1fV", voltage); CTransientFont AF(_display, &MINIFONT); // temporarily use a mini font - _display.setCursor(X_BATT_ICON + W_BATT_ICON/2, - Y_BATT_ICON + H_BATT_ICON + 2); + _display.setCursor(X_BATT_ICON + BatteryIconInfo.width/2, + Y_BATT_ICON + BatteryIconInfo.height + 2); _display.printCentreJustified(msg); // nominal 10.5 -> 13.5V bargraph int Capacity = (voltage - 10.7) * 4; if(Capacity < 0) Capacity = 0; if(Capacity > 11) Capacity = 11; - _display.fillRect(X_BATT_ICON+2 + Capacity, Y_BATT_ICON+2, W_BATT_ICON-4-Capacity, 6, BLACK); + _display.fillRect(X_BATT_ICON+2 + Capacity, Y_BATT_ICON+2, BatteryIconInfo.width-4-Capacity, 6, BLACK); } int @@ -250,9 +247,9 @@ CScreenHeader::showTimers() int nextTimer = CTimerManager::getNextTimer(); if(nextTimer) { int xPos = X_TIMER_ICON; - _display.drawBitmap(xPos, Y_TIMER_ICON, largeTimerIcon, W_TIMER_ICON, H_TIMER_ICON, WHITE); + _drawBitmap(xPos, Y_TIMER_ICON, LargeTimerIconInfo); if(nextTimer & 0x80) - _display.drawBitmap(xPos-3, Y_TIMER_ICON, verticalRepeatIcon, verticalRepeatWidthPixels, verticalRepeatHeightPixels, WHITE); + _drawBitmap(xPos-3, Y_TIMER_ICON, VerticalRepeatIconInfo); CTransientFont AF(_display, &miniFontInfo); // temporarily use a mini font if((nextTimer & 0x0f) >= 10) @@ -287,7 +284,7 @@ CScreenHeader::showTime() { CTransientFont AF(_display, &arial_8ptFontInfo); // determine centre position of remaining real estate - int xPos = X_WIFI_ICON + W_WIFI_ICON + W_WIFIIN_ICON; // rhs of wifi conglomeration + int xPos = X_WIFI_ICON + WifiIconInfo.width + WifiInIconInfo.width; // rhs of wifi conglomeration if(isWifiAP()) xPos += 4; // add more if an Access Point _printMenuText(X_CLOCK, Y_CLOCK, msg); diff --git a/Arduino/BTCDieselHeater/src/OLED/ThermostatModeScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/ThermostatModeScreen.cpp index 436255e..75f34ec 100644 --- a/Arduino/BTCDieselHeater/src/OLED/ThermostatModeScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/ThermostatModeScreen.cpp @@ -82,7 +82,7 @@ CThermostatModeScreen::show() } else { _printInverted(_display.xCentre(), 0, " Thermostat Mode ", true, eCentreJustify); - _display.drawBitmap(3, 14, thermostatIcon, thermostatWidth, thermostatHeight, WHITE); + _drawBitmap(3, 14, ThermostatIconInfo); float fTemp = _window; if(NVstore.getDegFMode()) { fTemp = fTemp * 9 / 5; diff --git a/Arduino/BTCDieselHeater/src/OLED/VersionInfoScreen.cpp b/Arduino/BTCDieselHeater/src/OLED/VersionInfoScreen.cpp index c0c4549..4662ea9 100644 --- a/Arduino/BTCDieselHeater/src/OLED/VersionInfoScreen.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/VersionInfoScreen.cpp @@ -83,11 +83,11 @@ CVersionInfoScreen::show() // animation of update available via animate() if firmware update is available on web server _printInverted(_display.xCentre(), 0, " Version Information ", true, eCentreJustify); - _display.drawBitmap(13, 11, firmwareIcon, firmwareWidth, firmwareHeight, WHITE); + _drawBitmap(13, 11, FirmwareIconInfo); _printMenuText(46, 14, getVersionStr()); _printMenuText(46, 25, getVersionDate()); - _display.drawBitmap(23, 34, hardwareIcon, hardwareWidth, hardwareHeight, WHITE); + _drawBitmap(23, 34, HardwareIconInfo); int PCB = getBoardRevision(); sprintf(msg, "V%.1f", float(PCB)*0.1f); _printMenuText(46, 38, msg); @@ -127,7 +127,7 @@ CVersionInfoScreen::show() } else { // factory default apply/abort screens - _display.drawBitmap(10, 15, cautionIcon, cautionWidth, cautionHeight, WHITE); + _drawBitmap(10, 15, CautionIconInfo); _printMenuText(50, 30, "Abort", _rowSel == 2); _printMenuText(50, 16, "Apply", _rowSel == 3); @@ -152,9 +152,9 @@ CVersionInfoScreen::animate() ROLLUPPERLIMIT(_animateCount, 5, 0); int ypos = 11 + 15 - 7 - _animateCount; _display.fillRect(0, 11, 10, 21, BLACK); - _display.drawBitmap(2, ypos, wifiOutIcon, 5, 7, WHITE); // upload arrow - from web to afterburner + _display.drawBitmap(2, ypos, WifiOutIconInfo.pBitmap, WifiOutIconInfo.width, 7, WHITE); // upload arrow - from web to afterburner _display.fillRect(1, 11, 7, 2, WHITE); // top bar - _display.drawBitmap(0, 11+16, wwwIcon, wwwWidth, wwwHeight, WHITE); // www icon + _drawBitmap(0, 11+16, WWWIconInfo); // www icon } return true; } diff --git a/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.cpp b/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.cpp index 21affd1..bc3a320 100644 --- a/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.cpp +++ b/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.cpp @@ -21,39 +21,158 @@ #include #include "Icons.h" +#include "../Screen.h" // 'Thermometer', 8x50px const unsigned char bodyThermometerIcon [] PROGMEM = { - 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, - 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, - 0x24, 0x24, 0x24, 0x24, 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, - 0x7e, 0x3c + 0x00, // + 0x18, // ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x3c, // #### + 0x7e, // ###### + 0xff, // ######## + 0xff, // ######## + 0xff, // ######## + 0x7e, // ###### + 0x3c // #### }; +const BITMAP_INFO BodyThermometerIconInfo(8, 50, bodyThermometerIcon); // 'ThermometerActual', 8x50px const unsigned char ambientThermometerIcon [] PROGMEM = { - 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, - 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, - 0x24, 0x24, 0x24, 0x24, 0x24, 0x26, 0x24, 0x24, 0x24, 0x24, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, - 0x7e, 0x3c + 0x00, // + 0x18, // ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x26, // # ## + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x24, // # # + 0x3c, // #### + 0x7e, // ###### + 0xff, // ######## + 0xff, // ######## + 0xff, // ######## + 0x7e, // ###### + 0x3c // #### }; +const BITMAP_INFO AmbientThermometerIconInfo(8, 50, ambientThermometerIcon); // 'ThermoPtr', 3x5px const unsigned char thermoPtr [] PROGMEM = { - 0x80, 0xc0, 0xe0, 0xc0, 0x80 + 0x80, // # + 0xc0, // ## + 0xe0, // ### + 0xc0, // ## + 0x80 // # }; +const BITMAP_INFO ThermoPtrIconInfo(3, 5, thermoPtr); // 'Bluetooth icon', 6x11px const unsigned char BTicon [] PROGMEM = { - 0x20, 0x30, 0x28, 0xa4, 0x68, 0x30, 0x68, 0xa4, 0x28, 0x30, 0x20, + 0x20, // # + 0x30, // ## + 0x28, // # # + 0xa4, // # # # + 0x68, // ## # + 0x30, // ## + 0x68, // ## # + 0xa4, // # # # + 0x28, // # # + 0x30, // ## + 0x20 // # }; +const BITMAP_INFO BluetoothIconInfo(6, 11, BTicon); // 'wifiIcon', 13x10px const unsigned char wifiIcon [] PROGMEM = { - 0x1f, 0xc0, 0x20, 0x20, 0x40, 0x10, 0x8f, 0x88, 0x10, 0x40, 0x20, 0x20, - 0x07, 0x00, 0x08, 0x80, 0x00, 0x00, 0x02, 0x00 + 0x1f, 0xc0, // ####### + 0x20, 0x20, // # # + 0x40, 0x10, // # # + 0x8f, 0x88, // # ##### # + 0x10, 0x40, // # # + 0x20, 0x20, // # # + 0x07, 0x00, // ### + 0x08, 0x80, // # # + 0x00, 0x00, // + 0x02, 0x00 // # }; +const BITMAP_INFO WifiIconInfo(13, 10, wifiIcon); + // 'wifiInIcon, 5x5px const unsigned char wifiInIcon [] PROGMEM = { @@ -63,6 +182,7 @@ const unsigned char wifiInIcon [] PROGMEM = { 0x70, // ### 0x20 // # }; +const BITMAP_INFO WifiInIconInfo(5, 5, wifiInIcon); // 'wifiOutIcon, 5x5px const unsigned char wifiOutIcon [] PROGMEM = { @@ -74,80 +194,242 @@ const unsigned char wifiOutIcon [] PROGMEM = { 0x70, // ### 0x70 // ### }; +const BITMAP_INFO WifiOutIconInfo(5, 5, wifiOutIcon); // 'BatteryIcon', 15x10px const unsigned char BatteryIcon [] PROGMEM = { - 0x30, 0x18, 0xff, 0xfe, 0x80, 0x02, 0xb6, 0xda, 0xb6, 0xda, 0xb6, 0xda, 0xb6, 0xda, 0xb6, 0xda, - 0x80, 0x02, 0xff, 0xfe + 0x30, 0x18, // ## ## + 0xff, 0xfe, // ############### + 0x80, 0x02, // # # + 0xb6, 0xda, // # ## ## ## ## # + 0xb6, 0xda, // # ## ## ## ## # + 0xb6, 0xda, // # ## ## ## ## # + 0xb6, 0xda, // # ## ## ## ## # + 0xb6, 0xda, // # ## ## ## ## # + 0x80, 0x02, // # # + 0xff, 0xfe // ############### }; +const BITMAP_INFO BatteryIconInfo(15, 10, BatteryIcon); + // 'GlowPlugIcon', 16x9px const unsigned char GlowPlugIcon [] PROGMEM = { - 0x71, 0xc7, 0x0e, 0x38, 0x14, 0x14, 0x12, 0x24, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x0a, 0x28, - 0x0e, 0x38 + 0x71, 0xc7, // ### ### ### + 0x0e, 0x38, // ### ### + 0x14, 0x14, // # # # # + 0x12, 0x24, // # # # # + 0x11, 0x44, // # # # # + 0x11, 0x44, // # # # # + 0x11, 0x44, // # # # # + 0x0a, 0x28, // # # # # + 0x0e, 0x38 // ### ### }; +const BITMAP_INFO GlowPlugIconInfo(16, 9, GlowPlugIcon); + // 'HeatRise', 17x2px const unsigned char GlowHeatIcon [] PROGMEM = { - 0x80, 0x00, 0x80, 0x40, 0x01, 0x00 + 0x80, 0x00, 0x80, // # # + 0x40, 0x01, 0x00 // # # }; +const BITMAP_INFO GlowHeatIconInfo(17, 2, GlowHeatIcon); // 'Fan3_1a', 16x16px const unsigned char FanIcon1 [] PROGMEM = { - 0x03, 0xc0, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x03, 0xc0, 0x07, 0xe0, 0x06, 0x60, - 0x7e, 0x7e, 0x87, 0xe1, 0x87, 0xe1, 0x84, 0x21, 0x84, 0x21, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00 + 0x03, 0xc0, // #### + 0x04, 0x20, // # # + 0x04, 0x20, // # # + 0x04, 0x20, // # # + 0x04, 0x20, // # # + 0x03, 0xc0, // #### + 0x07, 0xe0, // ###### + 0x06, 0x60, // ## ## + 0x7e, 0x7e, // ###### ###### + 0x87, 0xe1, // # ### ### # + 0x87, 0xe1, // # ### ### # + 0x84, 0x21, // # # # # + 0x84, 0x21, // # # # # + 0x78, 0x1e, // #### #### + 0x00, 0x00, + 0x00, 0x00 }; // 'Fan3_2a', 16x16px const unsigned char FanIcon2 [] PROGMEM = { - 0x00, 0x78, 0x00, 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x84, 0x7b, 0xf8, 0x87, 0xe0, 0x86, 0x60, - 0x86, 0x60, 0x87, 0xe0, 0x7b, 0xf8, 0x00, 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x84, 0x00, 0x78 + 0x00, 0x78, // #### + 0x00, 0x84, // # # + 0x00, 0x84, // # # + 0x00, 0x84, // # # + 0x00, 0x84, // # # + 0x7b, 0xf8, // #### ####### + 0x87, 0xe0, // # ###### + 0x86, 0x60, // # ## ## + 0x86, 0x60, // # ## ## + 0x87, 0xe0, // # ###### + 0x7b, 0xf8, // #### ####### + 0x00, 0x84, // # # + 0x00, 0x84, // # # + 0x00, 0x84, // # # + 0x00, 0x84, // # # + 0x00, 0x78, // #### }; // 'Fan3_3a', 16x16px const unsigned char FanIcon3 [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x78, 0x1e, 0x84, 0x21, 0x84, 0x21, 0x87, 0xe1, 0x87, 0xe1, 0x7e, 0x7e, - 0x06, 0x60, 0x07, 0xe0, 0x03, 0xc0, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x03, 0xc0 + 0x00, 0x00, + 0x00, 0x00, + 0x78, 0x1e, // #### #### + 0x84, 0x21, // # # # # + 0x84, 0x21, // # # # # + 0x87, 0xe1, // # ### ### # + 0x87, 0xe1, // # #### ### # + 0x7e, 0x7e, // ###### ###### + 0x06, 0x60, // ## ## + 0x07, 0xe0, // ###### + 0x03, 0xc0, // #### + 0x04, 0x20, // # # + 0x04, 0x20, // # # + 0x04, 0x20, // # # + 0x04, 0x20, // # # + 0x03, 0xc0 // #### }; // 'Fan3_4a', 16x16px const unsigned char FanIcon4 [] PROGMEM = { - 0x1e, 0x00, 0x21, 0x00, 0x21, 0x00, 0x21, 0x00, 0x21, 0x00, 0x1f, 0xde, 0x07, 0xe1, 0x06, 0x61, - 0x06, 0x61, 0x07, 0xe1, 0x1f, 0xde, 0x21, 0x00, 0x21, 0x00, 0x21, 0x00, 0x21, 0x00, 0x1e, 0x00 + 0x1e, 0x00, // #### + 0x21, 0x00, // # # + 0x21, 0x00, // # # + 0x21, 0x00, // # # + 0x21, 0x00, // # # + 0x1f, 0xde, // ####### ##### + 0x07, 0xe1, // ###### # + 0x06, 0x61, // ## ## # + 0x06, 0x61, // ## ## # + 0x07, 0xe1, // ###### # + 0x1f, 0xde, // ####### ##### + 0x21, 0x00, // # # + 0x21, 0x00, // # # + 0x21, 0x00, // # # + 0x21, 0x00, // # # + 0x1e, 0x00 // #### }; +const BITMAP_INFO FanIcon1Info(16, 16, FanIcon1); +const BITMAP_INFO FanIcon2Info(16, 16, FanIcon2); +const BITMAP_INFO FanIcon3Info(16, 16, FanIcon3); +const BITMAP_INFO FanIcon4Info(16, 16, FanIcon4); // 'FuelIcon', 7x12px const unsigned char FuelIcon [] PROGMEM = { - 0x10, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38 + 0x10, // # + 0x10, // # + 0x38, // ### + 0x38, // ### + 0x7c, // ##### + 0x7c, // ##### + 0xfe, // ####### + 0xfe, // ####### + 0xfe, // ####### + 0xfe, // ####### + 0x7c, // ##### + 0x38 // ### }; +const BITMAP_INFO FuelIconInfo(7, 12, FuelIcon); // 'Target', 13x13px const unsigned char TargetIcon [] PROGMEM = { - 0x0f, 0x80, 0x10, 0x40, 0x20, 0x20, 0x47, 0x10, 0x88, 0x88, 0x92, 0x48, 0x97, 0x48, 0x92, 0x48, - 0x88, 0x88, 0x47, 0x10, 0x20, 0x20, 0x10, 0x40, 0x0f, 0x80 + 0x0f, 0x80, // ##### + 0x10, 0x40, // # # + 0x20, 0x20, // # # + 0x47, 0x10, // # ### # + 0x88, 0x88, // # # # # + 0x92, 0x48, // # # # # # + 0x97, 0x48, // # # ### # # + 0x92, 0x48, // # # # # # + 0x88, 0x88, // # # # # + 0x47, 0x10, // # ### # + 0x20, 0x20, // # # + 0x10, 0x40, // # # + 0x0f, 0x80 // ##### }; +const BITMAP_INFO TargetIconInfo(13, 13, TargetIcon); // 'repeat', 15x15px const unsigned char repeatIcon [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x02, 0xf0, 0x04, 0xe0, 0x04, 0xe0, 0x08, 0x98, 0x30, 0x07, 0xc0 + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x02, // # + 0x00, 0x02, // # + 0xf0, 0x04, // #### # + 0xe0, 0x04, // ### # + 0xe0, 0x08, // ### # + 0x98, 0x30, // # # ## + 0x07, 0xc0 // ##### }; +const BITMAP_INFO RepeatIconInfo(15, 15, repeatIcon); // 'timerID1', 15x15px const unsigned char timerID1Icon [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x09, 0x20, 0x11, 0x10, 0x21, 0x08, 0x2d, 0x08, 0x25, 0xe8, - 0x24, 0x08, 0x24, 0x08, 0x10, 0x10, 0x08, 0x20, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, // + 0x00, 0x00, // + 0x07, 0xc0, // ##### + 0x09, 0x20, // # # # + 0x11, 0x10, // # # # + 0x21, 0x08, // # # # + 0x2d, 0x08, // # ## # # + 0x25, 0xe8, // # # #### # + 0x24, 0x08, // # # # + 0x24, 0x08, // # # # + 0x10, 0x10, // # # + 0x08, 0x20, // # # + 0x07, 0xc0, // ##### + 0x00, 0x00, // + 0x00, 0x00 // }; +const BITMAP_INFO TimerId1IconInfo(15, 15, timerID1Icon); // 'timerID2', 15x15px const unsigned char timerID2Icon [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x09, 0x20, 0x11, 0x10, 0x21, 0x08, 0x2d, 0x08, 0x25, 0xe8, - 0x28, 0x08, 0x2c, 0x08, 0x10, 0x10, 0x08, 0x20, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, // + 0x00, 0x00, // + 0x07, 0xc0, // ##### + 0x09, 0x20, // # # # + 0x11, 0x10, // # # # + 0x21, 0x08, // # # # + 0x2d, 0x08, // # ## # # + 0x25, 0xe8, // # # #### # + 0x28, 0x08, // # # # + 0x2c, 0x08, // # ## # + 0x10, 0x10, // # # + 0x08, 0x20, // # # + 0x07, 0xc0, // ##### + 0x00, 0x00, // + 0x00, 0x00 // }; +const BITMAP_INFO TimerId2IconInfo(15, 15, timerID2Icon); // 'timer', 15x15px const unsigned char timerIcon [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x09, 0x20, 0x11, 0x10, 0x21, 0x08, 0x21, 0x08, 0x21, 0xe8, - 0x20, 0x08, 0x20, 0x08, 0x10, 0x10, 0x08, 0x20, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, // + 0x00, 0x00, // + 0x07, 0xc0, // ##### + 0x09, 0x20, // # # # + 0x11, 0x10, // # # # + 0x21, 0x08, // # # # + 0x21, 0x08, // # # # + 0x21, 0x08, // # #### # + 0x20, 0x08, // # # + 0x20, 0x08, // # # + 0x10, 0x10, // # # + 0x08, 0x20, // # # + 0x07, 0xc0, // ##### + 0x00, 0x00, // + 0x00, 0x00 // }; +const BITMAP_INFO TimerIconInfo(15, 15, timerIcon); // 'large timer', 15x15px const unsigned char largeTimerIcon[] PROGMEM = @@ -168,6 +450,7 @@ const unsigned char largeTimerIcon[] PROGMEM = 0x18, 0x30, // ## ## 0x0F, 0xE0, // ####### }; +const BITMAP_INFO LargeTimerIconInfo(15, 15, largeTimerIcon); const uint8_t PROGMEM verticalRepeatIcon [] = { @@ -187,6 +470,7 @@ const uint8_t PROGMEM verticalRepeatIcon [] = 0x20, // # 0x20, // # }; +const BITMAP_INFO VerticalRepeatIconInfo(15, 5, verticalRepeatIcon); const uint8_t PROGMEM GPIO1OFFIcon[] = { @@ -200,6 +484,7 @@ const uint8_t PROGMEM GPIO1OFFIcon[] = 0x41, 0x00, // # # 0x3E, 0x00, // ##### }; +const BITMAP_INFO GPIO1OffIconInfo(9, 9, GPIO1OFFIcon); const uint8_t PROGMEM GPIO1ONIcon[] = { @@ -213,6 +498,7 @@ const uint8_t PROGMEM GPIO1ONIcon[] = 0x7F, 0x00, // ####### 0x3E, 0x00, // ##### }; +const BITMAP_INFO GPIO1OnIconInfo(9, 9, GPIO1ONIcon); const uint8_t PROGMEM GPIO2OFFIcon[] = { @@ -226,6 +512,7 @@ const uint8_t PROGMEM GPIO2OFFIcon[] = 0x41, 0x00, // # # 0x3E, 0x00, // ##### }; +const BITMAP_INFO GPIO2OffIconInfo(9, 9, GPIO2OFFIcon); const uint8_t PROGMEM GPIO2ONIcon[] = { @@ -239,6 +526,7 @@ const uint8_t PROGMEM GPIO2ONIcon[] = 0x7F, 0x00, // ####### 0x3E, 0x00, // ##### }; +const BITMAP_INFO GPIO2OnIconInfo(9, 9, GPIO2ONIcon); const uint8_t PROGMEM CrossIcon[] = { @@ -268,6 +556,7 @@ const uint8_t PROGMEM OpenIcon[] = 0x3A, 0xE0, // ### # ### 0x00, 0x00, // }; +const BITMAP_INFO OpenIconInfo(13, 7, OpenIcon); const uint8_t PROGMEM CloseIcon[] = { @@ -279,6 +568,7 @@ const uint8_t PROGMEM CloseIcon[] = 0x3A, 0xE0, // ### # ### 0x02, 0x00, // # }; +const BITMAP_INFO CloseIconInfo(13, 7, CloseIcon); const uint8_t PROGMEM BulbOnIcon[] = @@ -292,6 +582,7 @@ const uint8_t PROGMEM BulbOnIcon[] = 0x14, 0x00, // # # 0x1C, 0x00, // ### }; +const BITMAP_INFO BulbOnIconInfo(9, 8, BulbOnIcon); const uint8_t PROGMEM BulbOffIcon[] = { @@ -304,6 +595,7 @@ const uint8_t PROGMEM BulbOffIcon[] = 0x14, 0x00, // # # 0x1C, 0x00, // ### }; +const BITMAP_INFO BulbOffIconInfo(9, 8, BulbOffIcon); const uint8_t PROGMEM startIcon[] = @@ -318,6 +610,8 @@ const uint8_t PROGMEM startIcon[] = 0xC0, // ## 0x80, // # }; +const BITMAP_INFO StartIconInfo(5, 9, startIcon); + const uint8_t PROGMEM stopIcon[] = { @@ -330,6 +624,7 @@ const uint8_t PROGMEM stopIcon[] = 0xFC, // ###### 0x00, // }; +const BITMAP_INFO StopIconInfo(6, 8, stopIcon); const uint8_t PROGMEM displayTimeoutIcon[] = { @@ -344,6 +639,7 @@ const uint8_t PROGMEM displayTimeoutIcon[] = 0x3F, 0x80, 0xFE, // ####### ####### 0x00, 0x01, 0xFF, // ######### }; +const BITMAP_INFO DisplayTimeoutIconInfo(24, 10, displayTimeoutIcon); const uint8_t PROGMEM menuTimeoutIcon[] = { @@ -358,6 +654,7 @@ const uint8_t PROGMEM menuTimeoutIcon[] = 0x00, 0x00, 0xFE, // ####### 0x00, 0x01, 0xFF, // ######### }; +const BITMAP_INFO MenuTimeoutIconInfo(24, 10, menuTimeoutIcon); const uint8_t PROGMEM timeoutIcon[] = { @@ -372,6 +669,7 @@ const uint8_t PROGMEM timeoutIcon[] = 0x7F, 0x00, // ####### 0xFF, 0x80, // ######### }; +const BITMAP_INFO TimeoutIconInfo(9, 10, timeoutIcon); const uint8_t PROGMEM refreshIcon[] = { @@ -387,6 +685,7 @@ const uint8_t PROGMEM refreshIcon[] = 0x08, 0x00, // # 0x04, 0x00, // # }; +const BITMAP_INFO RefreshIconInfo(13, 11, refreshIcon); const uint8_t PROGMEM thermostatIcon[] = { @@ -425,6 +724,7 @@ const uint8_t PROGMEM thermostatIcon[] = 0x00, 0x01, 0xB0, 0xC0, // ## ## ## 0x00, 0x00, 0x00, 0x80, // # }; +const BITMAP_INFO ThermostatIconInfo(28, 34, thermostatIcon); const uint8_t PROGMEM GPIOIcon[] = @@ -462,41 +762,8 @@ const uint8_t PROGMEM GPIOIcon[] = 0x01, 0x00, 0x00, // # 0xC3, 0x86, 0x00, // ## ### ## 0x01, 0x80, 0x00, // ## -/* - 0x00, 0x00, // - 0x00, 0x08, // # - 0x00, 0x48, // # # - 0x00, 0x28, // # # - 0x0F, 0xF8, // ######### - 0x00, 0x28, // # # - 0x00, 0x48, // # # - 0x00, 0x08, // # - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - 0x08, 0x00, // # - 0x08, 0x20, // # # - 0x08, 0x10, // # # - 0x0F, 0xF8, // ######### - 0x08, 0x10, // # # - 0x08, 0x20, // # # - 0x08, 0x00, // # - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - 0x00, 0x00, // - 0x08, 0x00, // # - 0x09, 0x00, // # # - 0x05, 0x00, // # # - 0x24, 0x08, // # # # - 0x02, 0x00, // # - 0x02, 0x00, // # - 0x01, 0x00, // # - 0xC3, 0x86, // ## ### ## - 0x01, 0x80, // ## */ }; +const BITMAP_INFO GPIOIconInfo(20, 33, GPIOIcon); const uint8_t PROGMEM firmwareIcon[] = @@ -523,6 +790,7 @@ const uint8_t PROGMEM firmwareIcon[] = 0x80, 0x00, 0x00, 0x40, // # # 0xFF, 0xFF, 0xFF, 0xC0, // ########################## }; +const BITMAP_INFO FirmwareIconInfo(26, 21, firmwareIcon); const uint8_t PROGMEM hardwareIcon[] = @@ -543,6 +811,7 @@ const uint8_t PROGMEM hardwareIcon[] = 0x80, 0x01, // # # 0xFF, 0xFF, // ################ }; +const BITMAP_INFO HardwareIconInfo(16, 15, hardwareIcon); // // Image data for caution @@ -580,6 +849,7 @@ const uint8_t PROGMEM cautionIcon[] = 0x7F, 0xFF, 0xFF, 0xF8, // ############################ 0x3F, 0xFF, 0xFF, 0xF0, // ########################## }; +const BITMAP_INFO CautionIconInfo(30, 29, cautionIcon); // @@ -599,6 +869,7 @@ const uint8_t PROGMEM updateIcon[] = 0xFF, 0x80, // ######### 0xFF, 0x80, // ######### }; +const BITMAP_INFO UpdateIconInfo(9, 10, updateIcon); const uint8_t PROGMEM wwwIcon[] = @@ -613,5 +884,6 @@ const uint8_t PROGMEM wwwIcon[] = 0x61, 0x80, // ## ## 0x3F, 0x00, // ###### }; +const BITMAP_INFO WWWIconInfo(10, 9, wwwIcon); diff --git a/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.h b/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.h index 768ff77..4fc3444 100644 --- a/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.h +++ b/Arduino/BTCDieselHeater/src/OLED/fonts/Icons.h @@ -19,181 +19,107 @@ * */ +struct BITMAP_INFO; + // 'Thermometer', 8x50px -#define W_BULB_ICON 8 -#define H_BULB_ICON 50 -extern const unsigned char ambientThermometerIcon []; -extern const unsigned char bodyThermometerIcon []; +extern const BITMAP_INFO BodyThermometerIconInfo; +extern const BITMAP_INFO AmbientThermometerIconInfo; // 'ThermoPtr', 3x5px -#define W_PTR_ICON 3 -#define H_PTR_ICON 5 -extern const unsigned char thermoPtr []; +extern const BITMAP_INFO ThermoPtrIconInfo; // 'Bluetooth icon', 6x11px -#define W_BT_ICON 6 -#define H_BT_ICON 11 -extern const unsigned char BTicon []; +extern const BITMAP_INFO BluetoothIconInfo; // 'wifiIcon', 13x10px -#define W_WIFI_ICON 13 -#define H_WIFI_ICON 10 -extern const unsigned char wifiIcon []; +extern const BITMAP_INFO WifiIconInfo; // 'wifiInIcon', 5x5px -#define W_WIFIIN_ICON 5 -#define H_WIFIIN_ICON 5 -extern const unsigned char wifiInIcon []; +extern const BITMAP_INFO WifiInIconInfo; // 'wifiOutIcon', 5x5px -#define W_WIFIOUT_ICON 5 -#define H_WIFIOUT_ICON 5 -extern const unsigned char wifiOutIcon []; +extern const BITMAP_INFO WifiOutIconInfo; // 'BatteryIcon', 15x10px -#define W_BATT_ICON 15 -#define H_BATT_ICON 10 -extern const unsigned char BatteryIcon []; +extern const BITMAP_INFO BatteryIconInfo; // 'GlowPlugIcon', 16x9px -#define W_GLOW_ICON 16 -#define H_GLOW_ICON 9 -extern const unsigned char GlowPlugIcon []; +extern const BITMAP_INFO GlowPlugIconInfo; // 'HeatRise', 17x2px -#define W_HEAT_ICON 17 -#define H_HEAT_ICON 2 -extern const unsigned char GlowHeatIcon []; +extern const BITMAP_INFO GlowHeatIconInfo; -#define W_FAN_ICON 16 -#define H_FAN_ICON 16 // 'Fan3_1a', 16x16px -extern const unsigned char FanIcon1 []; // 'Fan3_2a', 16x16px -extern const unsigned char FanIcon2 []; // 'Fan3_3a', 16x16px -extern const unsigned char FanIcon3 []; // 'Fan3_4a', 16x16px -extern const unsigned char FanIcon4 []; +extern const BITMAP_INFO FanIcon1Info; +extern const BITMAP_INFO FanIcon2Info; +extern const BITMAP_INFO FanIcon3Info; +extern const BITMAP_INFO FanIcon4Info; // 'FuelIcon', 7x12px -#define W_FUEL_ICON 7 -#define H_FUEL_ICON 12 -extern const unsigned char FuelIcon []; +extern const BITMAP_INFO FuelIconInfo; // 'Target', 13x13px -#define W_TARGET_ICON 13 -#define H_TARGET_ICON 13 -extern const unsigned char TargetIcon []; +extern const BITMAP_INFO TargetIconInfo; -#define W_TIMER_ICON 15 -#define H_TIMER_ICON 15 -extern const unsigned char repeatIcon []; -extern const unsigned char timerID1Icon []; -extern const unsigned char timerID2Icon []; -extern const unsigned char timerIcon []; -extern const unsigned char largeTimerIcon []; -extern const uint8_t verticalRepeatIcon []; -extern const uint8_t GPIO1OFFIcon[]; -extern const uint8_t GPIO1ONIcon[]; -extern const uint8_t GPIO2OFFIcon[]; -extern const uint8_t GPIO2ONIcon[]; -extern const uint8_t CrossIcon[]; -extern const uint8_t TickIcon[]; -// Bitmap sizes for verticalRepeat -const uint8_t verticalRepeatWidthPixels = 6; -const uint8_t verticalRepeatHeightPixels = 15; +extern const BITMAP_INFO RepeatIconInfo; +extern const BITMAP_INFO TimerId1IconInfo; +extern const BITMAP_INFO TimerId2IconInfo; +extern const BITMAP_INFO TimerIconInfo; +extern const BITMAP_INFO LargeTimerIconInfo; +extern const BITMAP_INFO VerticalRepeatIconInfo; -// Bitmap sizes for GPIOIcons -const uint8_t GPIOIconWidthPixels = 9; -const uint8_t GPIOIconHeightPixels = 9; - -// Bitmap sizes for TickIcons -const uint8_t TickIconWidth = 5; -const uint8_t TickIconHeight = 5; // Bitmap for open -extern const uint8_t OpenIcon[]; -const uint8_t OpenIconWidth = 13; -const uint8_t OpenIconHeight = 7; +extern const BITMAP_INFO OpenIconInfo; // Bitmap for close -extern const uint8_t CloseIcon[]; -const uint8_t CloseIconWidth = 13; -const uint8_t CloseIconHeight = 7; +extern const BITMAP_INFO CloseIconInfo; // Bitmap for BulbOn -extern const uint8_t BulbOnIcon[]; -const uint8_t BulbOnIconWidth = 9; -const uint8_t BulbOnIconHeight = 8; +extern const BITMAP_INFO BulbOnIconInfo; // Bitmap for BulbOff -extern const uint8_t BulbOffIcon[]; -const uint8_t BulbOffIconWidth = 9; -const uint8_t BulbOffIconHeight = 8; +extern const BITMAP_INFO BulbOffIconInfo; // Bitmap for start -extern const uint8_t startIcon[]; -const uint8_t startWidth = 5; -const uint8_t startHeight = 9; +extern const BITMAP_INFO StartIconInfo; // Bitmap sizes for stop -extern const uint8_t stopIcon[]; -const uint8_t stopWidth = 6; -const uint8_t stopHeight = 8; +extern const BITMAP_INFO StopIconInfo; // Bitmap for displayTimeout -extern const uint8_t displayTimeoutIcon[]; -const uint8_t displayTimeoutWidth = 24; -const uint8_t displayTimeoutHeight = 10; +extern const BITMAP_INFO DisplayTimeoutIconInfo; // Bitmap for menuTimeout -extern const uint8_t menuTimeoutIcon[]; -const uint8_t menuTimeoutWidth = 24; -const uint8_t menuTimeoutHeight = 10; +extern const BITMAP_INFO MenuTimeoutIconInfo; // Bitmap for timeout -extern const uint8_t timeoutIcon[]; -const uint8_t timeoutWidth = 9; -const uint8_t timeoutHeight = 10; +extern const BITMAP_INFO TimeoutIconInfo; // Bitmap for refresh -extern const uint8_t refreshIcon[]; -const uint8_t refreshWidth = 13; -const uint8_t refreshHeight = 11; +extern const BITMAP_INFO RefreshIconInfo; // Bitmap for thermostat modes -extern const uint8_t thermostatIcon[]; -const uint8_t thermostatWidth = 28; -const uint8_t thermostatHeight = 34; +extern const BITMAP_INFO ThermostatIconInfo; // Bitmap for gPIO -extern const uint8_t GPIOIcon[]; -const uint8_t GPIOWidth = 20; -const uint8_t GPIOHeight = 33; +extern const BITMAP_INFO GPIOIconInfo; // Bitmap for firmware -extern const uint8_t firmwareIcon[]; -const uint8_t firmwareWidth = 26; -const uint8_t firmwareHeight = 21; +extern const BITMAP_INFO FirmwareIconInfo; // Bitmap for hardware -extern const uint8_t hardwareIcon[]; -const uint8_t hardwareWidth = 16; -const uint8_t hardwareHeight = 15; +extern const BITMAP_INFO HardwareIconInfo; // Bitmap for caution -extern const uint8_t cautionIcon[]; -const uint8_t cautionWidth = 30; -const uint8_t cautionHeight = 29; +extern const BITMAP_INFO CautionIconInfo; // Bitmap sizes for update -extern const uint8_t updateIcon[]; -const uint8_t updateWidth = 9; -const uint8_t updateHeight = 10; +extern const BITMAP_INFO UpdateIconInfo; // Bitmap sizes for www -extern const uint8_t wwwIcon[]; -const uint8_t wwwWidth = 10; -const uint8_t wwwHeight = 9; +extern const BITMAP_INFO WWWIconInfo; diff --git a/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp b/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp index dc6fb0e..5a1a950 100644 --- a/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp +++ b/Arduino/BTCDieselHeater/src/Utility/BTC_JSON.cpp @@ -147,10 +147,8 @@ void interpretJsonCommand(char* pLine) else if(strcmp("TimerConflict", it->key) == 0) { validateTimer(it->value.as()); } - else if(strcmp("TimerRefresh", it->key) == 0) { - TimerModerator.reset(); - } - else if(strcmp("TQuery", it->key) == 0) { + // request specific timer refresh + else if((strcmp("TQuery", it->key) == 0) || (strcmp("TimerRefresh", it->key) == 0) ) { int timerID = it->value.as(); if(timerID) TimerModerator.reset(timerID-1);