1
0
forked from me/IronOS

Merge pull request #632 from Ralim/feat/power-pulse-for-all

Enable Power Pulse for all models
This commit is contained in:
Ben V. Brown
2020-05-24 18:21:46 +10:00
committed by GitHub
32 changed files with 344 additions and 109 deletions

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -274,6 +274,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -277,6 +277,14 @@
"Taste Lang?"
],
"desc": "Temperaturwechselschritte bei langem Tastendruck!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -276,6 +276,14 @@
"long"
],
"desc": "Temperature change steps on long button press"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -275,6 +275,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"Long?"
],
"desc": "Incrément de changement de température sur appui long."
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -275,6 +275,14 @@
"pressione lunga"
],
"desc": "Varia la temperatura della punta attraverso una lunga pressione dei tasti"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -275,6 +275,14 @@
"длин. наж."
],
"desc": "Шаг изменения температуры при длинном нажатии кнопок"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -274,6 +274,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"long?"
],
"desc": "Temperature change steps on long button press!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -273,6 +273,14 @@
"довго?"
],
"desc": "Змінювати температуру при довгому натисканні!"
},
"PowerPulsePower":{
"text": "POWPLS",
"text2": [
"Power",
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
}
}
}

View File

@@ -282,6 +282,11 @@ var def =
"id": "TempChangeLongStep",
"maxLen": 6,
"maxLen2": 16
},
{
"id": "PowerPulsePower",
"maxLen": 6,
"maxLen2": 16
}
]
}

View File

@@ -12,7 +12,7 @@
#include <stdint.h>
#include "stm32f1xx_hal.h"
#include "unit.h"
#define SETTINGSVERSION ( 0x1E )
#define SETTINGSVERSION ( 0x1F )
/*Change this if you change the struct below to prevent people getting \
out of sync*/
@@ -21,6 +21,8 @@
* flash in uint16_t chunks
*/
typedef struct {
uint8_t version; // Used to track if a reset is needed on firmware upgrade
uint16_t SolderingTemp; // current set point for the iron
uint16_t SleepTemp; // temp to drop to in sleep
uint8_t SleepTime; // minutes timeout to sleep
@@ -37,25 +39,26 @@ typedef struct {
uint8_t detailedIDLE :1; // Detailed idle screen
uint8_t detailedSoldering :1; // Detailed soldering screens
#ifdef ENABLED_FAHRENHEIT_SUPPORT
uint8_t temperatureInF; // 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 KeepAwakePulse; // Keep Awake pulse power in 0.1 watts (10 = 1Watt)
uint16_t voltageDiv; // Voltage divisor factor
uint16_t BoostTemp; // Boost mode set point for the iron
uint16_t CalibrationOffset; // This stores the temperature offset for this tip
// in the iron.
uint8_t pidPowerLimit;
uint8_t powerLimitEnable; // Allow toggling of power limit without changing value
uint8_t powerLimit; // Maximum power iron allowed to output
uint8_t version; // Used to track if a reset is needed on firmware upgrade
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
uint32_t padding; // This is here for in case we are not an even divisor so
// that nothing gets cut off
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
//MUST BE LAST
} systemSettingsType;

View File

@@ -19,8 +19,8 @@ extern const uint8_t USER_FONT_6x8[];
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
*/
extern const enum ShortNameType SettingsShortNameType;
extern const char *SettingsShortNames[26][2];
extern const char *SettingsDescriptions[26];
extern const char *SettingsShortNames[27][2];
extern const char *SettingsDescriptions[27];
extern const char *SettingsMenuEntries[4];
extern const char *SettingsCalibrationDone;

View File

@@ -101,10 +101,10 @@ void resetSettings() {
systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow
systemSettings.powerLimitEnable = POWER_LIMIT_ENABLE; // Default to no power limit
systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV
systemSettings.pidPowerLimit = PID_POWER_LIMIT; // Sets the max pwm power limit
systemSettings.powerLimit = POWER_LIMIT; // 30 watts default limit
systemSettings.ReverseButtonTempChangeEnabled = REVERSE_BUTTON_TEMP_CHANGE; //
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; //
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; //
systemSettings.KeepAwakePulse= POWER_PULSE_DEFAULT;
saveSettings(); // Save defaults
}

View File

@@ -18,11 +18,11 @@ extern uint32_t lastButtonTime;
void gui_Menu(const menuitem *menu);
#ifdef MODEL_TS100
static void settings_setInputVRange(void);
static void settings_displayInputVRange(void);
static void settings_setInputVRange(void);
static void settings_displayInputVRange(void);
#else
static void settings_setInputPRange(void);
static void settings_displayInputPRange(void);
static void settings_setInputPRange(void);
static void settings_displayInputPRange(void);
#endif
static void settings_setSleepTemp(void);
static void settings_displaySleepTemp(void);
@@ -68,6 +68,8 @@ static void settings_displayTempChangeShortStep(void);
static void settings_setTempChangeShortStep(void);
static void settings_displayTempChangeLongStep(void);
static void settings_setTempChangeLongStep(void);
static void settings_displayPowerPulse(void);
static void settings_setPowerPulse(void);
// Menu functions
static void settings_displaySolderingMenu(void);
@@ -116,14 +118,14 @@ static void settings_enterAdvancedMenu(void);
*
*/
const menuitem rootSettingsMenu[] {
/*
* Power Source
* Soldering Menu
* Power Saving Menu
* UI Menu
* Advanced Menu
* Exit
*/
/*
* Power Source
* Soldering Menu
* Power Saving Menu
* UI Menu
* Advanced Menu
* Exit
*/
#ifdef MODEL_TS100
{ (const char*) SettingsDescriptions[0], { settings_setInputVRange }, {
settings_displayInputVRange } }, /*Voltage input*/
@@ -157,9 +159,9 @@ const menuitem solderingMenu[] = {
{ (const char*) SettingsDescriptions[10], { settings_setAutomaticStartMode }, {
settings_displayAutomaticStartMode } }, /*Auto start*/
{ (const char*) SettingsDescriptions[24], { settings_setTempChangeShortStep }, {
settings_displayTempChangeShortStep } }, /*Temp change short step*/
settings_displayTempChangeShortStep } }, /*Temp change short step*/
{ (const char*) SettingsDescriptions[25], { settings_setTempChangeLongStep }, {
settings_displayTempChangeLongStep } }, /*Temp change long step*/
settings_displayTempChangeLongStep } }, /*Temp change long step*/
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
};
const menuitem UIMenu[] = {
@@ -172,18 +174,21 @@ const menuitem UIMenu[] = {
* Reverse Temp change buttons + -
*/
#ifdef ENABLED_FAHRENHEIT_SUPPORT
{ (const char*) SettingsDescriptions[5], { settings_setTempF }, {
settings_displayTempF } }, /* Temperature units*/
{ (const char*) SettingsDescriptions[5], { settings_setTempF }, {
settings_displayTempF } }, /* Temperature units*/
#endif
{ (const char*) SettingsDescriptions[7], { settings_setDisplayRotation }, {
settings_displayDisplayRotation } }, /*Display Rotation*/
{ (const char*) SettingsDescriptions[11], { settings_setCoolingBlinkEnabled }, {
settings_displayCoolingBlinkEnabled } }, /*Cooling blink warning*/
{ (const char*) SettingsDescriptions[16], { settings_setScrollSpeed }, {
settings_displayScrollSpeed } }, /*Scroll Speed for descriptions*/
{ (const char*) SettingsDescriptions[23], { settings_setReverseButtonTempChangeEnabled }, {
settings_displayReverseButtonTempChangeEnabled } }, /* Reverse Temp change buttons + - */
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
{ (const char*) SettingsDescriptions[7],
{ settings_setDisplayRotation }, {
settings_displayDisplayRotation } }, /*Display Rotation*/
{ (const char*) SettingsDescriptions[11], {
settings_setCoolingBlinkEnabled }, {
settings_displayCoolingBlinkEnabled } }, /*Cooling blink warning*/
{ (const char*) SettingsDescriptions[16], { settings_setScrollSpeed }, {
settings_displayScrollSpeed } }, /*Scroll Speed for descriptions*/
{ (const char*) SettingsDescriptions[23], {
settings_setReverseButtonTempChangeEnabled }, {
settings_displayReverseButtonTempChangeEnabled } }, /* Reverse Temp change buttons + - */
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
};
const menuitem PowerMenu[] = {
/*
@@ -212,6 +217,7 @@ const menuitem advancedMenu[] = {
* Calibrate Temperature
* Calibrate Input V
* Reset Settings
* Power Pulse
*/
{ (const char*) SettingsDescriptions[21], { settings_setPowerLimitEnable }, {
settings_displayPowerLimitEnable } }, /*Power limit enable*/
@@ -228,6 +234,8 @@ const menuitem advancedMenu[] = {
settings_displayCalibrate } }, /*Calibrate tip*/
{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
settings_displayCalibrateVIN } }, /*Voltage input cal*/
{ (const char*) SettingsDescriptions[26], { settings_setPowerPulse }, {
settings_displayPowerPulse } }, /*Power Pulse adjustment */
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
};
@@ -366,8 +374,7 @@ static void settings_setSleepTemp(void) {
systemSettings.SleepTemp += 20;
if (systemSettings.SleepTemp > 580)
systemSettings.SleepTemp = 120;
}
else
} else
#endif
{
systemSettings.SleepTemp += 10;
@@ -487,12 +494,12 @@ static void settings_displayAdvancedIDLEScreens(void) {
}
static void settings_setPowerLimitEnable(void) {
systemSettings.powerLimitEnable = !systemSettings.powerLimitEnable;
systemSettings.powerLimitEnable = !systemSettings.powerLimitEnable;
}
static void settings_displayPowerLimitEnable(void) {
printShortDescription(21, 7);
OLED::drawCheckbox(systemSettings.powerLimitEnable);
printShortDescription(21, 7);
OLED::drawCheckbox(systemSettings.powerLimitEnable);
}
static void settings_setPowerLimit(void) {
@@ -503,9 +510,9 @@ static void settings_setPowerLimit(void) {
}
static void settings_displayPowerLimit(void) {
printShortDescription(22, 5);
OLED::printNumber(systemSettings.powerLimit, 2);
OLED::print(SymbolWatts);
printShortDescription(22, 5);
OLED::printNumber(systemSettings.powerLimit, 2);
OLED::print(SymbolWatts);
}
static void settings_setScrollSpeed(void) {
@@ -575,7 +582,7 @@ static void settings_setBoostTemp(void) {
if (systemSettings.BoostTemp > 850) {
systemSettings.BoostTemp = 480; // loop back at 250
}
} else
} else
#endif
{
systemSettings.BoostTemp += 10; // Go up 10C at a time
@@ -746,46 +753,64 @@ static void settings_setCalibrateVIN(void) {
}
static void settings_setReverseButtonTempChangeEnabled(void) {
systemSettings.ReverseButtonTempChangeEnabled = !systemSettings.ReverseButtonTempChangeEnabled;
systemSettings.ReverseButtonTempChangeEnabled =
!systemSettings.ReverseButtonTempChangeEnabled;
}
static void settings_displayReverseButtonTempChangeEnabled(void){
printShortDescription(23, 7);
OLED::drawCheckbox(systemSettings.ReverseButtonTempChangeEnabled);
static void settings_displayReverseButtonTempChangeEnabled(void) {
printShortDescription(23, 7);
OLED::drawCheckbox(systemSettings.ReverseButtonTempChangeEnabled);
}
static void settings_setTempChangeShortStep(void) {
systemSettings.TempChangeShortStep += TEMP_CHANGE_SHORT_STEP;
if (systemSettings.TempChangeShortStep > TEMP_CHANGE_SHORT_STEP_MAX) {
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; // loop back at TEMP_CHANGE_SHORT_STEP_MAX
}
systemSettings.TempChangeShortStep += TEMP_CHANGE_SHORT_STEP;
if (systemSettings.TempChangeShortStep > TEMP_CHANGE_SHORT_STEP_MAX) {
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; // loop back at TEMP_CHANGE_SHORT_STEP_MAX
}
}
static void settings_displayTempChangeShortStep(void) {
printShortDescription(24, 5);
OLED::printNumber(systemSettings.TempChangeShortStep, 3);
printShortDescription(24, 5);
OLED::printNumber(systemSettings.TempChangeShortStep, 3);
}
static void settings_setTempChangeLongStep(void) {
systemSettings.TempChangeLongStep += TEMP_CHANGE_LONG_STEP;
if (systemSettings.TempChangeLongStep > TEMP_CHANGE_LONG_STEP_MAX) {
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; // loop back at TEMP_CHANGE_LONG_STEP_MAX
}
systemSettings.TempChangeLongStep += TEMP_CHANGE_LONG_STEP;
if (systemSettings.TempChangeLongStep > TEMP_CHANGE_LONG_STEP_MAX) {
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; // loop back at TEMP_CHANGE_LONG_STEP_MAX
}
}
static void settings_displayTempChangeLongStep(void) {
printShortDescription(25, 5);
OLED::printNumber(systemSettings.TempChangeLongStep, 3);
printShortDescription(25, 5);
OLED::printNumber(systemSettings.TempChangeLongStep, 3);
}
static void settings_setPowerPulse(void) {
systemSettings.KeepAwakePulse += POWER_PULSE_INCREMENT;
systemSettings.KeepAwakePulse %= POWER_PULSE_MAX;
}
static void settings_displayPowerPulse(void) {
printShortDescription(26, 5);
if (systemSettings.KeepAwakePulse) {
OLED::printNumber(systemSettings.KeepAwakePulse / 10, 1);
OLED::print(SymbolDot);
OLED::printNumber(systemSettings.KeepAwakePulse % 10, 1);
} else {
OLED::drawCheckbox(false);
}
}
static void displayMenu(size_t index) {
// Call into the menu
// Call into the menu
OLED::setFont(1);
OLED::setCursor(0, 0);
// Draw title
// Draw title
OLED::print(SettingsMenuEntries[index]);
// Draw symbol
// 16 pixel wide image
// 2 pixel wide scrolling indicator
OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
// Draw symbol
// 16 pixel wide image
// 2 pixel wide scrolling indicator
OLED::drawArea(96 - 16 - 2, 0, 16, 16,
(&SettingsMenuIcons[(16 * 2) * index]));
}
static void settings_displayCalibrateVIN(void) {
@@ -817,7 +842,7 @@ static void settings_enterAdvancedMenu(void) {
}
void gui_Menu(const menuitem *menu) {
// Draw the settings menu and provide iteration support etc
// Draw the settings menu and provide iteration support etc
uint8_t currentScreen = 0;
uint32_t autoRepeatTimer = 0;
uint8_t autoRepeatAcceleration = 0;
@@ -834,7 +859,7 @@ void gui_Menu(const menuitem *menu) {
scrollContentSize += 1;
}
// Animated menu opening.
// Animated menu opening.
if (menu[currentScreen].draw.func != NULL) {
// This menu is drawn in a secondary framebuffer.
// Then we play a transition from the current primary
@@ -874,7 +899,7 @@ void gui_Menu(const menuitem *menu) {
((xTaskGetTickCount() - descriptionStart)
/ (systemSettings.descriptionScrollSpeed == 1 ?
1 : 2));
descriptionOffset %= descriptionWidth; // Roll around at the end
descriptionOffset %= descriptionWidth; // Roll around at the end
if (lastOffset != descriptionOffset) {
OLED::clearScreen();
OLED::setCursor((OLED_WIDTH - descriptionOffset), 0);

View File

@@ -36,16 +36,13 @@ uint32_t MOVTaskBuffer[MOVTaskStackSize];
osStaticThreadDef_t MOVTaskControlBlock;
static TaskHandle_t pidTaskNotification = NULL;
static TickType_t powerPulseRate = 1000;
static TickType_t powerPulseDuration = 50;
void startGUITask(void const *argument);
void startPIDTask(void const *argument);
void startMOVTask(void const *argument);
// End FreeRTOS
static const int maxPowerIdleTicks = 1000;
static const int powerPulseTicks = 50;
static const int x10PowerPulseWatts = 3;
// Main sets up the hardware then hands over to the FreeRTOS kernel
int main(void) {
/* Reset of all peripherals, Initializes the Flash interface and the Systick.
@@ -113,14 +110,9 @@ void startPIDTask(void const *argument __unused) {
* control PWM.
*/
setTipX10Watts(0); // disable the output driver if the output is set to be off
TickType_t lastPowerPulseStart = 0;
TickType_t lastPowerPulseEnd = 0;
#ifdef MODEL_TS80
//Set power management code to the tip resistance in ohms * 10
TickType_t lastPowerPulse = 0;
#else
#endif
history<int32_t, PID_TIM_HZ> tempError = { { 0 }, 0, 0 };
currentTempTargetDegC = 0; // Force start with no output (off). If in sleep / soldering this will
// be over-ridden rapidly
@@ -183,18 +175,23 @@ void startPIDTask(void const *argument __unused) {
// Unfortunately, our temp signal is too noisy to really help.
}
#ifdef MODEL_TS80
//If its a TS80, we want to have the option of using an occasional pulse to keep the power bank on
if (((xTaskGetTickCount() - lastPowerPulse) > maxPowerIdleTicks)
&& (x10WattsOut < x10PowerPulseWatts)) {
x10WattsOut = x10PowerPulseWatts;
//If the user turns on the option of using an occasional pulse to keep the power bank on
if (systemSettings.KeepAwakePulse) {
if (xTaskGetTickCount() - lastPowerPulseStart
> powerPulseRate) {
lastPowerPulseStart = xTaskGetTickCount();
lastPowerPulseEnd = lastPowerPulseStart
+ powerPulseDuration;
}
//If current PID is less than the pulse level, check if we want to constrain to the pulse as the floor
if (x10WattsOut < systemSettings.KeepAwakePulse
&& xTaskGetTickCount() < lastPowerPulseEnd) {
x10WattsOut = systemSettings.KeepAwakePulse;
}
}
if (((xTaskGetTickCount() - lastPowerPulse)
> (maxPowerIdleTicks + powerPulseTicks))
&& (x10WattsOut >= x10PowerPulseWatts)) {
lastPowerPulse = xTaskGetTickCount();
}
#endif
//Secondary safety check to forcefully disable header when within ADC noise of top of ADC
if (getTipRawTemp(0) > (0x7FFF - 150)) {
x10WattsOut = 0;
@@ -263,8 +260,7 @@ void startMOVTask(void const *argument __unused) {
datax[currentPointer] = (int32_t) tx;
datay[currentPointer] = (int32_t) ty;
dataz[currentPointer] = (int32_t) tz;
if (!accelInit)
{
if (!accelInit) {
for (uint8_t i = currentPointer + 1; i < MOVFilter; i++) {
datax[i] = (int32_t) tx;
datay[i] = (int32_t) ty;
@@ -304,19 +300,20 @@ void startMOVTask(void const *argument __unused) {
// Second last page of flash set aside for logo image.
#define FLASH_LOGOADDR (0x8000000 | 0xF800)
// Logo header signature.
#define LOGO_HEADER_VALUE 0xF00DAA55
bool showBootLogoIfavailable() {
// Do not show logo data if signature is not found.
if (LOGO_HEADER_VALUE != *(reinterpret_cast<const uint32_t *>(FLASH_LOGOADDR))) {
return false;
}
// Do not show logo data if signature is not found.
if (LOGO_HEADER_VALUE
!= *(reinterpret_cast<const uint32_t*>(FLASH_LOGOADDR))) {
return false;
}
OLED::drawAreaSwapped(0, 0, 96, 16, (uint8_t*) (FLASH_LOGOADDR + 4));
OLED::refresh();
return true;
OLED::drawAreaSwapped(0, 0, 96, 16, (uint8_t*) (FLASH_LOGOADDR + 4));
OLED::refresh();
return true;
}
/*
@@ -344,12 +341,10 @@ void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
FRToSI2C::CpltCallback();
}
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) {
asm("bkpt");
FRToSI2C::CpltCallback();
}
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
//asm("bkpt");
FRToSI2C::CpltCallback();
}
@@ -358,7 +353,7 @@ void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
}
void vApplicationStackOverflowHook(xTaskHandle *pxTask __unused,
signed portCHAR *pcTaskName __unused) {
asm("bkpt");
// We dont have a good way to handle a stack overflow at this point in time
// We dont have a good way to handle a stack overflow at this point in time
NVIC_SystemReset();
}

View File

@@ -54,7 +54,14 @@
#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value
#define TEMP_CHANGE_LONG_STEP_MAX 100 // Temp change long step MAX value
/* Power pulse for keeping power banks awake*/
#define POWER_PULSE_INCREMENT 1
#define POWER_PULSE_MAX 50 // x10 max watts
#ifdef MODEL_TS100
#define POWER_PULSE_DEFAULT 0
#else
#define POWER_PULSE_DEFAULT 5
#endif
/**
* OLED Orientation Sensitivity on Automatic mode!
* Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive>
@@ -105,4 +112,4 @@
#define OP_AMP_Rf 180*1000 // 180 Kilo-ohms -> From schematic, R6
#define OP_AMP_Rin 2000 // 2.0 Kilo-ohms -> From schematic, R3
#define TIP_GAIN 115
#endif
#endif