Update GUIThread.cpp
This commit is contained in:
@@ -7,22 +7,22 @@
|
||||
extern "C" {
|
||||
#include "FreeRTOSConfig.h"
|
||||
}
|
||||
#include <MMA8652FC.hpp>
|
||||
#include <gui.hpp>
|
||||
#include <history.hpp>
|
||||
#include "main.hpp"
|
||||
#include <power.hpp>
|
||||
#include "../../configuration.h"
|
||||
#include "Buttons.hpp"
|
||||
#include "I2CBB.hpp"
|
||||
#include "LIS2DH12.hpp"
|
||||
#include "Settings.h"
|
||||
#include "TipThermoModel.h"
|
||||
#include "Translation.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "main.hpp"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "unit.h"
|
||||
#include "I2CBB.hpp"
|
||||
#include <MMA8652FC.hpp>
|
||||
#include <gui.hpp>
|
||||
#include <history.hpp>
|
||||
#include <power.hpp>
|
||||
// File local variables
|
||||
extern uint32_t currentTempTargetDegC;
|
||||
extern TickType_t lastMovementTime;
|
||||
@@ -96,7 +96,8 @@ static bool checkVoltageForExit() {
|
||||
}
|
||||
uint16_t v = getInputVoltageX10(systemSettings.voltageDiv, 0);
|
||||
|
||||
// Dont check for first 2 seconds while the ADC stabilizes and the DMA fills the buffer
|
||||
// Dont check for first 2 seconds while the ADC stabilizes and the DMA fills
|
||||
// the buffer
|
||||
if (xTaskGetTickCount() > (TICKS_SECOND * 2)) {
|
||||
if ((v < lookupVoltageLevel())) {
|
||||
currentTempTargetDegC = 0;
|
||||
@@ -149,8 +150,8 @@ static void gui_drawBatteryIcon() {
|
||||
// User is on a lithium battery
|
||||
// we need to calculate which of the 10 levels they are on
|
||||
uint8_t cellCount = systemSettings.cutoutSetting + 2;
|
||||
uint32_t cellV = getInputVoltageX10(systemSettings.voltageDiv, 0)
|
||||
/ cellCount;
|
||||
uint32_t cellV =
|
||||
getInputVoltageX10(systemSettings.voltageDiv, 0) / cellCount;
|
||||
// Should give us approx cell voltage X10
|
||||
// Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
|
||||
if (cellV < 33)
|
||||
@@ -162,7 +163,6 @@ static void gui_drawBatteryIcon() {
|
||||
} else
|
||||
OLED::drawSymbol(15); // Draw the DC Logo
|
||||
#endif
|
||||
|
||||
}
|
||||
static void gui_solderingTempAdjust() {
|
||||
uint32_t lastChange = xTaskGetTickCount();
|
||||
@@ -185,7 +185,8 @@ static void gui_solderingTempAdjust() {
|
||||
return;
|
||||
break;
|
||||
case BUTTON_B_LONG:
|
||||
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration > PRESS_ACCEL_INTERVAL_MAX) {
|
||||
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
|
||||
PRESS_ACCEL_INTERVAL_MAX) {
|
||||
if (systemSettings.ReverseButtonTempChangeEnabled) {
|
||||
systemSettings.SolderingTemp += systemSettings.TempChangeLongStep;
|
||||
} else
|
||||
@@ -202,7 +203,8 @@ static void gui_solderingTempAdjust() {
|
||||
systemSettings.SolderingTemp -= systemSettings.TempChangeShortStep;
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration > PRESS_ACCEL_INTERVAL_MAX) {
|
||||
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration >
|
||||
PRESS_ACCEL_INTERVAL_MAX) {
|
||||
if (systemSettings.ReverseButtonTempChangeEnabled) {
|
||||
systemSettings.SolderingTemp -= systemSettings.TempChangeLongStep;
|
||||
} else
|
||||
@@ -220,14 +222,18 @@ static void gui_solderingTempAdjust() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) < PRESS_ACCEL_INTERVAL_MIN) {
|
||||
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
|
||||
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) <
|
||||
PRESS_ACCEL_INTERVAL_MIN) {
|
||||
autoRepeatAcceleration =
|
||||
PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
|
||||
}
|
||||
// constrain between 10-450 C
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF) {
|
||||
if (systemSettings.SolderingTemp > 850) systemSettings.SolderingTemp = 850;
|
||||
if (systemSettings.SolderingTemp < 60) systemSettings.SolderingTemp = 60;
|
||||
if (systemSettings.SolderingTemp > 850)
|
||||
systemSettings.SolderingTemp = 850;
|
||||
if (systemSettings.SolderingTemp < 60)
|
||||
systemSettings.SolderingTemp = 60;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -298,13 +304,17 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
#ifdef POW_PD
|
||||
if (checkVoltageForExit())
|
||||
return 1; // return non-zero on error
|
||||
#endif
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF) {
|
||||
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
|
||||
currentTempTargetDegC =
|
||||
stayOff
|
||||
? 0
|
||||
: TipThermoModel::convertFtoC(min(systemSettings.SleepTemp,
|
||||
systemSettings.SolderingTemp));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -401,7 +411,8 @@ static bool shouldBeSleeping() {
|
||||
}
|
||||
}
|
||||
#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 the hall effect sensor is enabled in the build, check if its over
|
||||
// threshold, and if so then we force sleep
|
||||
if (lookupHallEffectThreshold()) {
|
||||
int16_t hallEffectStrength = getRawHallEffect();
|
||||
if (hallEffectStrength < 0)
|
||||
@@ -593,7 +604,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (boostModeOn) {
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
currentTempTargetDegC = TipThermoModel::convertFtoC(systemSettings.BoostTemp);
|
||||
currentTempTargetDegC =
|
||||
TipThermoModel::convertFtoC(systemSettings.BoostTemp);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -602,7 +614,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
} else {
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
currentTempTargetDegC = TipThermoModel::convertFtoC(systemSettings.SolderingTemp);
|
||||
currentTempTargetDegC =
|
||||
TipThermoModel::convertFtoC(systemSettings.SolderingTemp);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -807,7 +820,8 @@ void startGUITask(void const *argument __unused) {
|
||||
// button presses) in a while.
|
||||
OLED::setDisplayState(OLED::DisplayState::ON);
|
||||
|
||||
if ((tipTemp < 50) && systemSettings.sensitivity && (((xTaskGetTickCount() - lastMovementTime) > MOVEMENT_INACTIVITY_TIME) && ((xTaskGetTickCount() - lastButtonTime) > BUTTON_INACTIVITY_TIME))) {
|
||||
if ((tipTemp < 50) && systemSettings.sensitivity && (((xTaskGetTickCount() - lastMovementTime) >
|
||||
MOVEMENT_INACTIVITY_TIME) && ((xTaskGetTickCount() - lastButtonTime) > BUTTON_INACTIVITY_TIME))) {
|
||||
OLED::setDisplayState(OLED::DisplayState::OFF);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user