mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
PowerLimit
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#define SETTINGS_H_
|
||||
#include <stdint.h>
|
||||
#include "stm32f1xx_hal.h"
|
||||
#define SETTINGSVERSION ( 0x1B )
|
||||
#define SETTINGSVERSION ( 0x1C )
|
||||
/*Change this if you change the struct below to prevent people getting \
|
||||
out of sync*/
|
||||
|
||||
@@ -42,9 +42,11 @@ typedef struct {
|
||||
uint16_t CalibrationOffset; // This stores the temperature offset for this tip
|
||||
// in the iron.
|
||||
|
||||
uint8_t customTipGain; // Tip gain value if custom tuned, or 0 if using a
|
||||
// tipType param
|
||||
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
|
||||
uint32_t padding; // This is here for in case we are not an even divisor so
|
||||
// that nothing gets cut off
|
||||
|
||||
@@ -18,8 +18,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[21][2];
|
||||
extern const char* SettingsDescriptions[21];
|
||||
extern const char* SettingsShortNames[23][2];
|
||||
extern const char* SettingsDescriptions[23];
|
||||
extern const char* SettingsMenuEntries[4];
|
||||
|
||||
extern const char* SettingsCalibrationDone;
|
||||
|
||||
@@ -101,16 +101,16 @@ void resetSettings() {
|
||||
systemSettings.coolingTempBlink = 0; // Blink the temperature on the cooling screen when its > 50C
|
||||
systemSettings.temperatureInF = 0; // default to 0
|
||||
systemSettings.descriptionScrollSpeed = 0; // default to slow
|
||||
|
||||
systemSettings.powerLimitEnable = 0; // Default to no power limit
|
||||
#ifdef MODEL_TS100
|
||||
systemSettings.CalibrationOffset = 900; // the adc offset in uV
|
||||
systemSettings.pidPowerLimit=70; // Sets the max pwm power limit
|
||||
|
||||
systemSettings.CalibrationOffset = 900; // the adc offset in uV
|
||||
systemSettings.pidPowerLimit = 70; // Sets the max pwm power limit
|
||||
systemSettings.powerLimit = 30; // 30 watts default limit
|
||||
#endif
|
||||
#ifdef MODEL_TS80
|
||||
systemSettings.pidPowerLimit = 24; // Sets the max pwm power limit
|
||||
|
||||
systemSettings.CalibrationOffset = 900; // the adc offset in uV
|
||||
systemSettings.powerLimit = 24; // 24 watts default power limit
|
||||
#endif
|
||||
saveSettings(); // Save defaults
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,7 +37,10 @@ static void settings_setAdvancedIDLEScreens(void);
|
||||
static void settings_displayAdvancedIDLEScreens(void);
|
||||
static void settings_setScrollSpeed(void);
|
||||
static void settings_displayScrollSpeed(void);
|
||||
|
||||
static void settings_setPowerLimitEnable(void);
|
||||
static void settings_displayPowerLimitEnable(void);
|
||||
static void settings_setPowerLimit(void);
|
||||
static void settings_displayPowerLimit(void);
|
||||
static void settings_setDisplayRotation(void);
|
||||
static void settings_displayDisplayRotation(void);
|
||||
static void settings_setBoostModeEnabled(void);
|
||||
@@ -87,6 +90,8 @@ static void settings_enterAdvancedMenu(void);
|
||||
* Cooldown blink
|
||||
*
|
||||
* Advanced
|
||||
* Enable Power Limit
|
||||
* Power Limit
|
||||
* Detailed IDLE
|
||||
* Detailed Soldering
|
||||
* Logo Time
|
||||
@@ -174,13 +179,18 @@ const menuitem PowerMenu[] = {
|
||||
const menuitem advancedMenu[] = {
|
||||
|
||||
/*
|
||||
* Detailed IDLE
|
||||
* Power limit enable
|
||||
* Power limit
|
||||
* Detailed IDLE
|
||||
* Detailed Soldering
|
||||
* Logo Time
|
||||
* Calibrate Temperature
|
||||
* Calibrate Input V
|
||||
* Reset Settings
|
||||
*/
|
||||
{ (const char*) SettingsDescriptions[21], { settings_setPowerLimitEnable }, {
|
||||
settings_displayPowerLimitEnable } }, /*Power limit enable*/
|
||||
{ (const char*) SettingsDescriptions[22], { settings_setPowerLimit }, {
|
||||
settings_displayPowerLimit } }, /*Power limit*/
|
||||
{ (const char*) SettingsDescriptions[6], { settings_setAdvancedIDLEScreens }, {
|
||||
settings_displayAdvancedIDLEScreens } }, /* Advanced idle screen*/
|
||||
{ (const char*) SettingsDescriptions[15],
|
||||
@@ -281,6 +291,8 @@ static int userConfirmation(const char *message) {
|
||||
#ifdef MODEL_TS100
|
||||
static void settings_setInputVRange(void) {
|
||||
systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5;
|
||||
if (systemSettings.cutoutSetting)
|
||||
systemSettings.powerLimitEnable = 0; // disable power limit if switching to a lipo power source
|
||||
}
|
||||
|
||||
static void settings_displayInputVRange(void) {
|
||||
@@ -440,6 +452,37 @@ static void settings_displayAdvancedIDLEScreens(void) {
|
||||
|
||||
OLED::drawCheckbox(systemSettings.detailedIDLE);
|
||||
}
|
||||
|
||||
static void settings_setPowerLimitEnable(void) {
|
||||
systemSettings.powerLimitEnable = !systemSettings.powerLimitEnable;
|
||||
}
|
||||
|
||||
static void settings_displayPowerLimitEnable(void) {
|
||||
printShortDescription(21, 7);
|
||||
OLED::drawCheckbox(systemSettings.powerLimitEnable);
|
||||
}
|
||||
|
||||
static void settings_setPowerLimit(void) {
|
||||
#ifdef MODEL_TS100
|
||||
if (systemSettings.powerLimit >= 65)
|
||||
systemSettings.powerLimit = 5;
|
||||
else
|
||||
systemSettings.powerLimit += 5;
|
||||
#endif
|
||||
#ifdef MODEL_TS80
|
||||
if(systemSettings.powerLimit >= 30)
|
||||
systemSettings.powerLimit = 2;
|
||||
else
|
||||
systemSettings.powerLimit += 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void settings_displayPowerLimit(void) {
|
||||
printShortDescription(22, 5);
|
||||
OLED::printNumber(systemSettings.powerLimit, 2);
|
||||
OLED::print(SymbolWatts);
|
||||
}
|
||||
|
||||
static void settings_setScrollSpeed(void) {
|
||||
if (systemSettings.descriptionScrollSpeed == 0)
|
||||
systemSettings.descriptionScrollSpeed = 1;
|
||||
|
||||
@@ -189,7 +189,11 @@ void startPIDTask(void const *argument __unused) {
|
||||
lastPowerPulse = xTaskGetTickCount();
|
||||
}
|
||||
#endif
|
||||
setTipX10Watts(x10WattsOut);
|
||||
|
||||
if (systemSettings.powerLimitEnable && x10WattsOut > (systemSettings.powerLimit * 10))
|
||||
setTipX10Watts(systemSettings.powerLimit * 10);
|
||||
else
|
||||
setTipX10Watts(x10WattsOut);
|
||||
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user