Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: apk add --no-cache gcc-riscv-none-elf g++-riscv-none-elf gcc-arm-none-eabi g++-arm-none-eabi newlib-riscv-none-elf newlib-arm-none-eabi findutils python3 py3-pip make git bash

- name: Install dependencies (python)
run: python3 -m pip install --break-system-packages bdflib
run: python3 -m pip install --break-system-packages bdflib pyyaml

- uses: actions/checkout@v6
with:
Expand Down Expand Up @@ -82,8 +82,7 @@ jobs:
- name: Install dependencies (apk)
run: apk add --no-cache gcc-riscv-none-elf g++-riscv-none-elf gcc-arm-none-eabi g++-arm-none-eabi newlib-riscv-none-elf newlib-arm-none-eabi findutils python3 py3-pip make git bash musl-dev
- name: Install dependencies (python)
run: python3 -m pip install --break-system-packages bdflib

run: python3 -m pip install --break-system-packages bdflib pyyaml
- uses: actions/checkout@v6
with:
submodules: true
Expand Down Expand Up @@ -149,7 +148,7 @@ jobs:
submodules: true

- name: Install dependencies (python)
run: python3 -m pip install --break-system-packages bdflib
run: python3 -m pip install --break-system-packages bdflib pyyaml

- name: Run python tests
run: ./Translations/make_translation_test.py
Expand Down Expand Up @@ -196,7 +195,7 @@ jobs:
submodules: true

- name: Install dependencies (python)
run: python3 -m pip install --break-system-packages bdflib flake8
run: python3 -m pip install --break-system-packages bdflib pyyaml flake8

- name: Check python formatting with black
run: black --diff --check Translations
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DOCKER_FILE=$(CURDIR)/scripts/IronOS.Dockerfile
DOCKER_DEPS=$(DOCKER_YML) $(DOCKER_FILE)

# compose docker-compose command
DOCKER_CMD=$(DOCKER_BIN) -f $(DOCKER_YML) run --rm builder
DOCKER_CMD=$(DOCKER_BIN) -f $(DOCKER_YML) run --rm builder

# MkDocs config
MKDOCS_YML=$(CURDIR)/scripts/IronOS-mkdocs.yml
Expand Down
2 changes: 1 addition & 1 deletion scripts/IronOS.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ARG APK_MISC="findutils make git diffutils zip"
ARG APK_DEV="musl-dev clang bash clang-extra-tools shellcheck"

# PIP packages to check & test Python code, and generate docs
ARG PIP_PKGS='bdflib flake8 pymdown-extensions mkdocs mkdocs-autolinks-plugin mkdocs-awesome-pages-plugin mkdocs-git-revision-date-plugin'
ARG PIP_PKGS='bdflib flake8 pymdown-extensions mkdocs mkdocs-autolinks-plugin mkdocs-awesome-pages-plugin mkdocs-git-revision-date-plugin pyyaml'

# Install system packages using alpine package manager
RUN apk add --no-cache ${APK_COMPS} ${APK_PYTHON} ${APK_MISC} ${APK_DEV}
Expand Down
30 changes: 27 additions & 3 deletions source/Core/Inc/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define CORE_SETTINGS_H_
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
#ifdef MODEL_Pinecilv2
// Required settings reset for PR #1916
#define SETTINGSVERSION (0x55AB) // This number is frozen, do not edit
Expand Down Expand Up @@ -81,6 +82,27 @@ enum SettingsOptions {
SettingsOptionsLength = 56, // End marker
};

// For every setting we need to store the min/max/increment values
typedef struct {
const uint16_t min; // Inclusive minimum value
const uint16_t max; // Inclusive maximum value
const uint16_t increment; // Standard increment
const uint16_t defaultValue; // Default vaue after reset
} SettingConstants;
extern const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOptionsLength];
/*
* This struct must be a multiple of 2 bytes as it is saved / restored from
* flash in uint16_t chunks
*/
typedef struct {
uint16_t versionMarker;
uint16_t length; // Length of valid bytes following
uint16_t settingsValues[SettingsOptionsLength];
// used to make this nicely "good enough" aligned to 32 bytes to make driver code trivial
uint32_t padding;

} systemSettingsType;

typedef enum {
OFF = 0, // Off (disabled)
SLOW = 1, //
Expand Down Expand Up @@ -170,12 +192,14 @@ bool isLastSettingValue(const enum SettingsOptions option);
void setSettingValue(const enum SettingsOptions option, const uint16_t newValue);

// Special access helpers, to reduce logic duplication
uint8_t lookupVoltageLevel();
uint16_t lookupHallEffectThreshold();
uint8_t lookupVoltageLevel();
uint16_t lookupHallEffectThreshold();
#ifdef TIP_TYPE_SUPPORT
const char *lookupTipName(); // Get the name string for the current soldering tip
#endif /* TIP_TYPE_SUPPORT */
#endif /* TIP_TYPE_SUPPORT */
#ifdef BLE_ENABLED
void setBluetoothLE(void);
#endif /* BLE_ENABLED */
#endif // c++ guard

#endif /* SETTINGS_H_ */
85 changes: 0 additions & 85 deletions source/Core/Src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,94 +26,9 @@ bool sanitiseSettings();
#define QC_VOLTAGE_MAX 140
#endif /* POW_QC_20V */

/*
* This struct must be a multiple of 2 bytes as it is saved / restored from
* flash in uint16_t chunks
*/
typedef struct {
uint16_t versionMarker;
uint16_t length; // Length of valid bytes following
uint16_t settingsValues[SettingsOptionsLength];
// used to make this nicely "good enough" aligned to 32 bytes to make driver code trivial
uint32_t padding;

} systemSettingsType;

//~1024 is common programming size, setting threshold to be lower so we have warning
static_assert(sizeof(systemSettingsType) < 512);

// char (*__kaboom)[sizeof(systemSettingsType)] = 1; // Uncomment to print size at compile time
volatile systemSettingsType systemSettings;

// For every setting we need to store the min/max/increment values
typedef struct {
const uint16_t min; // Inclusive minimum value
const uint16_t max; // Inclusive maximum value
const uint16_t increment; // Standard increment
const uint16_t defaultValue; // Default vaue after reset
} SettingConstants;

static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOptionsLength] = {
//{ min, max, increment, default}
{ MIN_TEMP_C, MAX_TEMP_F, 5, SOLDERING_TEMP}, // SolderingTemp
{ MIN_TEMP_C, MAX_TEMP_F, 5, 150}, // SleepTemp
{ 0, 15, 1, SLEEP_TIME}, // SleepTime
{ 0, 4, 1, CUT_OUT_SETTING}, // MinDCVoltageCells
{ 24, 38, 1, RECOM_VOL_CELL}, // MinVoltageCells
{ 90, QC_VOLTAGE_MAX, 2, 90}, // QCIdealVoltage
{ 0, MAX_ORIENTATION_MODE, 1, ORIENTATION_MODE}, // OrientationMode
{ 0, 9, 1, SENSITIVITY}, // Sensitivity
{ 0, 1, 1, ANIMATION_LOOP}, // AnimationLoop
{ 0, settingOffSpeed_t::MAX_VALUE - 1, 1, ANIMATION_SPEED}, // AnimationSpeed
{ 0, 3, 1, AUTO_START_MODE}, // AutoStartMode
{ 0, 60, 1, SHUTDOWN_TIME}, // ShutdownTime
{ 0, 1, 1, COOLING_TEMP_BLINK}, // CoolingTempBlink
{ 0, 1, 1, DETAILED_IDLE}, // DetailedIDLE
{ 0, 1, 1, DETAILED_SOLDERING}, // DetailedSoldering
{ 0, (uint16_t)(HasFahrenheit ? 1 : 0), 1, TEMPERATURE_INF}, // TemperatureInF
{ 0, 1, 1, DESCRIPTION_SCROLL_SPEED}, // DescriptionScrollSpeed
{ 0, 2, 1, LOCKING_MODE}, // LockingMode
{ 0, 99, 1, POWER_PULSE_DEFAULT}, // KeepAwakePulse
{ 1, POWER_PULSE_WAIT_MAX, 1, POWER_PULSE_WAIT_DEFAULT}, // KeepAwakePulseWait
{ 1, POWER_PULSE_DURATION_MAX, 1, POWER_PULSE_DURATION_DEFAULT}, // KeepAwakePulseDuration
{ 360, 900, 1, VOLTAGE_DIV}, // VoltageDiv
{ 0, MAX_TEMP_F, 10, BOOST_TEMP}, // BoostTemp
{MIN_CALIBRATION_OFFSET, 2500, 1, CALIBRATION_OFFSET}, // CalibrationOffset
{ 0, MAX_POWER_LIMIT, POWER_LIMIT_STEPS, POWER_LIMIT}, // PowerLimit
{ 0, 1, 1, REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
{ 5, TEMP_CHANGE_LONG_STEP_MAX, 5, TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
{ 1, TEMP_CHANGE_SHORT_STEP_MAX, 1, TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
{ 0, 9, 1, 7}, // HallEffectSensitivity
{ 0, 9, 1, 0}, // AccelMissingWarningCounter
{ 0, 9, 1, 0}, // PDMissingWarningCounter
{ 0, 0xFFFF, 0, 41431 /*EN*/}, // UILanguage
{ 0, 50, 1, 20}, // PDNegTimeout
{ 0, 1, 1, 0}, // OLEDInversion
{ MIN_BRIGHTNESS, MAX_BRIGHTNESS, BRIGHTNESS_STEP, DEFAULT_BRIGHTNESS}, // OLEDBrightness
{ 0, 6, 1, 1}, // LOGOTime
{ 0, 1, 1, 0}, // CalibrateCJC
{ 0, 2, 1, 0}, // BluetoothLE
{ 0, 2, 1, 0}, // USBPDMode
{ 1, 5, 1, 4}, // ProfilePhases
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePreheatTemp
{ 1, 10, 1, 1}, // ProfilePreheatSpeed
{ MIN_TEMP_C, MAX_TEMP_F, 5, 130}, // ProfilePhase1Temp
{ 10, 180, 5, 90}, // ProfilePhase1Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase2Temp
{ 10, 180, 5, 30}, // ProfilePhase2Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 165}, // ProfilePhase3Temp
{ 10, 180, 5, 30}, // ProfilePhase3Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase4Temp
{ 10, 180, 5, 30}, // ProfilePhase4Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePhase5Temp
{ 10, 180, 5, 30}, // ProfilePhase5Duration
{ 1, 10, 1, 2}, // ProfileCooldownSpeed
{ 0, 12, 1, 0}, // HallEffectSleepTime
{ 0, (tipType_t::TIP_TYPE_MAX - 1) > 0 ? (tipType_t::TIP_TYPE_MAX - 1) : 0, 1, 0}, // SolderingTipType
{ 0, 1, 1, 0}, // ReverseButtonSettings
};
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));

#ifdef BLE_ENABLED
static int16_t bleValueOnEntry = -1;

Expand Down
Loading