From 976d90cbadcf2c597dbe4e40b7aa8e67ef6e72d9 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Wed, 20 Mar 2024 20:52:55 +1100 Subject: [PATCH] Mask drawing for 96x16 --- source/Core/BSP/MHP30/configuration.h | 2 +- source/Core/BSP/Miniware/configuration.h | 1 + source/Core/BSP/Pinecil/configuration.h | 13 +++++++------ source/Core/BSP/Pinecilv2/configuration.h | 1 + .../UI/drawing/mono_96x16/draw_cjc_sampling.cpp | 4 +++- .../UI/drawing/mono_96x16/draw_debug_menu.cpp | 4 +++- .../drawing/mono_96x16/draw_homescreen_detailed.cpp | 4 +++- .../mono_96x16/draw_homescreen_simplified.cpp | 3 +++ .../drawing/mono_96x16/draw_power_source_icon.cpp | 3 +++ .../UI/drawing/mono_96x16/draw_profile_advanced.cpp | 3 +++ .../mono_96x16/draw_soldering_basic_status.cpp | 2 ++ .../mono_96x16/draw_soldering_power_status.cpp | 4 +++- .../mono_96x16/draw_soldering_sleep_mode.cpp | 4 +++- .../drawing/mono_96x16/draw_temperature_change.cpp | 4 +++- .../UI/drawing/mono_96x16/draw_tip_temperature.cpp | 2 ++ .../UI/drawing/mono_96x16/draw_usb_pd_debug.cpp | 4 +++- .../mono_96x16/draw_warning_undervoltage.cpp | 5 +++-- .../UI/drawing/mono_96x16/pre_render_assets.cpp | 4 +++- .../UI/drawing/mono_96x16/printSleepCountdown.cpp | 2 ++ .../Threads/UI/drawing/mono_96x16/print_voltage.cpp | 2 ++ .../Threads/UI/drawing/mono_96x16/show_warning.cpp | 2 ++ 21 files changed, 56 insertions(+), 17 deletions(-) diff --git a/source/Core/BSP/MHP30/configuration.h b/source/Core/BSP/MHP30/configuration.h index 6cefa404..4930139c 100644 --- a/source/Core/BSP/MHP30/configuration.h +++ b/source/Core/BSP/MHP30/configuration.h @@ -151,7 +151,7 @@ #define ACCEL_MSA #define PROFILE_SUPPORT - +#define OLED_96x16 1 #define POW_PD 1 #define POW_PD_EXT 0 #define USB_PD_EPR_WATTAGE 0 /*No EPR*/ diff --git a/source/Core/BSP/Miniware/configuration.h b/source/Core/BSP/Miniware/configuration.h index 91923dfa..95c0814d 100644 --- a/source/Core/BSP/Miniware/configuration.h +++ b/source/Core/BSP/Miniware/configuration.h @@ -276,6 +276,7 @@ #else #define FLASH_LOGOADDR (0x08000000 + (62 * 1024)) #define SETTINGS_START_PAGE (0x08000000 + (63 * 1024)) +#define OLED_96x16 1 #endif /* TS101 */ #endif /* CONFIGURATION_H_ */ diff --git a/source/Core/BSP/Pinecil/configuration.h b/source/Core/BSP/Pinecil/configuration.h index 7eaf9027..eb035163 100644 --- a/source/Core/BSP/Pinecil/configuration.h +++ b/source/Core/BSP/Pinecil/configuration.h @@ -145,14 +145,15 @@ #define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F +#define OLED_96x16 1 #define POW_PD 1 #define USB_PD_EPR_WATTAGE 0 /*No EPR (Yet?) */ -#define POW_PD_EXT 0 -#define POW_QC 1 -#define POW_DC 1 -#define POW_QC_20V 1 -#define ENABLE_QC2 1 -#define MAG_SLEEP_SUPPORT 1 +#define POW_PD_EXT 0 +#define POW_QC 1 +#define POW_DC 1 +#define POW_QC_20V 1 +#define ENABLE_QC2 1 +#define MAG_SLEEP_SUPPORT 1 #define TEMP_TMP36 #define ACCEL_BMA #define ACCEL_SC7 diff --git a/source/Core/BSP/Pinecilv2/configuration.h b/source/Core/BSP/Pinecilv2/configuration.h index e00839be..24f3da45 100644 --- a/source/Core/BSP/Pinecilv2/configuration.h +++ b/source/Core/BSP/Pinecilv2/configuration.h @@ -155,6 +155,7 @@ #define ENABLE_QC2 1 #define MAG_SLEEP_SUPPORT 1 #define DEVICE_HAS_VALIDATION_SUPPORT +#define OLED_96x16 1 #define TEMP_NTC #define ACCEL_BMA #define CUSTOM_MAX_TEMP_C 1 // Uses custom max temp lookup diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_cjc_sampling.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_cjc_sampling.cpp index f9c8de69..f795945a 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_cjc_sampling.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_cjc_sampling.cpp @@ -1,5 +1,6 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_cjc_sampling(const uint8_t num_dots) { OLED::setCursor(0, 0); OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL); @@ -8,4 +9,5 @@ void ui_draw_cjc_sampling(const uint8_t num_dots) { for (uint8_t x = 0; x < num_dots; x++) { OLED::print(SmallSymbolDot, FontStyle::SMALL); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_debug_menu.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_debug_menu.cpp index 05f1bdeb..3b5ec322 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_debug_menu.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_debug_menu.cpp @@ -2,6 +2,7 @@ #include "TipThermoModel.h" #include "main.hpp" #include "ui_drawing.hpp" +#ifdef OLED_96x16 extern osThreadId GUITaskHandle; extern osThreadId MOVTaskHandle; extern osThreadId PIDTaskHandle; @@ -89,4 +90,5 @@ void ui_draw_debug_menu(const uint8_t item_number) { default: break; } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_detailed.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_detailed.cpp index ec0bf8f7..62c4a40f 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_detailed.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_detailed.cpp @@ -1,4 +1,5 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 extern uint8_t buttonAF[sizeof(buttonA)]; extern uint8_t buttonBF[sizeof(buttonB)]; @@ -52,4 +53,5 @@ void ui_draw_homescreen_detailed(TemperatureType_t tipTemp) { printVoltage(); // draw voltage then symbol (v) OLED::print(SmallSymbolVolts, FontStyle::SMALL); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_simplified.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_simplified.cpp index 3e4733c5..0376c131 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_simplified.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_homescreen_simplified.cpp @@ -1,5 +1,6 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 extern uint8_t buttonAF[sizeof(buttonA)]; extern uint8_t buttonBF[sizeof(buttonB)]; extern uint8_t disconnectedTipF[sizeof(disconnectedTip)]; @@ -57,3 +58,5 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) { } } } + +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_power_source_icon.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_power_source_icon.cpp index fd7e07a0..427dd58c 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_power_source_icon.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_power_source_icon.cpp @@ -1,4 +1,5 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_power_source_icon(void) { #if defined(POW_PD) || defined(POW_QC) || defined(POW_PD_EXT) @@ -44,3 +45,5 @@ void ui_draw_power_source_icon(void) { } #endif } + +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_profile_advanced.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_profile_advanced.cpp index 1b6085e8..f3f3e53f 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_profile_advanced.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_profile_advanced.cpp @@ -1,4 +1,5 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_soldering_profile_advanced(TemperatureType_t tipTemp, TemperatureType_t profileCurrentTargetTemp, uint32_t phaseElapsedSeconds, uint32_t phase, const uint32_t phaseTimeGoal) { // print temperature @@ -54,3 +55,5 @@ void ui_draw_soldering_profile_advanced(TemperatureType_t tipTemp, TemperatureTy } } } + +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_basic_status.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_basic_status.cpp index 1f29acfe..1482bf7d 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_basic_status.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_basic_status.cpp @@ -1,5 +1,6 @@ #include "power.hpp" #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_soldering_basic_status(bool boostModeOn) { OLED::setCursor(0, 0); @@ -40,3 +41,4 @@ void ui_draw_soldering_basic_status(bool boostModeOn) { ui_draw_power_source_icon(); } } +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_power_status.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_power_status.cpp index 416ccd76..f225d37d 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_power_status.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_power_status.cpp @@ -1,6 +1,7 @@ #include "power.hpp" #include "ui_drawing.hpp" #include +#ifdef OLED_96x16 void ui_draw_soldering_power_status(bool boost_mode_on) { if (OLED::getRotation()) { @@ -64,4 +65,5 @@ void ui_draw_soldering_power_status(bool boost_mode_on) { } printVoltage(); OLED::print(SmallSymbolVolts, FontStyle::SMALL); -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_sleep_mode.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_sleep_mode.cpp index f2c02660..90f35352 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_sleep_mode.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_soldering_sleep_mode.cpp @@ -1,4 +1,5 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_soldering_detailed_sleep(TemperatureType_t tipTemp) { @@ -31,4 +32,5 @@ void ui_draw_soldering_basic_sleep(TemperatureType_t tipTemp) { OLED::printSymbolDeg(FontStyle::EXTRAS); OLED::refresh(); -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_temperature_change.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_temperature_change.cpp index 0427408f..48475bc1 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_temperature_change.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_temperature_change.cpp @@ -1,4 +1,5 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_temperature_change(void) { @@ -18,4 +19,5 @@ void ui_draw_temperature_change(void) { } else { OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_tip_temperature.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_tip_temperature.cpp index f9e8b794..2f2de83d 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_tip_temperature.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_tip_temperature.cpp @@ -2,6 +2,7 @@ #include "OperatingModes.h" #include "SolderingCommon.h" #include "TipThermoModel.h" +#ifdef OLED_96x16 void ui_draw_tip_temperature(bool symbol, const FontStyle font) { // Draw tip temp handling unit conversion & tolerance near setpoint @@ -13,3 +14,4 @@ void ui_draw_tip_temperature(bool symbol, const FontStyle font) { OLED::printSymbolDeg(font == FontStyle::LARGE ? FontStyle::EXTRAS : font); } } +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_usb_pd_debug.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_usb_pd_debug.cpp index 5888cca0..d6bb24c4 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_usb_pd_debug.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_usb_pd_debug.cpp @@ -1,4 +1,5 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_usb_pd_debug_state(const uint16_t vbus_sense_state, const uint8_t stateNumber) { OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left) @@ -40,4 +41,5 @@ void ui_draw_usb_pd_debug_pdo(const uint8_t entry_num, const uint16_t min_voltag OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, false); // print the current in 0.1A res OLED::print(SmallSymbolAmps, FontStyle::SMALL); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/draw_warning_undervoltage.cpp b/source/Core/Threads/UI/drawing/mono_96x16/draw_warning_undervoltage.cpp index acbad78c..aaeb3858 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/draw_warning_undervoltage.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/draw_warning_undervoltage.cpp @@ -1,5 +1,5 @@ - #include "ui_drawing.hpp" +#ifdef OLED_96x16 void ui_draw_warning_undervoltage(void) { OLED::clearScreen(); @@ -17,4 +17,5 @@ void ui_draw_warning_undervoltage(void) { OLED::refresh(); GUIDelay(); waitForButtonPress(); -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/pre_render_assets.cpp b/source/Core/Threads/UI/drawing/mono_96x16/pre_render_assets.cpp index cb41abd2..8e630b6f 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/pre_render_assets.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/pre_render_assets.cpp @@ -1,5 +1,6 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 uint8_t buttonAF[sizeof(buttonA)]; uint8_t buttonBF[sizeof(buttonB)]; uint8_t disconnectedTipF[sizeof(disconnectedTip)]; @@ -14,4 +15,5 @@ void ui_pre_render_assets(void) { disconnectedTipF[(row * 42) + x] = disconnectedTip[(row * 42) + (41 - x)]; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/printSleepCountdown.cpp b/source/Core/Threads/UI/drawing/mono_96x16/printSleepCountdown.cpp index a6b072a7..ee9dd4fd 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/printSleepCountdown.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/printSleepCountdown.cpp @@ -1,5 +1,6 @@ #include "Buttons.hpp" #include "OperatingModeUtilities.h" +#ifdef OLED_96x16 extern TickType_t lastMovementTime; #ifndef NO_SLEEP_MODE void printCountdownUntilSleep(int sleepThres) { @@ -18,3 +19,4 @@ void printCountdownUntilSleep(int sleepThres) { } } #endif +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/print_voltage.cpp b/source/Core/Threads/UI/drawing/mono_96x16/print_voltage.cpp index 5b7d9605..5609feaf 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/print_voltage.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/print_voltage.cpp @@ -1,8 +1,10 @@ #include "ui_drawing.hpp" +#ifdef OLED_96x16 void printVoltage(void) { uint32_t volt = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0); OLED::printNumber(volt / 10, 2, FontStyle::SMALL); OLED::print(SmallSymbolDot, FontStyle::SMALL); OLED::printNumber(volt % 10, 1, FontStyle::SMALL); } +#endif \ No newline at end of file diff --git a/source/Core/Threads/UI/drawing/mono_96x16/show_warning.cpp b/source/Core/Threads/UI/drawing/mono_96x16/show_warning.cpp index 3a33d415..6f91b905 100644 --- a/source/Core/Threads/UI/drawing/mono_96x16/show_warning.cpp +++ b/source/Core/Threads/UI/drawing/mono_96x16/show_warning.cpp @@ -1,6 +1,7 @@ #include "Buttons.hpp" #include "OperatingModeUtilities.h" #include "OperatingModes.h" +#ifdef OLED_96x16 bool warnUser(const char *warning, const ButtonState buttons) { OLED::clearScreen(); OLED::printWholeScreen(warning); @@ -10,3 +11,4 @@ bool warnUser(const char *warning, const ButtonState buttons) { } return buttons != BUTTON_NONE; } +#endif \ No newline at end of file