mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -195,7 +195,7 @@
|
||||
#define POWER_LIMIT_STEPS 5
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100
|
||||
#define TEMP_uV_LOOKUP_HAKKO
|
||||
#define ACCEL_LIS_CLONE 1
|
||||
#define ACCEL_LIS_CLONE 1
|
||||
#define HARDWARE_MAX_WATTAGE_X10 1000
|
||||
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
|
||||
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips
|
||||
@@ -273,7 +273,12 @@
|
||||
#endif /* TS80P */
|
||||
|
||||
#ifdef MODEL_TS101
|
||||
#define FLASH_LOGOADDR (0x08000000 + (126 * 1024))
|
||||
// For whatever reason, Miniware decided to not build a reliable DFU bootloader
|
||||
// It can't appear to flash to some of the upper pages of flash,
|
||||
// I'm slightly suspect a watchdog or something runs out
|
||||
// as device resets before file finishes copying
|
||||
// So logo has to be located on page 99 or else it cant be flashed on stock bootloader
|
||||
#define FLASH_LOGOADDR (0x08000000 + (99 * 1024))
|
||||
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
||||
#else
|
||||
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
|
||||
|
||||
@@ -73,8 +73,9 @@ enum SettingsOptions {
|
||||
ProfilePhase5Temp = 50, // Temperature to target for the end of phase 5
|
||||
ProfilePhase5Duration = 51, // Target duration for phase 5
|
||||
ProfileCooldownSpeed = 52, // Maximum allowed cooldown speed in degrees per second
|
||||
HallEffectSleepTime = 53, // Seconds (/5) timeout to sleep when hall effect over threshold
|
||||
//
|
||||
SettingsOptionsLength = 53, //
|
||||
SettingsOptionsLength = 54, //
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -84,6 +84,7 @@ enum class SettingsItemIndex : uint8_t {
|
||||
SleepTimeout,
|
||||
ShutdownTimeout,
|
||||
HallEffSensitivity,
|
||||
HallEffSleepTimeout,
|
||||
TemperatureUnit,
|
||||
DisplayRotation,
|
||||
CooldownBlink,
|
||||
|
||||
@@ -104,6 +104,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
|
||||
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePhase5Temp
|
||||
{ 10, 180, 5, 30}, // ProfilePhase5Duration
|
||||
{ 1, 10, 1, 2}, // ProfileCooldownSpeed
|
||||
{ 0, 12, 1, 0}, // HallEffectSleepTime
|
||||
};
|
||||
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ static void displayLogoTime(void);
|
||||
|
||||
#ifdef HALL_SENSOR
|
||||
static void displayHallEffect(void);
|
||||
static void displayHallEffectSleepTime(void);
|
||||
static bool showHallEffect(void);
|
||||
#endif /* HALL_SENSOR */
|
||||
|
||||
@@ -162,6 +163,7 @@ static void displayAdvancedMenu(void);
|
||||
* -Sleep Time
|
||||
* -Shutdown Time
|
||||
* Hall Sensor Sensitivity
|
||||
* Hall Sensor Sleep Time
|
||||
*
|
||||
* UI
|
||||
* Temperature Unit
|
||||
@@ -346,6 +348,8 @@ const menuitem PowerSavingMenu[] = {
|
||||
#ifdef HALL_SENSOR
|
||||
/* Hall Effect Sensitivity */
|
||||
{SETTINGS_DESC(SettingsItemIndex::HallEffSensitivity), nullptr, displayHallEffect, showHallEffect, SettingsOptions::HallEffectSensitivity, SettingsItemIndex::HallEffSensitivity, 7},
|
||||
/* Hall Effect Sleep Time */
|
||||
{SETTINGS_DESC(SettingsItemIndex::HallEffSleepTimeout), nullptr, displayHallEffectSleepTime, showHallEffect, SettingsOptions::HallEffectSleepTime, SettingsItemIndex::HallEffSleepTimeout, 5},
|
||||
#endif /* HALL_SENSOR */
|
||||
/* vvvv end of menu marker. DO NOT REMOVE vvvv */
|
||||
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0}
|
||||
@@ -740,6 +744,16 @@ static void displayHallEffect(void) {
|
||||
}
|
||||
}
|
||||
static bool showHallEffect(void) { return getHallSensorFitted(); }
|
||||
static void displayHallEffectSleepTime(void) {
|
||||
if (getSettingValue(SettingsOptions::HallEffectSleepTime)) {
|
||||
OLED::printNumber(getSettingValue(SettingsOptions::HallEffectSleepTime) * 5, 2, FontStyle::LARGE, false);
|
||||
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
|
||||
} else {
|
||||
// When sleep time is set to zero, we sleep for 1 second anyways. This is the default.
|
||||
OLED::printNumber(1, 2, FontStyle::LARGE, false);
|
||||
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
|
||||
}
|
||||
}
|
||||
#endif /* HALL_SENSOR */
|
||||
|
||||
static void setTempF(const enum SettingsOptions option) {
|
||||
|
||||
@@ -11,4 +11,14 @@
|
||||
/* Functions */
|
||||
void initialise_monitor_handles() {}
|
||||
|
||||
/* Syscalls (stub implementations to avoid compile warnings and possibe future problems) */
|
||||
int _getpid(void) { return 1; }
|
||||
|
||||
#if defined(MODEL_Pinecil) || defined(MODEL_Pinecilv2)
|
||||
// do nothing here because some stubs and real implementations added for Pinecils already
|
||||
#else
|
||||
off_t _lseek(int fd, off_t ptr, int dir) { return -1; }
|
||||
ssize_t _read(int fd, void *ptr, size_t len) { return -1; }
|
||||
ssize_t _write(int fd, const void *ptr, size_t len) { return -1; }
|
||||
int _close(int fd) { return -1; }
|
||||
#endif
|
||||
|
||||
@@ -66,6 +66,7 @@ struct guiContext {
|
||||
uint32_t state4; // 32 bit state scratch
|
||||
uint16_t state5; // 16 bit state scratch
|
||||
uint16_t state6; // 16 bit state scratch
|
||||
uint32_t state7; // 32 bit state scratch
|
||||
|
||||
} scratch_state;
|
||||
};
|
||||
|
||||
@@ -9,26 +9,39 @@
|
||||
OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) {
|
||||
if (cxt->scratch_state.state1 >= 2) {
|
||||
// Buttons are currently locked
|
||||
switch (buttons) {
|
||||
case BUTTON_F_LONG:
|
||||
if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) {
|
||||
cxt->scratch_state.state2 = 1;
|
||||
}
|
||||
break;
|
||||
case BUTTON_BOTH_LONG:
|
||||
if (buttons == BUTTON_BOTH_LONG) {
|
||||
if (cxt->scratch_state.state1 == 3) {
|
||||
// Unlocking
|
||||
if (warnUser(translatedString(Tr->UnlockingKeysString), buttons)) {
|
||||
cxt->scratch_state.state1 = 1;
|
||||
cxt->scratch_state.state7 = 0;
|
||||
}
|
||||
} else {
|
||||
warnUser(translatedString(Tr->WarningKeysLockedString), buttons);
|
||||
warnUser(translatedString(Tr->LockingKeysString), buttons);
|
||||
}
|
||||
break;
|
||||
return OperatingMode::Soldering;
|
||||
}
|
||||
if (cxt->scratch_state.state7 != 0) {
|
||||
// show locked until timer is up
|
||||
if (xTaskGetTickCount() >= cxt->scratch_state.state7) {
|
||||
cxt->scratch_state.state7 = 0;
|
||||
} else {
|
||||
warnUser(translatedString(Tr->WarningKeysLockedString), buttons);
|
||||
return OperatingMode::Soldering;
|
||||
}
|
||||
}
|
||||
switch (buttons) {
|
||||
case BUTTON_NONE:
|
||||
cxt->scratch_state.state1 = 3;
|
||||
break;
|
||||
default: // Do nothing and display a lock warning
|
||||
case BUTTON_F_LONG:
|
||||
if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) {
|
||||
cxt->scratch_state.state2 = 1;
|
||||
break;
|
||||
}
|
||||
/*Fall through*/
|
||||
default: // Set timer for and display a lock warning
|
||||
cxt->scratch_state.state7 = xTaskGetTickCount() + TICKS_SECOND;
|
||||
warnUser(translatedString(Tr->WarningKeysLockedString), buttons);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
void GUIDelay(); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint32_t getSleepTimeout(void); //
|
||||
uint32_t getHallEffectSleepTimeout(void); //
|
||||
bool shouldBeSleeping(); //
|
||||
bool shouldShutdown(void); //
|
||||
void printVoltage(void); //
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "OperatingModeUtilities.h"
|
||||
|
||||
#ifndef NO_SLEEP_MODE
|
||||
#ifdef HALL_SENSOR
|
||||
uint32_t getHallEffectSleepTimeout(void) {
|
||||
if (getSettingValue(SettingsOptions::HallEffectSensitivity) && getSettingValue(SettingsOptions::HallEffectSleepTime)) {
|
||||
uint32_t sleepThres = getSettingValue(SettingsOptions::HallEffectSleepTime) * 5 * TICKS_SECOND;
|
||||
return sleepThres;
|
||||
}
|
||||
return TICKS_SECOND;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -32,7 +32,7 @@ bool shouldBeSleeping() {
|
||||
if (lastHallEffectSleepStart == 0) {
|
||||
lastHallEffectSleepStart = xTaskGetTickCount();
|
||||
}
|
||||
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > TICKS_SECOND) {
|
||||
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > getHallEffectSleepTimeout()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user