Skip to content
Open
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@v4
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@v4
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
28 changes: 25 additions & 3 deletions source/Core/Inc/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,28 @@ 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,9 +192,9 @@ 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 */
#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, 1, 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));

void saveSettings() {
#ifdef CANT_DIRECT_READ_SETTINGS
// For these devices flash is not 1:1 mapped, so need to read into staging buffer
Expand Down
27 changes: 24 additions & 3 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ flash_size=62k
ifeq ($(model), S60P)
bootldr_size=0x5000
DEVICE_DFU_ADDRESS=0x08005000
else
else
# S60 or T55
bootldr_size=0x4400
DEVICE_DFU_ADDRESS=0x08004400
Expand Down Expand Up @@ -502,10 +502,12 @@ $(HEXFILE_DIR)/$(model)_%.elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
$(OUTPUT_DIR)/Core/Gen/Translation.$*.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,[email protected]
Expand All @@ -514,10 +516,12 @@ $(HEXFILE_DIR)/$(model)_string_compressed_%.elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz.$*.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,[email protected]
Expand All @@ -526,10 +530,12 @@ $(HEXFILE_DIR)/$(model)_font_compressed_%.elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.%.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_font.$*.o \
$(OUTPUT_DIR)/Core/LangSupport/lang_single.o \
$(LIBS) $(LINKER_FLAGS) -o$@ -Wl,[email protected]
Expand Down Expand Up @@ -562,12 +568,24 @@ Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle: ..
--output-pickled "$(OUTPUT_DIR)/Core/Gen/translation.files/$*.pickle" \
$*

Core/Gen/settings_gen.%.cpp: Settings/settings.yaml \
Settings/generate_settings.py \
Settings/settings_gen.cpp.template
@test -d Core/Gen || mkdir -p Core/Gen
@echo 'Generating settings file for model $*'
@$(HOST_PYTHON) Settings/generate_settings.py $* Settings/settings.yaml Core/Gen/settings_gen.$*.cpp

Core/Gen/macros.txt: Makefile
@test -d "$(CURDIR)/Core/Gen" || mkdir -p "$(CURDIR)/Core/Gen"
echo "#include <configuration.h>" | $(CC) -dM -E $(CFLAGS) -MF "$(CURDIR)/Core/Gen/macros.tmp" - > "$(CURDIR)/Core/Gen/macros.txt"

# The recipes to produce compressed translation data

$(OUTPUT_DIR)/Core/Gen/settings_gen.%.o: Core/Gen/settings_gen.%.cpp
@test -d $(@D) || mkdir -p $(@D)
@echo Generating $@
@$(CPP) -c $(CXXFLAGS) $< -o $@

$(OUTPUT_DIR)/Core/Gen/translation.files/%.o: Core/Gen/Translation.%.cpp
@test -d $(@D) || mkdir -p $(@D)
@echo Generating $@
Expand Down Expand Up @@ -612,23 +630,27 @@ $(HEXFILE_DIR)/$(model)_multi_$(2).elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
Makefile $(LDSCRIPT)
@test -d $$(@D) || mkdir -p $$(@D)
@echo Linking $$@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_multi.$(1).o \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
$(LIBS) $(LINKER_FLAGS) -o$$@ -Wl,[email protected]

$(HEXFILE_DIR)/$(model)_multi_compressed_$(2).elf: \
$(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_multi.$(1).o \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
Makefile $(LDSCRIPT)
@test -d $$(@D) || mkdir -p $$(@D)
@echo Linking $$@
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) \
$(OUTPUT_DIR)/Core/Gen/Translation_brieflz_multi.$(1).o \
$(OUTPUT_DIR)/Core/Gen/settings_gen.$(model).o \
$(OUTPUT_DIR)/Core/LangSupport/lang_multi.o \
$(LIBS) $(LINKER_FLAGS) -o$$@ -Wl,[email protected]

Expand Down Expand Up @@ -711,6 +733,5 @@ check-style:
# Pull in dependency info for *existing* .o files
-include $(OUT_OBJS:.o=.d)
-include $(OUT_OBJS_CPP:.o=.d)
-include $(OUTPUT_DIR)/Core/Gen/Translation.*.d
-include $(OUTPUT_DIR)/Core/Gen/Translation_*.d
-include $(OUTPUT_DIR)/Core/Gen/*.d
-include $(OUTPUT_DIR)/Core/Gen/translation.files/*.d
Loading