mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Check hall effect sensor is present before threshold
This commit is contained in:
@@ -70,8 +70,7 @@ void gui_drawTipTemp(bool symbol) {
|
|||||||
uint32_t Temp = 0;
|
uint32_t Temp = 0;
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
Temp = TipThermoModel::getTipInF();
|
Temp = TipThermoModel::getTipInF();
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
Temp = TipThermoModel::getTipInC();
|
Temp = TipThermoModel::getTipInC();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,8 +273,7 @@ static void gui_solderingTempAdjust() {
|
|||||||
OLED::printNumber(systemSettings.SolderingTemp, 3);
|
OLED::printNumber(systemSettings.SolderingTemp, 3);
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
OLED::drawSymbol(0);
|
OLED::drawSymbol(0);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
OLED::drawSymbol(1);
|
OLED::drawSymbol(1);
|
||||||
}
|
}
|
||||||
OLED::print(SymbolSpace);
|
OLED::print(SymbolSpace);
|
||||||
@@ -295,12 +293,12 @@ static void gui_solderingTempAdjust() {
|
|||||||
static bool shouldShutdown() {
|
static bool shouldShutdown() {
|
||||||
if (systemSettings.ShutdownTime) { // only allow shutdown exit if time > 0
|
if (systemSettings.ShutdownTime) { // only allow shutdown exit if time > 0
|
||||||
if (lastMovementTime) {
|
if (lastMovementTime) {
|
||||||
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) > (TickType_t)(systemSettings.ShutdownTime * TICKS_MIN)) {
|
if (((TickType_t) (xTaskGetTickCount() - lastMovementTime)) > (TickType_t) (systemSettings.ShutdownTime * TICKS_MIN)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastHallEffectSleepStart) {
|
if (lastHallEffectSleepStart) {
|
||||||
if (((TickType_t)(xTaskGetTickCount() - lastHallEffectSleepStart)) > (TickType_t)(systemSettings.ShutdownTime * TICKS_MIN)) {
|
if (((TickType_t) (xTaskGetTickCount() - lastHallEffectSleepStart)) > (TickType_t) (systemSettings.ShutdownTime * TICKS_MIN)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,7 +408,7 @@ static bool shouldBeSleeping(bool inAutoStart) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastMovementTime > 0 || lastButtonTime > 0) {
|
if (lastMovementTime > 0 || lastButtonTime > 0) {
|
||||||
if ((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout() && (xTaskGetTickCount() - lastButtonTime) > getSleepTimeout()) {
|
if (((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout()) && ((xTaskGetTickCount() - lastButtonTime) > getSleepTimeout())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,7 +417,7 @@ static bool shouldBeSleeping(bool inAutoStart) {
|
|||||||
#ifdef HALL_SENSOR
|
#ifdef HALL_SENSOR
|
||||||
// If the hall effect sensor is enabled in the build, check if its over
|
// If the hall effect sensor is enabled in the build, check if its over
|
||||||
// threshold, and if so then we force sleep
|
// threshold, and if so then we force sleep
|
||||||
if (lookupHallEffectThreshold()) {
|
if (getHallSensorFitted() && lookupHallEffectThreshold()) {
|
||||||
int16_t hallEffectStrength = getRawHallEffect();
|
int16_t hallEffectStrength = getRawHallEffect();
|
||||||
if (hallEffectStrength < 0)
|
if (hallEffectStrength < 0)
|
||||||
hallEffectStrength = -hallEffectStrength;
|
hallEffectStrength = -hallEffectStrength;
|
||||||
@@ -516,7 +514,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
if (oldTemp != systemSettings.SolderingTemp) {
|
if (oldTemp != systemSettings.SolderingTemp) {
|
||||||
saveSettings(); // only save on change
|
saveSettings(); // only save on change
|
||||||
}
|
}
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
case BUTTON_BOTH_LONG:
|
case BUTTON_BOTH_LONG:
|
||||||
if (systemSettings.lockingMode != 0) {
|
if (systemSettings.lockingMode != 0) {
|
||||||
// Lock buttons
|
// Lock buttons
|
||||||
@@ -655,7 +654,9 @@ void showDebugMenu(void) {
|
|||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
// Raw Tip
|
// Raw Tip
|
||||||
{ OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 6); }
|
{
|
||||||
|
OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 6);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
// Temp in C
|
// Temp in C
|
||||||
|
|||||||
Reference in New Issue
Block a user