Add warnings to show if accel or pd is missing on startup first 2 times
This commit is contained in:
@@ -239,7 +239,7 @@ uint32_t TipThermoModel::getTipInF(bool sampleNow) {
|
||||
#endif
|
||||
|
||||
uint32_t TipThermoModel::getTipMaxInC() {
|
||||
uint32_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(0x7FFF - (80 * 5)); //back off approx 5 deg c from ADC max
|
||||
uint32_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(0x7FFF - (21 * 5)); //back off approx 5 deg c from ADC max
|
||||
maximumTipTemp += getHandleTemperature() / 10; //Add handle offset
|
||||
return maximumTipTemp - 1;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define SETTINGS_H_
|
||||
#include <stdint.h>
|
||||
#include "unit.h"
|
||||
#define SETTINGSVERSION (0x23)
|
||||
#define SETTINGSVERSION (0x24)
|
||||
/*Change this if you change the struct below to prevent people getting \
|
||||
out of sync*/
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct {
|
||||
uint8_t detailedIDLE :1; // Detailed idle screen
|
||||
uint8_t detailedSoldering :1; // Detailed soldering screens
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
uint8_t temperatureInF : 1; // Should the temp be in F or C (true is F)
|
||||
uint8_t temperatureInF :1; // Should the temp be in F or C (true is F)
|
||||
#endif
|
||||
uint8_t descriptionScrollSpeed :1; // Description scroll speed
|
||||
uint8_t lockingMode :2; // Store the locking mode
|
||||
@@ -51,11 +51,12 @@ typedef struct {
|
||||
|
||||
uint8_t powerLimit; // Maximum power iron allowed to output
|
||||
|
||||
|
||||
uint8_t ReverseButtonTempChangeEnabled; // Change the plus and minus button assigment
|
||||
uint16_t TempChangeLongStep; // Change the plus and minus button assigment
|
||||
uint16_t TempChangeShortStep; // Change the plus and minus button assigment
|
||||
uint8_t hallEffectSensitivity; //Operating mode of the hall effect sensor
|
||||
uint8_t accelMissingWarningCounter; // Counter of how many times we have warned we cannot detect the accelerometer
|
||||
uint8_t pdMissingWarningCounter; // Counter of how many times we have warned we cannot detect the pd interface
|
||||
|
||||
uint32_t padding; // This is here for in case we are not an even divisor so
|
||||
// that nothing gets cut off
|
||||
|
||||
@@ -15,6 +15,7 @@ void vApplicationStackOverflowHook(TaskHandle_t *pxTask,
|
||||
signed portCHAR *pcTaskName);
|
||||
|
||||
#define NO_DETECTED_ACCELEROMETER 99
|
||||
#define ACCELEROMETERS_SCANNING 100
|
||||
//Threads
|
||||
void startGUITask(void const *argument);
|
||||
void startPIDTask(void const *argument);
|
||||
|
||||
@@ -68,7 +68,7 @@ void resetSettings() {
|
||||
systemSettings.lockingMode = LOCKING_MODE; // Disable locking for safety
|
||||
systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0
|
||||
systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0
|
||||
#endif
|
||||
systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow
|
||||
systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV
|
||||
@@ -78,6 +78,9 @@ void resetSettings() {
|
||||
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; //
|
||||
systemSettings.KeepAwakePulse = POWER_PULSE_DEFAULT;
|
||||
systemSettings.hallEffectSensitivity = 1;
|
||||
systemSettings.accelMissingWarningCounter = 0;
|
||||
systemSettings.pdMissingWarningCounter = 0;
|
||||
|
||||
saveSettings(); // Save defaults
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ extern osThreadId MOVTaskHandle;
|
||||
extern osThreadId PIDTaskHandle;
|
||||
static bool shouldBeSleeping(bool inAutoStart = false);
|
||||
static bool shouldShutdown();
|
||||
void showWarnings();
|
||||
#define MOVEMENT_INACTIVITY_TIME (60 * configTICK_RATE_HZ)
|
||||
#define BUTTON_INACTIVITY_TIME (60 * configTICK_RATE_HZ)
|
||||
static TickType_t lastHallEffectSleepStart = 0;
|
||||
@@ -43,6 +44,14 @@ static uint16_t min(uint16_t a, uint16_t b) {
|
||||
else
|
||||
return a;
|
||||
}
|
||||
void warnUser(const char *warning, const int font, const int timeout) {
|
||||
OLED::setFont(font);
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print(warning);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(timeout);
|
||||
}
|
||||
|
||||
void printVoltage() {
|
||||
uint32_t volt = getInputVoltageX10(systemSettings.voltageDiv, 0);
|
||||
@@ -473,38 +482,26 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (buttonsLocked && (systemSettings.lockingMode != 0)) { // If buttons locked
|
||||
switch (buttons) {
|
||||
case BUTTON_NONE:
|
||||
// stay
|
||||
boostModeOn = false;
|
||||
break;
|
||||
case BUTTON_BOTH_LONG:
|
||||
// Unlock buttons
|
||||
buttonsLocked = false;
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
OLED::print(UnlockingKeysString);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(1000);
|
||||
warnUser(UnlockingKeysString, 0, TICKS_SECOND);
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
// if boost mode is enabled turn it on
|
||||
if (systemSettings.BoostTemp && (systemSettings.lockingMode == 1)) {
|
||||
boostModeOn = true;
|
||||
break;
|
||||
}
|
||||
;
|
||||
break;
|
||||
// fall through
|
||||
case BUTTON_BOTH:
|
||||
case BUTTON_B_LONG:
|
||||
case BUTTON_F_SHORT:
|
||||
case BUTTON_B_SHORT:
|
||||
// Do nothing and display a lock warming
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
OLED::print(WarningKeysLockedString);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(500);
|
||||
warnUser(WarningKeysLockedString, 0, TICKS_SECOND / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -540,12 +537,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (systemSettings.lockingMode != 0) {
|
||||
// Lock buttons
|
||||
buttonsLocked = true;
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
OLED::print(LockingKeysString);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(1000);
|
||||
warnUser(LockingKeysString, 0, TICKS_SECOND);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -706,7 +698,7 @@ void showDebugMenu(void) {
|
||||
break;
|
||||
case 10:
|
||||
// Print PCB ID number
|
||||
OLED::printNumber(PCBVersion, 2);
|
||||
OLED::printNumber(DetectedAccelerometerVersion, 2);
|
||||
break;
|
||||
case 11:
|
||||
// Power negotiation status
|
||||
@@ -752,6 +744,40 @@ void showDebugMenu(void) {
|
||||
GUIDelay();
|
||||
}
|
||||
}
|
||||
|
||||
void showWarnings() {
|
||||
// Display alert if settings were reset
|
||||
if (settingsWereReset) {
|
||||
warnUser(SettingsResetMessage, 1, 10 * TICKS_SECOND);
|
||||
}
|
||||
#ifndef NO_WARN_MISSING
|
||||
//We also want to alert if accel or pd is not detected / not responding
|
||||
// In this case though, we dont want to nag the user _too_ much
|
||||
// So only show first 2 times
|
||||
while (DetectedAccelerometerVersion == ACCELEROMETERS_SCANNING) {
|
||||
osDelay(1);
|
||||
}
|
||||
// Display alert if accelerometer is not detected
|
||||
if (DetectedAccelerometerVersion == NO_DETECTED_ACCELEROMETER) {
|
||||
if (systemSettings.accelMissingWarningCounter < 2) {
|
||||
systemSettings.accelMissingWarningCounter++;
|
||||
saveSettings();
|
||||
warnUser(NoAccelerometerMessage, 1, 10 * TICKS_SECOND);
|
||||
}
|
||||
}
|
||||
#ifdef POW_PD
|
||||
//We expect pd to be present
|
||||
if (!usb_pd_detect()) {
|
||||
if (systemSettings.pdMissingWarningCounter < 2) {
|
||||
systemSettings.pdMissingWarningCounter++;
|
||||
saveSettings();
|
||||
warnUser(NoPowerDeliveryMessage, 1, 10 * TICKS_SECOND);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t idleScreenBGF[sizeof(idleScreenBG)];
|
||||
/* StartGUITask function */
|
||||
void startGUITask(void const *argument __unused) {
|
||||
@@ -783,15 +809,8 @@ void startGUITask(void const *argument __unused) {
|
||||
GUIDelay();
|
||||
}
|
||||
|
||||
if (settingsWereReset) {
|
||||
// Display alert settings were reset
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(1);
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print(SettingsResetMessage);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(10000);
|
||||
}
|
||||
showWarnings();
|
||||
|
||||
if (systemSettings.autoStartMode) {
|
||||
// jump directly to the autostart mode
|
||||
gui_solderingMode(systemSettings.autoStartMode - 1);
|
||||
@@ -925,7 +944,7 @@ void startGUITask(void const *argument __unused) {
|
||||
//Draw in missing tip symbol
|
||||
|
||||
#ifdef OLED_FLIP
|
||||
if (!OLED::getRotation()) {
|
||||
if (!OLED::getRotation()) {
|
||||
#else
|
||||
if (OLED::getRotation()) {
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
uint8_t accelInit = 0;
|
||||
TickType_t lastMovementTime = 0;
|
||||
void detectAccelerometerVersion() {
|
||||
DetectedAccelerometerVersion = ACCELEROMETERS_SCANNING;
|
||||
#ifdef ACCEL_MMA
|
||||
if (MMA8652FC::detect()) {
|
||||
DetectedAccelerometerVersion = 1;
|
||||
@@ -83,16 +84,11 @@ inline void readAccelerometer(int16_t &tx, int16_t &ty, int16_t &tz, Orientation
|
||||
}
|
||||
void startMOVTask(void const *argument __unused) {
|
||||
postRToSInit();
|
||||
while (OLED::isInitDone() == false) {
|
||||
osDelay(1); //Make oled init happen first
|
||||
}
|
||||
OLED::setRotation(systemSettings.OrientationMode & 1);
|
||||
detectAccelerometerVersion();
|
||||
lastMovementTime = 0;
|
||||
if ((systemSettings.autoStartMode == 2 || systemSettings.autoStartMode == 3))
|
||||
osDelay(2 * TICKS_SECOND);
|
||||
|
||||
lastMovementTime = 0;
|
||||
int16_t datax[MOVFilter] = { 0 };
|
||||
int16_t datay[MOVFilter] = { 0 };
|
||||
int16_t dataz[MOVFilter] = { 0 };
|
||||
@@ -102,17 +98,6 @@ void startMOVTask(void const *argument __unused) {
|
||||
if (systemSettings.sensitivity > 9)
|
||||
systemSettings.sensitivity = 9;
|
||||
Orientation rotation = ORIENTATION_FLAT;
|
||||
// OLED::setFont(1);
|
||||
// for (;;) {
|
||||
// OLED::clearScreen();
|
||||
// OLED::setCursor(0, 0);
|
||||
// readAccelerometer(tx, ty, tz, rotation);
|
||||
// OLED::printNumber(tx, 5, 0);
|
||||
// OLED::setCursor(0, 8);
|
||||
// OLED::printNumber(xTaskGetTickCount() / 10, 5, 1);
|
||||
// OLED::refresh();
|
||||
// osDelay(50);
|
||||
// }
|
||||
for (;;) {
|
||||
int32_t threshold = 1500 + (9 * 200);
|
||||
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
|
||||
|
||||
5
workspace/TS100A/.gitignore
vendored
5
workspace/TS100A/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
/Release/
|
||||
/TS100/
|
||||
/TS100_LOCAL/
|
||||
/ReleaseTS80/
|
||||
/ReleaseTS100/
|
||||
Reference in New Issue
Block a user