Check hall effect sensor is present before threshold

This commit is contained in:
Ben V. Brown
2021-02-24 20:29:26 +11:00
parent 2bfb6745e4
commit 2f73c99fa4

View File

@@ -70,8 +70,7 @@ void gui_drawTipTemp(bool symbol) {
uint32_t Temp = 0;
if (systemSettings.temperatureInF) {
Temp = TipThermoModel::getTipInF();
} else
{
} else {
Temp = TipThermoModel::getTipInC();
}
@@ -274,8 +273,7 @@ static void gui_solderingTempAdjust() {
OLED::printNumber(systemSettings.SolderingTemp, 3);
if (systemSettings.temperatureInF)
OLED::drawSymbol(0);
else
{
else {
OLED::drawSymbol(1);
}
OLED::print(SymbolSpace);
@@ -410,7 +408,7 @@ static bool shouldBeSleeping(bool inAutoStart) {
}
}
if (lastMovementTime > 0 || lastButtonTime > 0) {
if ((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout() && (xTaskGetTickCount() - lastButtonTime) > getSleepTimeout()) {
if (((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout()) && ((xTaskGetTickCount() - lastButtonTime) > getSleepTimeout())) {
return true;
}
}
@@ -419,7 +417,7 @@ static bool shouldBeSleeping(bool inAutoStart) {
#ifdef HALL_SENSOR
// If the hall effect sensor is enabled in the build, check if its over
// threshold, and if so then we force sleep
if (lookupHallEffectThreshold()) {
if (getHallSensorFitted() && lookupHallEffectThreshold()) {
int16_t hallEffectStrength = getRawHallEffect();
if (hallEffectStrength < 0)
hallEffectStrength = -hallEffectStrength;
@@ -516,7 +514,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
if (oldTemp != systemSettings.SolderingTemp) {
saveSettings(); // only save on change
}
} break;
}
break;
case BUTTON_BOTH_LONG:
if (systemSettings.lockingMode != 0) {
// Lock buttons
@@ -655,7 +654,9 @@ void showDebugMenu(void) {
break;
case 6:
// Raw Tip
{ OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 6); }
{
OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 6);
}
break;
case 7:
// Temp in C