1
0
forked from me/IronOS

Fix PD debug at boot

This commit is contained in:
Ben V. Brown
2023-07-21 20:14:25 +10:00
parent 2d8378c39d
commit ea35b264ab
2 changed files with 26 additions and 25 deletions

View File

@@ -70,14 +70,21 @@ OperatingMode guiHandleDraw(void) {
break;
case OperatingMode::UsbPDDebug:
#ifdef HAS_POWER_DEBUG_MENU
showPDDebug(buttons, &context);
newMode = showPDDebug(buttons, &context);
break;
#else
/*fallthrough*/
newMode = OperatingMode::InitialisationDone;
#endif
case OperatingMode::StartupLogo:
BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); // TODO needs refactor
newMode = OperatingMode::StartupWarnings;
if (getSettingValue(SettingsOptions::AutoStartMode) == 1) {
// jump directly to the autostart mode
newMode = OperatingMode::Sleeping;
} else if (getSettingValue(SettingsOptions::AutoStartMode) == 2) {
newMode = OperatingMode::Hibernating;
} else {
newMode = OperatingMode::HomeScreen;
}
break;
default:
/* Fallthrough */
@@ -161,6 +168,7 @@ OperatingMode handle_post_init_state() {
#else
if (buttonsAtDeviceBoot == BUTTON_F_LONG || buttonsAtDeviceBoot == BUTTON_F_SHORT) {
#endif
buttonsAtDeviceBoot = BUTTON_NONE;
return OperatingMode::UsbPDDebug;
}
#endif
@@ -169,15 +177,7 @@ OperatingMode handle_post_init_state() {
return OperatingMode::CJCCalibration;
}
if (getSettingValue(SettingsOptions::AutoStartMode) == 1) {
// jump directly to the autostart mode
return OperatingMode::Sleeping;
}
if (getSettingValue(SettingsOptions::AutoStartMode) == 2) {
return OperatingMode::Hibernating;
}
return OperatingMode::HomeScreen;
return OperatingMode::StartupLogo;
}
/* StartGUITask function */
@@ -195,7 +195,6 @@ void startGUITask(void const *argument) {
memset(&context, 0, sizeof(context));
OLED::setRotation(getSettingValue(SettingsOptions::OrientationMode) & 1);
buttonsAtDeviceBoot = getButtonState();
// // If the boot logo is enabled with timeout and the autostart mode is enabled (but not set to sleep w/o heat), start heating during boot logo
// if (getSettingValue(SettingsOptions::LOGOTime) > 0 && getSettingValue(SettingsOptions::LOGOTime) < 5 && getSettingValue(SettingsOptions::AutoStartMode) > 0
@@ -209,7 +208,13 @@ void startGUITask(void const *argument) {
// // Only heat to sleep temperature (but no higher than 75°C for safety)
// currentTempTargetDegC = min(sleepTempDegC, 75);
// }
// TODO
// Read boot button state
if (getButtonA()) {
buttonsAtDeviceBoot = BUTTON_F_LONG;
}
if (getButtonB()) {
buttonsAtDeviceBoot = BUTTON_B_LONG;
}
TickType_t startRender = xTaskGetTickCount();
for (;;) {

View File

@@ -49,7 +49,7 @@ OperatingMode showPDDebug(const ButtonState buttons, guiContext *cxt) {
}
// Skip not used entries
if (voltage_mv == 0) {
*screen++;
(*screen) += 1;
} else {
// print out this entry of the proposal
OLED::printNumber(*screen, 2, FontStyle::SMALL, true); // print the entry number
@@ -72,17 +72,13 @@ OperatingMode showPDDebug(const ButtonState buttons, guiContext *cxt) {
}
}
} else {
*screen = 0;
(*screen) = 0;
}
OLED::refresh();
if (buttons == BUTTON_B_SHORT)
return OperatingMode::InitialisationDone;
else if (buttons == BUTTON_F_SHORT) {
*screen++;
}
GUIDelay();
}
if (buttons == BUTTON_B_SHORT)
return OperatingMode::InitialisationDone;
else if (buttons == BUTTON_F_SHORT) {
(*screen) += 1;
}
return OperatingMode::UsbPDDebug;
}