@@ -26,94 +26,9 @@ bool sanitiseSettings();
2626#define QC_VOLTAGE_MAX 140
2727#endif /* POW_QC_20V */
2828
29- /*
30- * This struct must be a multiple of 2 bytes as it is saved / restored from
31- * flash in uint16_t chunks
32- */
33- typedef struct {
34- uint16_t versionMarker;
35- uint16_t length; // Length of valid bytes following
36- uint16_t settingsValues[SettingsOptionsLength];
37- // used to make this nicely "good enough" aligned to 32 bytes to make driver code trivial
38- uint32_t padding;
39-
40- } systemSettingsType;
41-
42- // ~1024 is common programming size, setting threshold to be lower so we have warning
43- static_assert (sizeof (systemSettingsType) < 512 );
44-
4529// char (*__kaboom)[sizeof(systemSettingsType)] = 1; // Uncomment to print size at compile time
4630volatile systemSettingsType systemSettings;
4731
48- // For every setting we need to store the min/max/increment values
49- typedef struct {
50- const uint16_t min; // Inclusive minimum value
51- const uint16_t max; // Inclusive maximum value
52- const uint16_t increment; // Standard increment
53- const uint16_t defaultValue; // Default vaue after reset
54- } SettingConstants;
55-
56- static const SettingConstants settingsConstants[(int )SettingsOptions::SettingsOptionsLength] = {
57- // { min, max, increment, default}
58- { MIN_TEMP_C, MAX_TEMP_F, 5 , SOLDERING_TEMP}, // SolderingTemp
59- { MIN_TEMP_C, MAX_TEMP_F, 5 , 150 }, // SleepTemp
60- { 0 , 15 , 1 , SLEEP_TIME}, // SleepTime
61- { 0 , 4 , 1 , CUT_OUT_SETTING}, // MinDCVoltageCells
62- { 24 , 38 , 1 , RECOM_VOL_CELL}, // MinVoltageCells
63- { 90 , QC_VOLTAGE_MAX, 2 , 90 }, // QCIdealVoltage
64- { 0 , MAX_ORIENTATION_MODE, 1 , ORIENTATION_MODE}, // OrientationMode
65- { 0 , 9 , 1 , SENSITIVITY}, // Sensitivity
66- { 0 , 1 , 1 , ANIMATION_LOOP}, // AnimationLoop
67- { 0 , settingOffSpeed_t::MAX_VALUE - 1 , 1 , ANIMATION_SPEED}, // AnimationSpeed
68- { 0 , 3 , 1 , AUTO_START_MODE}, // AutoStartMode
69- { 0 , 60 , 1 , SHUTDOWN_TIME}, // ShutdownTime
70- { 0 , 1 , 1 , COOLING_TEMP_BLINK}, // CoolingTempBlink
71- { 0 , 1 , 1 , DETAILED_IDLE}, // DetailedIDLE
72- { 0 , 1 , 1 , DETAILED_SOLDERING}, // DetailedSoldering
73- { 0 , (uint16_t )(HasFahrenheit ? 1 : 0 ), 1 , TEMPERATURE_INF}, // TemperatureInF
74- { 0 , 1 , 1 , DESCRIPTION_SCROLL_SPEED}, // DescriptionScrollSpeed
75- { 0 , 2 , 1 , LOCKING_MODE}, // LockingMode
76- { 0 , 99 , 1 , POWER_PULSE_DEFAULT}, // KeepAwakePulse
77- { 1 , POWER_PULSE_WAIT_MAX, 1 , POWER_PULSE_WAIT_DEFAULT}, // KeepAwakePulseWait
78- { 1 , POWER_PULSE_DURATION_MAX, 1 , POWER_PULSE_DURATION_DEFAULT}, // KeepAwakePulseDuration
79- { 360 , 900 , 1 , VOLTAGE_DIV}, // VoltageDiv
80- { 0 , MAX_TEMP_F, 10 , BOOST_TEMP}, // BoostTemp
81- {MIN_CALIBRATION_OFFSET, 2500 , 1 , CALIBRATION_OFFSET}, // CalibrationOffset
82- { 0 , MAX_POWER_LIMIT, POWER_LIMIT_STEPS, POWER_LIMIT}, // PowerLimit
83- { 0 , 1 , 1 , REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
84- { 5 , TEMP_CHANGE_LONG_STEP_MAX, 5 , TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
85- { 1 , TEMP_CHANGE_SHORT_STEP_MAX, 1 , TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
86- { 0 , 9 , 1 , 7 }, // HallEffectSensitivity
87- { 0 , 9 , 1 , 0 }, // AccelMissingWarningCounter
88- { 0 , 9 , 1 , 0 }, // PDMissingWarningCounter
89- { 0 , 0xFFFF , 0 , 41431 /* EN*/ }, // UILanguage
90- { 0 , 50 , 1 , 20 }, // PDNegTimeout
91- { 0 , 1 , 1 , 0 }, // OLEDInversion
92- { MIN_BRIGHTNESS, MAX_BRIGHTNESS, BRIGHTNESS_STEP, DEFAULT_BRIGHTNESS}, // OLEDBrightness
93- { 0 , 6 , 1 , 1 }, // LOGOTime
94- { 0 , 1 , 1 , 0 }, // CalibrateCJC
95- { 0 , 2 , 1 , 0 }, // BluetoothLE
96- { 0 , 2 , 1 , 0 }, // USBPDMode
97- { 1 , 5 , 1 , 4 }, // ProfilePhases
98- { MIN_TEMP_C, MAX_TEMP_F, 5 , 90 }, // ProfilePreheatTemp
99- { 1 , 10 , 1 , 1 }, // ProfilePreheatSpeed
100- { MIN_TEMP_C, MAX_TEMP_F, 5 , 130 }, // ProfilePhase1Temp
101- { 10 , 180 , 5 , 90 }, // ProfilePhase1Duration
102- { MIN_TEMP_C, MAX_TEMP_F, 5 , 140 }, // ProfilePhase2Temp
103- { 10 , 180 , 5 , 30 }, // ProfilePhase2Duration
104- { MIN_TEMP_C, MAX_TEMP_F, 5 , 165 }, // ProfilePhase3Temp
105- { 10 , 180 , 5 , 30 }, // ProfilePhase3Duration
106- { MIN_TEMP_C, MAX_TEMP_F, 5 , 140 }, // ProfilePhase4Temp
107- { 10 , 180 , 5 , 30 }, // ProfilePhase4Duration
108- { MIN_TEMP_C, MAX_TEMP_F, 5 , 90 }, // ProfilePhase5Temp
109- { 10 , 180 , 5 , 30 }, // ProfilePhase5Duration
110- { 1 , 10 , 1 , 2 }, // ProfileCooldownSpeed
111- { 0 , 12 , 1 , 0 }, // HallEffectSleepTime
112- { 0 , (tipType_t::TIP_TYPE_MAX - 1 ) > 0 ? (tipType_t::TIP_TYPE_MAX - 1 ) : 0 , 1 , 0 }, // SolderingTipType
113- { 0 , 1 , 1 , 0 }, // ReverseButtonSettings
114- };
115- static_assert ((sizeof (settingsConstants) / sizeof (SettingConstants)) == ((int )SettingsOptions::SettingsOptionsLength));
116-
11732#ifdef BLE_ENABLED
11833static int16_t bleValueOnEntry = -1 ;
11934
0 commit comments