mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Migrating
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
#include "OperatingModeUtilities.h"
|
||||
#include "OperatingModes.h"
|
||||
#include "SolderingCommon.h"
|
||||
#include "TipThermoModel.h"
|
||||
|
||||
void gui_drawTipTemp(bool symbol, const FontStyle font) {
|
||||
// Draw tip temp handling unit conversion & tolerance near setpoint
|
||||
TemperatureType_t Temp = getTipTemp();
|
||||
|
||||
OLED::printNumber(Temp, 3, font); // Draw the tip temp out
|
||||
if (symbol) {
|
||||
// For big font, can draw nice symbols, otherwise fall back to chars
|
||||
OLED::printSymbolDeg(font == FontStyle::LARGE ? FontStyle::EXTRAS : font);
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,13 @@
|
||||
#include "OLED.hpp"
|
||||
#include <stdbool.h>
|
||||
|
||||
void GUIDelay(); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint32_t getSleepTimeout(void); //
|
||||
bool shouldBeSleeping(); //
|
||||
bool shouldShutdown(void); //
|
||||
void gui_drawTipTemp(bool symbol, const FontStyle font); //
|
||||
void printVoltage(void); //
|
||||
bool warnUser(const char *warning, const ButtonState buttons); //
|
||||
void gui_drawBatteryIcon(void); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint16_t min(uint16_t a, uint16_t b); //
|
||||
void printCountdownUntilSleep(int sleepThres); //
|
||||
void GUIDelay(); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint32_t getSleepTimeout(void); //
|
||||
bool shouldBeSleeping(); //
|
||||
bool shouldShutdown(void); //
|
||||
void printVoltage(void); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint16_t min(uint16_t a, uint16_t b); //
|
||||
void printCountdownUntilSleep(int sleepThres); //
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
#include "OperatingModeUtilities.h"
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include "Buttons.hpp"
|
||||
#include "OperatingModeUtilities.h"
|
||||
#include "OperatingModes.h"
|
||||
bool warnUser(const char *warning, const ButtonState buttons) {
|
||||
OLED::clearScreen();
|
||||
OLED::printWholeScreen(warning);
|
||||
// Also timeout after 5 seconds
|
||||
if ((xTaskGetTickCount() - lastButtonTime) > TICKS_SECOND * 5) {
|
||||
return true;
|
||||
}
|
||||
return buttons != BUTTON_NONE;
|
||||
}
|
||||
@@ -7,79 +7,10 @@
|
||||
#include "Types.h"
|
||||
#include "configuration.h"
|
||||
#include "history.hpp"
|
||||
#include "ui_drawing.hpp"
|
||||
|
||||
extern bool heaterThermalRunaway;
|
||||
|
||||
void detailedPowerStatus() {
|
||||
if (OLED::getRotation()) {
|
||||
OLED::setCursor(0, 0);
|
||||
} else {
|
||||
OLED::setCursor(67, 0);
|
||||
}
|
||||
// Print wattage
|
||||
{
|
||||
uint32_t x10Watt = x10WattHistory.average();
|
||||
if (x10Watt > 999) {
|
||||
// If we exceed 99.9W we drop the decimal place to keep it all fitting
|
||||
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
|
||||
OLED::printNumber(x10WattHistory.average() / 10, 3, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL);
|
||||
OLED::print(SmallSymbolDot, FontStyle::SMALL);
|
||||
OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL);
|
||||
}
|
||||
OLED::print(SmallSymbolWatts, FontStyle::SMALL);
|
||||
}
|
||||
|
||||
if (OLED::getRotation()) {
|
||||
OLED::setCursor(0, 8);
|
||||
} else {
|
||||
OLED::setCursor(67, 8);
|
||||
}
|
||||
printVoltage();
|
||||
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
|
||||
}
|
||||
|
||||
void basicSolderingStatus(bool boostModeOn) {
|
||||
OLED::setCursor(0, 0);
|
||||
// We switch the layout direction depending on the orientation of the oled
|
||||
if (OLED::getRotation()) {
|
||||
// battery
|
||||
gui_drawBatteryIcon();
|
||||
// Space out gap between battery <-> temp
|
||||
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
|
||||
// Draw current tip temp
|
||||
gui_drawTipTemp(true, FontStyle::LARGE);
|
||||
|
||||
// We draw boost arrow if boosting,
|
||||
// or else gap temp <-> heat indicator
|
||||
if (boostModeOn) {
|
||||
OLED::drawSymbol(2);
|
||||
} else {
|
||||
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
|
||||
}
|
||||
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
|
||||
} else {
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
|
||||
// We draw boost arrow if boosting,
|
||||
// or else gap temp <-> heat indicator
|
||||
if (boostModeOn) {
|
||||
OLED::drawSymbol(2);
|
||||
} else {
|
||||
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
|
||||
}
|
||||
// Draw current tip temp
|
||||
gui_drawTipTemp(true, FontStyle::LARGE);
|
||||
// Space out gap between battery <-> temp
|
||||
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
|
||||
|
||||
gui_drawBatteryIcon();
|
||||
}
|
||||
}
|
||||
|
||||
bool checkExitSoldering(void) {
|
||||
#ifdef POW_DC
|
||||
// Undervoltage test
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#ifndef SOLDERING_COMMON_H_
|
||||
#define SOLDERING_COMMON_H_
|
||||
|
||||
void detailedPowerStatus();
|
||||
void basicSolderingStatus(bool boostModeOn);
|
||||
bool checkExitSoldering();
|
||||
TemperatureType_t getTipTemp(void);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Buttons.hpp"
|
||||
#include "OperatingModeUtilities.h"
|
||||
#include "configuration.h"
|
||||
#include "ui_drawing.hpp"
|
||||
#ifdef POW_DC
|
||||
extern volatile TemperatureType_t currentTempTargetDegC;
|
||||
// returns true if undervoltage has occured
|
||||
@@ -15,21 +16,7 @@ bool checkForUnderVoltage(void) {
|
||||
if (xTaskGetTickCount() > (TICKS_SECOND * 2)) {
|
||||
if ((v < lookupVoltageLevel())) {
|
||||
currentTempTargetDegC = 0;
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
if (getSettingValue(SettingsOptions::DetailedSoldering)) {
|
||||
OLED::print(translatedString(Tr->UndervoltageString), FontStyle::SMALL);
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(translatedString(Tr->InputVoltageString), FontStyle::SMALL);
|
||||
printVoltage();
|
||||
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::print(translatedString(Tr->UVLOWarningString), FontStyle::LARGE);
|
||||
}
|
||||
|
||||
OLED::refresh();
|
||||
GUIDelay();
|
||||
waitForButtonPress();
|
||||
ui_draw_warning_undervoltage();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "OperatingModeUtilities.h"
|
||||
|
||||
void gui_drawBatteryIcon(void) {
|
||||
#if defined(POW_PD) || defined(POW_QC) || defined(POW_PD_EXT)
|
||||
if (!getIsPoweredByDCIN()) {
|
||||
// On non-DC inputs we replace this symbol with the voltage we are operating on
|
||||
// If <9V then show single digit, if not show dual small ones vertically stacked
|
||||
uint16_t V = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
|
||||
if (V % 10 >= 5) {
|
||||
V = (V / 10) + 1; // round up
|
||||
} else {
|
||||
V = V / 10;
|
||||
}
|
||||
if (V > 9) {
|
||||
int16_t xPos = OLED::getCursorX();
|
||||
OLED::printNumber(V / 10, 1, FontStyle::SMALL);
|
||||
OLED::setCursor(xPos, 8);
|
||||
OLED::printNumber(V % 10, 1, FontStyle::SMALL);
|
||||
OLED::setCursor(xPos + 12, 0); // need to reset this as if we drew a wide char
|
||||
} else {
|
||||
OLED::printNumber(V, 1, FontStyle::LARGE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef POW_DC
|
||||
if (getSettingValue(SettingsOptions::MinDCVoltageCells)) {
|
||||
// User is on a lithium battery
|
||||
// we need to calculate which of the 10 levels they are on
|
||||
uint8_t cellCount = getSettingValue(SettingsOptions::MinDCVoltageCells) + 2;
|
||||
uint32_t cellV = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0) / cellCount;
|
||||
// Should give us approx cell voltage X10
|
||||
// Range is 42 -> Minimum voltage setting (systemSettings.minVoltageCells) = 9 steps therefore we will use battery 0-9
|
||||
if (cellV < getSettingValue(SettingsOptions::MinVoltageCells)) {
|
||||
cellV = getSettingValue(SettingsOptions::MinVoltageCells);
|
||||
}
|
||||
cellV -= getSettingValue(SettingsOptions::MinVoltageCells); // Should leave us a number of 0-9
|
||||
if (cellV > 9) {
|
||||
cellV = 9;
|
||||
}
|
||||
OLED::drawBattery(cellV + 1);
|
||||
} else {
|
||||
OLED::drawSymbol(15); // Draw the DC Logo
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include "Buttons.hpp"
|
||||
#include "OperatingModeUtilities.h"
|
||||
extern TickType_t lastMovementTime;
|
||||
#ifndef NO_SLEEP_MODE
|
||||
void printCountdownUntilSleep(int sleepThres) {
|
||||
/*
|
||||
* Print seconds or minutes (if > 99 seconds) until sleep
|
||||
* mode is triggered.
|
||||
*/
|
||||
TickType_t lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
|
||||
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
|
||||
if (downCount > (99 * TICKS_SECOND)) {
|
||||
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
|
||||
OLED::print(SmallSymbolMinutes, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::printNumber(downCount / 1000 + 1, 2, FontStyle::SMALL);
|
||||
OLED::print(SmallSymbolSeconds, FontStyle::SMALL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user