Migrate Remainder

This commit is contained in:
Ben V. Brown
2024-02-28 18:57:09 +11:00
parent 9ff4805068
commit d4c1805e3c
11 changed files with 238 additions and 250 deletions

View File

@@ -0,0 +1,56 @@
#include "ui_drawing.hpp"
void ui_draw_soldering_profile_advanced(TemperatureType_t tipTemp, TemperatureType_t profileCurrentTargetTemp, uint32_t phaseElapsedSeconds, uint32_t phase,const uint32_t phaseTimeGoal) {
// print temperature
if (OLED::getRotation()) {
OLED::setCursor(48, 0);
} else {
OLED::setCursor(0, 0);
}
OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
OLED::print(SmallSymbolSlash, FontStyle::SMALL);
OLED::printNumber(profileCurrentTargetTemp, 3, FontStyle::SMALL);
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
} else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
// print phase
if (phase > 0 && phase <= getSettingValue(SettingsOptions::ProfilePhases)) {
if (OLED::getRotation()) {
OLED::setCursor(36, 0);
} else {
OLED::setCursor(55, 0);
}
OLED::printNumber(phase, 1, FontStyle::SMALL);
}
// print time progress / preheat / cooldown
if (OLED::getRotation()) {
OLED::setCursor(42, 8);
} else {
OLED::setCursor(0, 8);
}
if (phase == 0) {
OLED::print(translatedString(Tr->ProfilePreheatString), FontStyle::SMALL);
} else if (phase > getSettingValue(SettingsOptions::ProfilePhases)) {
OLED::print(translatedString(Tr->ProfileCooldownString), FontStyle::SMALL);
} else {
OLED::printNumber(phaseElapsedSeconds / 60, 1, FontStyle::SMALL);
OLED::print(SmallSymbolColon, FontStyle::SMALL);
OLED::printNumber(phaseElapsedSeconds % 60, 2, FontStyle::SMALL, false);
OLED::print(SmallSymbolSlash, FontStyle::SMALL);
// blink if we can't keep up with the time goal
if (phaseElapsedSeconds < phaseTimeGoal + 2 || (xTaskGetTickCount() / TICKS_SECOND) % 2 == 0) {
OLED::printNumber(phaseTimeGoal / 60, 1, FontStyle::SMALL);
OLED::print(SmallSymbolColon, FontStyle::SMALL);
OLED::printNumber(phaseTimeGoal % 60, 2, FontStyle::SMALL, false);
}
}
}

View File

@@ -1,7 +1,42 @@
#include "power.hpp"
#include "ui_drawing.hpp"
#include <OperatingModes.h>
void ui_draw_soldering_power_status(bool boost_mode_on) {
if (OLED::getRotation()) {
OLED::setCursor(50, 0);
} else {
OLED::setCursor(-1, 0);
}
ui_draw_tip_temperature(true, FontStyle::LARGE);
if (boost_mode_on) { // Boost mode is on
if (OLED::getRotation()) {
OLED::setCursor(34, 0);
} else {
OLED::setCursor(50, 0);
}
OLED::print(LargeSymbolPlus, FontStyle::LARGE);
} else {
#ifndef NO_SLEEP_MODE
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
if (OLED::getRotation()) {
OLED::setCursor(32, 0);
} else {
OLED::setCursor(47, 0);
}
printCountdownUntilSleep(getSleepTimeout());
}
#endif
if (OLED::getRotation()) {
OLED::setCursor(32, 8);
} else {
OLED::setCursor(47, 8);
}
OLED::print(PowerSourceNames[getPowerSourceNumber()], FontStyle::SMALL, 2);
}
void ui_draw_soldering_power_status(void) {
if (OLED::getRotation()) {
OLED::setCursor(0, 0);
} else {

View File

@@ -0,0 +1,21 @@
#include "ui_drawing.hpp"
void ui_draw_temperature_change(void) {
OLED::setCursor(0, 0);
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE);
} else {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE);
}
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::LARGE);
OLED::printSymbolDeg(FontStyle::EXTRAS);
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE);
} else {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE);
}
}

View File

@@ -0,0 +1,43 @@
#include "ui_drawing.hpp"
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)
OLED::print(SmallSymbolPDDebug, FontStyle::SMALL); // Print Title
OLED::setCursor(0, 8); // second line
// Print the PD state machine
OLED::print(SmallSymbolState, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
OLED::printNumber(stateNumber, 2, FontStyle::SMALL, true);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
if (vbus_sense_state == 2) {
OLED::print(SmallSymbolNoVBus, FontStyle::SMALL);
} else if (vbus_sense_state == 1) {
OLED::print(SmallSymbolVBus, FontStyle::SMALL);
}
}
void ui_draw_usb_pd_debug_pdo(const uint8_t entry_num, const uint16_t min_voltage, const uint16_t max_voltage, const uint16_t current_a_x100, const uint16_t wattage) {
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
OLED::print(SmallSymbolPDDebug, FontStyle::SMALL); // Print Title
OLED::setCursor(0, 8); // second line
OLED::printNumber(entry_num, 2, FontStyle::SMALL, true); // print the entry number
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
if (min_voltage > 0) {
OLED::printNumber(min_voltage, 2, FontStyle::SMALL, true); // print the voltage
OLED::print(SmallSymbolMinus, FontStyle::SMALL);
}
OLED::printNumber(max_voltage, 2, FontStyle::SMALL, true); // print the voltage
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
if (wattage) {
OLED::printNumber(wattage, 3, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SmallSymbolWatts, FontStyle::SMALL);
} else {
OLED::printNumber(current_a_x100 / 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, false); // print the current in 0.1A res
OLED::print(SmallSymbolAmps, FontStyle::SMALL);
}
}

View File

@@ -17,10 +17,17 @@ void ui_draw_homescreen_detailed(TemperatureType_t tipTemp); // Drawing the
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp); // Drawing the home screen -- Simple mode
void ui_pre_render_assets(void); // If any assets need to be pre-rendered into ram
// Soldering mode
void ui_draw_soldering_power_status(void);
void ui_draw_soldering_power_status(bool boost_mode_on);
void ui_draw_soldering_basic_status(bool boostModeOn);
void ui_draw_soldering_detailed_sleep(TemperatureType_t tipTemp);
void ui_draw_soldering_basic_sleep(TemperatureType_t tipTemp);
void ui_draw_soldering_profile_advanced(TemperatureType_t tipTemp, TemperatureType_t profileCurrentTargetTemp, uint32_t phaseElapsedSeconds, uint32_t phase,const uint32_t phaseTimeGoal);
//Temp change
void ui_draw_temperature_change(void);
//USB-PD debug
void ui_draw_usb_pd_debug_state(const uint16_t vbus_sense_state, const uint8_t stateNumber) ;
void ui_draw_usb_pd_debug_pdo(const uint8_t entry_num, const uint16_t min_voltage, const uint16_t max_voltage, const uint16_t current_a_x100, const uint16_t wattage) ;
// Utils
void printVoltage(void);
#endif // UI_DRAWING_UI_DRAWING_HPP_