MHP30: Shutdown settings (#1307)
* Reduce PPS max to 20V to avoid instability Some PSU's cant actually run at 21V * Creating a rough draft of a "pre start check" concept * Newer alpine * Cleaning up MHP detection * Cleanup comments * PID: Run prestart based on ADC IRQ rather than times * MHP30: Far better startup for detecting tip gain * Newer alpine for github CI * Bugfix: Exit on movement * Feature: Shutdown timeout for MHP30
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "OLED.hpp"
|
||||
#include "Setup.h"
|
||||
extern uint32_t currentTempTargetDegC;
|
||||
extern bool settingsWereReset;
|
||||
extern bool usb_pd_available;
|
||||
extern volatile uint32_t currentTempTargetDegC;
|
||||
extern bool settingsWereReset;
|
||||
extern bool usb_pd_available;
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -27,13 +27,13 @@ static void settings_displayQCInputV(void);
|
||||
#if POW_PD
|
||||
static void settings_displayPDNegTimeout(void);
|
||||
#endif
|
||||
#ifndef NO_SLEEP_MODE
|
||||
static void settings_displaySensitivity(void);
|
||||
static void settings_displayShutdownTime(void);
|
||||
static bool settings_showSleepOptions(void);
|
||||
#ifndef NO_SLEEP_MODE
|
||||
static bool settings_setSleepTemp(void);
|
||||
static void settings_displaySleepTemp(void);
|
||||
static void settings_displaySleepTime(void);
|
||||
static void settings_displayShutdownTime(void);
|
||||
#endif
|
||||
static bool settings_setTempF(void);
|
||||
static void settings_displayTempF(void);
|
||||
@@ -195,18 +195,18 @@ const menuitem solderingMenu[] = {
|
||||
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE
|
||||
};
|
||||
const menuitem PowerSavingMenu[] = {
|
||||
/*
|
||||
* Motion Sensitivity
|
||||
* -Sleep Temp
|
||||
* -Sleep Time
|
||||
* -Shutdown Time
|
||||
*/
|
||||
/*
|
||||
* Motion Sensitivity
|
||||
* -Sleep Temp
|
||||
* -Sleep Time
|
||||
* -Shutdown Time
|
||||
*/
|
||||
{SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, settings_displaySensitivity, nullptr, SettingsOptions::Sensitivity}, /* Motion Sensitivity*/
|
||||
#ifndef NO_SLEEP_MODE
|
||||
{SETTINGS_DESC(SettingsItemIndex::MotionSensitivity), nullptr, settings_displaySensitivity, nullptr, SettingsOptions::Sensitivity}, /* Motion Sensitivity*/
|
||||
{SETTINGS_DESC(SettingsItemIndex::SleepTemperature), settings_setSleepTemp, settings_displaySleepTemp, settings_showSleepOptions, SettingsOptions::SettingsOptionsLength}, /*Sleep Temp*/
|
||||
{SETTINGS_DESC(SettingsItemIndex::SleepTimeout), nullptr, settings_displaySleepTime, settings_showSleepOptions, SettingsOptions::SleepTime}, /*Sleep Time*/
|
||||
{SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, settings_displayShutdownTime, settings_showSleepOptions, SettingsOptions::ShutdownTime}, /*Shutdown Time*/
|
||||
#endif
|
||||
{SETTINGS_DESC(SettingsItemIndex::ShutdownTimeout), nullptr, settings_displayShutdownTime, settings_showSleepOptions, SettingsOptions::ShutdownTime}, /*Shutdown Time*/
|
||||
#ifdef HALL_SENSOR
|
||||
{SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, settings_displayHallEffect, settings_showHallEffect, SettingsOptions::HallEffectSensitivity}, /* HallEffect Sensitivity*/
|
||||
#endif
|
||||
@@ -362,8 +362,6 @@ static void settings_displayPDNegTimeout(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_SLEEP_MODE
|
||||
|
||||
static void settings_displayShutdownTime(void) {
|
||||
printShortDescription(SettingsItemIndex::ShutdownTimeout, 5);
|
||||
if (getSettingValue(SettingsOptions::ShutdownTime) == 0) {
|
||||
@@ -374,6 +372,14 @@ static void settings_displayShutdownTime(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_displaySensitivity(void) {
|
||||
printShortDescription(SettingsItemIndex::MotionSensitivity, 7);
|
||||
OLED::printNumber(getSettingValue(SettingsOptions::Sensitivity), 1, FontStyle::LARGE, false);
|
||||
}
|
||||
static bool settings_showSleepOptions(void) { return getSettingValue(SettingsOptions::Sensitivity) > 0; }
|
||||
|
||||
#ifndef NO_SLEEP_MODE
|
||||
|
||||
static bool settings_setSleepTemp(void) {
|
||||
// If in C, 10 deg, if in F 20 deg
|
||||
uint16_t temp = getSettingValue(SettingsOptions::SleepTemp);
|
||||
@@ -392,12 +398,6 @@ static bool settings_setSleepTemp(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_displaySensitivity(void) {
|
||||
printShortDescription(SettingsItemIndex::MotionSensitivity, 7);
|
||||
OLED::printNumber(getSettingValue(SettingsOptions::Sensitivity), 1, FontStyle::LARGE, false);
|
||||
}
|
||||
|
||||
static bool settings_showSleepOptions(void) { return getSettingValue(SettingsOptions::Sensitivity) > 0; }
|
||||
static void settings_displaySleepTemp(void) {
|
||||
printShortDescription(SettingsItemIndex::SleepTemperature, 5);
|
||||
OLED::printNumber(getSettingValue(SettingsOptions::SleepTemp), 3, FontStyle::LARGE);
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
#include "pd.h"
|
||||
#endif
|
||||
// File local variables
|
||||
extern uint32_t currentTempTargetDegC;
|
||||
|
||||
extern TickType_t lastMovementTime;
|
||||
extern bool heaterThermalRunaway;
|
||||
extern osThreadId GUITaskHandle;
|
||||
@@ -350,28 +350,11 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
|
||||
|
||||
OLED::refresh();
|
||||
GUIDelay();
|
||||
#ifdef ACCEL_EXITS_ON_MOVEMENT
|
||||
// If the accel works in reverse where movement will cause exiting the soldering mode
|
||||
if (getSettingValue(SettingsOptions::Sensitivity)) {
|
||||
if (lastMovementTime) {
|
||||
if (lastMovementTime > TICKS_SECOND * 10) {
|
||||
// If we have moved recently; in the last second
|
||||
// Then exit soldering mode
|
||||
|
||||
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
|
||||
currentTempTargetDegC = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
if (!shouldBeSleeping(autoStarted)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (shouldShutdown()) {
|
||||
// shutdown
|
||||
currentTempTargetDegC = 0;
|
||||
@@ -645,6 +628,31 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ACCEL_EXITS_ON_MOVEMENT
|
||||
// If the accel works in reverse where movement will cause exiting the soldering mode
|
||||
if (getSettingValue(SettingsOptions::Sensitivity)) {
|
||||
if (lastMovementTime) {
|
||||
if (lastMovementTime > TICKS_SECOND * 10) {
|
||||
// If we have moved recently; in the last second
|
||||
// Then exit soldering mode
|
||||
|
||||
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
|
||||
currentTempTargetDegC = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef NO_SLEEP_MODE
|
||||
// No sleep mode, but still want shutdown timeout
|
||||
|
||||
if (shouldShutdown()) {
|
||||
// shutdown
|
||||
currentTempTargetDegC = 0;
|
||||
return; // we want to exit soldering mode
|
||||
}
|
||||
#endif
|
||||
if (shouldBeSleeping()) {
|
||||
if (gui_SolderingSleepingMode(false, false)) {
|
||||
return; // If the function returns non-0 then exit
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
static TickType_t powerPulseWaitUnit = 25 * TICKS_100MS; // 2.5 s
|
||||
static TickType_t powerPulseDurationUnit = (5 * TICKS_100MS) / 2; // 250 ms
|
||||
TaskHandle_t pidTaskNotification = NULL;
|
||||
uint32_t currentTempTargetDegC = 0; // Current temperature target in C
|
||||
volatile uint32_t currentTempTargetDegC = 0; // Current temperature target in C
|
||||
int32_t powerSupplyWattageLimit = 0;
|
||||
bool heaterThermalRunaway = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user