add settings for soldering profile

This commit is contained in:
Laura Klünder
2023-04-23 17:50:02 +02:00
parent 5a36b0479c
commit dbdc0d1ef1
6 changed files with 291 additions and 1 deletions

View File

@@ -143,6 +143,62 @@
"displayText": "Allow locking\nbuttons",
"description": "While soldering, hold down both buttons to toggle locking them (D=disable | B=boost mode only | F=full locking)"
},
"ProfilePhases": {
"displayText": "Profile\nPhases",
"description": "Number of phases for the soldering profile"
},
"ProfilePreheatTemp": {
"displayText": "Preheat\nTemp",
"description": "Preheat to this temperature when starting the profile"
},
"ProfilePreheatSpeed": {
"displayText": "Preheat\nSpeed",
"description": "Preheat at this rate (degrees per second)"
},
"ProfilePhase1Temp": {
"displayText": "Phase 1\nTemp",
"description": "Target temperature for the end of this phase"
},
"ProfilePhase1Duration": {
"displayText": "Phase 1\nDuration",
"description": "Target duration of this phase (s=seconds)"
},
"ProfilePhase2Temp": {
"displayText": "Phase 2\nTemp",
"description": ""
},
"ProfilePhase2Duration": {
"displayText": "Phase 2\nDuration",
"description": ""
},
"ProfilePhase3Temp": {
"displayText": "Phase 3\nTemp",
"description": ""
},
"ProfilePhase3Duration": {
"displayText": "Phase 3\nDuration",
"description": ""
},
"ProfilePhase4Temp": {
"displayText": "Phase 4\nTemp",
"description": ""
},
"ProfilePhase4Duration": {
"displayText": "Phase 4\nDuration",
"description": ""
},
"ProfilePhase5Temp": {
"displayText": "Phase 5\nTemp",
"description": ""
},
"ProfilePhase5Duration": {
"displayText": "Phase 5\nDuration",
"description": ""
},
"ProfileCooldownSpeed": {
"displayText": "Cooldown\nSpeed",
"description": "Cooldown at this rate after the last phase (degrees per second)"
},
"MotionSensitivity": {
"displayText": "Motion\nsensitivity",
"description": "0=off | 1=least sensitive | ... | 9=most sensitive"

View File

@@ -253,6 +253,90 @@
"maxLen2": 13,
"description": "If locking the buttons against accidental presses is enabled."
},
{
"id": "ProfilePhases",
"maxLen": 6,
"maxLen2": 13,
"description": "Enable / set the number of phases for the soldering profile."
},
{
"id": "ProfilePreheatTemp",
"maxLen": 6,
"maxLen2": 13,
"description": "For the soldering profile, preheat to this temperature before proceeding with phase 1."
},
{
"id": "ProfilePreheatSpeed",
"maxLen": 6,
"maxLen2": 13,
"description": "How fast the temperature is allowed to rise during the heatup phase of the soldering profile."
},
{
"id": "ProfilePhase1Temp",
"maxLen": 6,
"maxLen2": 13,
"description": "Target temperature for the end of phase 1 of the soldering profile."
},
{
"id": "ProfilePhase1Duration",
"maxLen": 6,
"maxLen2": 13,
"description": "Duration of phase 1 of the soldering profile. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase2Temp",
"maxLen": 6,
"maxLen2": 13,
"description": "Target temperature for the end of phase 2 of the soldering profile."
},
{
"id": "ProfilePhase2Duration",
"maxLen": 6,
"maxLen2": 13,
"description": "Duration of phase 2 of the soldering profile. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase3Temp",
"maxLen": 6,
"maxLen2": 13,
"description": "Target temperature for the end of phase 3 of the soldering profile."
},
{
"id": "ProfilePhase3Duration",
"maxLen": 6,
"maxLen2": 13,
"description": "Duration of phase 3 of the soldering profile. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase4Temp",
"maxLen": 6,
"maxLen2": 13,
"description": "Target temperature for the end of phase 5 of the soldering profile."
},
{
"id": "ProfilePhase4Duration",
"maxLen": 6,
"maxLen2": 13,
"description": "Duration of phase 5 of the soldering profile. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfilePhase5Temp",
"maxLen": 6,
"maxLen2": 13,
"description": "Target temperature for the end of phase 5 of the soldering profile."
},
{
"id": "ProfilePhase5Duration",
"maxLen": 6,
"maxLen2": 13,
"description": "Duration of phase 5 of the soldering profile. The phase might actually take longer if it takes longer to reach the target temperature."
},
{
"id": "ProfileCooldownSpeed",
"maxLen": 6,
"maxLen2": 13,
"description": "How fast the temperature is allowed to drop after the last phase of the soldering profile."
},
{
"id": "MotionSensitivity",
"maxLen": 6,

View File

@@ -53,8 +53,22 @@ enum SettingsOptions {
CalibrateCJC = 36, // Toggle calibrate CJC at next boot
BluetoothLE = 37, // Toggle BLE if present
PDVpdo = 38, // Toggle PPS & EPR
ProfilePhases = 39, // Number of Reflow Profile Phases
ProfilePreheatTemp = 40,
ProfilePreheatSpeed = 41,
ProfilePhase1Temp = 42,
ProfilePhase1Duration = 43,
ProfilePhase2Temp = 44,
ProfilePhase2Duration = 45,
ProfilePhase3Temp = 46,
ProfilePhase3Duration = 47,
ProfilePhase4Temp = 48,
ProfilePhase4Duration = 49,
ProfilePhase5Temp = 50,
ProfilePhase5Duration = 51,
ProfileCooldownSpeed = 52,
//
SettingsOptionsLength = 39, //
SettingsOptionsLength = 53, //
};
typedef enum {

View File

@@ -61,6 +61,20 @@ enum class SettingsItemIndex : uint8_t {
TempChangeShortStep,
TempChangeLongStep,
LockingMode,
ProfilePhases,
ProfilePreheatTemp,
ProfilePreheatSpeed,
ProfilePhase1Temp,
ProfilePhase1Duration,
ProfilePhase2Temp,
ProfilePhase2Duration,
ProfilePhase3Temp,
ProfilePhase3Duration,
ProfilePhase4Temp,
ProfilePhase4Duration,
ProfilePhase5Temp,
ProfilePhase5Duration,
ProfileCooldownSpeed,
MotionSensitivity,
SleepTemperature,
SleepTimeout,

View File

@@ -88,6 +88,20 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
{0, 1, 1, 0}, // CalibrateCJC
{0, 1, 1, 1}, // BluetoothLE
{0, 1, 1, 1}, // PDVpdo
{0, 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, 120, 5, 90}, // ProfilePhase1Duration
{MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase2Temp
{10, 120, 5, 30}, // ProfilePhase2Duration
{MIN_TEMP_C, MAX_TEMP_F, 5, 165}, // ProfilePhase3Temp
{10, 120, 5, 30}, // ProfilePhase3Duration
{MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase4Temp
{10, 120, 5, 30}, // ProfilePhase4Duration
{MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePhase5Temp
{10, 120, 5, 30}, // ProfilePhase5Duration
{1, 10, 1, 2}, // ProfileCooldownSpeed
};
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));

View File

@@ -52,6 +52,31 @@ static void displayDisplayRotation(void);
static bool setBoostTemp(void);
static void displayBoostTemp(void);
static bool setProfilePreheatTemp();
static bool setProfilePhase1Temp();
static bool setProfilePhase2Temp();
static bool setProfilePhase3Temp();
static bool setProfilePhase4Temp();
static bool setProfilePhase5Temp();
static void displayProfilePhases(void);
static void displayProfilePreheatTemp(void);
static void displayProfilePreheatSpeed(void);
static void displayProfilePhase1Temp(void);
static void displayProfilePhase1Duration(void);
static void displayProfilePhase2Temp(void);
static void displayProfilePhase2Duration(void);
static void displayProfilePhase3Temp(void);
static void displayProfilePhase3Duration(void);
static void displayProfilePhase4Temp(void);
static void displayProfilePhase4Duration(void);
static void displayProfilePhase5Temp(void);
static void displayProfilePhase5Duration(void);
static void displayProfileCooldownSpeed(void);
static bool showProfileOptions(void);
static bool showProfilePhase2Options(void);
static bool showProfilePhase3Options(void);
static bool showProfilePhase4Options(void);
static bool showProfilePhase5Options(void);
static void displayAutomaticStartMode(void);
static void displayLockingMode(void);
static void displayCoolingBlinkEnabled(void);
@@ -109,6 +134,22 @@ static bool enterAdvancedMenu(void);
* Temp Change Short Step
* Temp Change Long Step
* Locking Mode
* Profile Phases
* Profile Preheat Temperature
* Profile Preheat Max Temperature Change Per Second
* Profile Phase 1 Temperature
* Profile Phase 1 Duration (s)
* Profile Phase 2 Temperature
* Profile Phase 2 Duration (s)
* Profile Phase 3 Temperature
* Profile Phase 3 Duration (s)
* Profile Phase 4 Temperature
* Profile Phase 4 Duration (s)
* Profile Phase 5 Temperature
* Profile Phase 5 Duration (s)
* Profile Phase 6 Temperature
* Profile Phase 6 Duration (s)
* Profile Cooldown Max Temperature Change Per Second
*
* Power Saving
* Motion Sensitivity
@@ -203,6 +244,20 @@ const menuitem solderingMenu[] = {
{SETTINGS_DESC(SettingsItemIndex::TempChangeLongStep), nullptr, displayTempChangeLongStep, nullptr, SettingsOptions::TempChangeLongStep, SettingsItemIndex::TempChangeLongStep,
6}, /*Temp change long step*/
{SETTINGS_DESC(SettingsItemIndex::LockingMode), nullptr, displayLockingMode, nullptr, SettingsOptions::LockingMode, SettingsItemIndex::LockingMode, 7}, /*Locking Mode*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhases), nullptr, displayProfilePhases, nullptr, SettingsOptions::ProfilePhases, SettingsItemIndex::ProfilePhases, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePreheatTemp), setProfilePreheatTemp, displayProfilePreheatTemp, showProfileOptions, SettingsOptions::ProfilePreheatTemp, SettingsItemIndex::ProfilePreheatTemp, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePreheatSpeed), nullptr, displayProfilePreheatSpeed, showProfileOptions, SettingsOptions::ProfilePreheatSpeed, SettingsItemIndex::ProfilePreheatSpeed, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase1Temp, displayProfilePhase1Temp, showProfileOptions, SettingsOptions::ProfilePhase1Temp, SettingsItemIndex::ProfilePhase1Temp, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase1Duration, showProfileOptions, SettingsOptions::ProfilePhase1Duration, SettingsItemIndex::ProfilePhase1Duration, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase2Temp, displayProfilePhase2Temp, showProfilePhase2Options, SettingsOptions::ProfilePhase2Temp, SettingsItemIndex::ProfilePhase2Temp, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase2Duration, showProfilePhase2Options, SettingsOptions::ProfilePhase2Duration, SettingsItemIndex::ProfilePhase2Duration, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase3Temp, displayProfilePhase3Temp, showProfilePhase3Options, SettingsOptions::ProfilePhase3Temp, SettingsItemIndex::ProfilePhase3Temp, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase3Duration, showProfilePhase3Options, SettingsOptions::ProfilePhase3Duration, SettingsItemIndex::ProfilePhase3Duration, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase4Temp, displayProfilePhase4Temp, showProfilePhase4Options, SettingsOptions::ProfilePhase4Temp, SettingsItemIndex::ProfilePhase4Temp, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase4Duration, showProfilePhase4Options, SettingsOptions::ProfilePhase4Duration, SettingsItemIndex::ProfilePhase4Duration, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Temp), setProfilePhase5Temp, displayProfilePhase5Temp, showProfilePhase5Options, SettingsOptions::ProfilePhase5Temp, SettingsItemIndex::ProfilePhase5Temp, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfilePhase1Duration), nullptr, displayProfilePhase5Duration, showProfilePhase5Options, SettingsOptions::ProfilePhase5Duration, SettingsItemIndex::ProfilePhase5Duration, 5}, /*Boost Temp*/
{SETTINGS_DESC(SettingsItemIndex::ProfileCooldownSpeed), nullptr, displayProfileCooldownSpeed, showProfileOptions, SettingsOptions::ProfileCooldownSpeed, SettingsItemIndex::ProfileCooldownSpeed, 5}, /*Boost Temp*/
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
};
const menuitem PowerSavingMenu[] = {
@@ -463,6 +518,59 @@ static void displayLockingMode(void) {
}
}
static void displayProfilePhases(void) {
if (getSettingValue(SettingsOptions::ProfilePhases)) {
OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhases), 1, FontStyle::LARGE);
} else {
OLED::print(translatedString(Tr->OffString), FontStyle::LARGE);
}
}
static bool setProfileTemp(const enum SettingsOptions option) {
// If in C, 10 deg, if in F 20 deg
uint16_t temp = getSettingValue(option);
if (getSettingValue(SettingsOptions::TemperatureInF)) {
temp += 10;
if (temp > MAX_TEMP_F)
temp = MIN_TEMP_F;
setSettingValue(option, temp);
return temp == MAX_TEMP_F;
} else {
temp += 5;
if (temp > MAX_TEMP_C)
temp = MIN_TEMP_C;
setSettingValue(option, temp);
return temp == MAX_TEMP_C;
}
}
static bool setProfilePreheatTemp(void) { return setProfileTemp(SettingsOptions::ProfilePreheatTemp); }
static bool setProfilePhase1Temp(void) { return setProfileTemp(SettingsOptions::ProfilePhase1Temp); }
static bool setProfilePhase2Temp(void) { return setProfileTemp(SettingsOptions::ProfilePhase2Temp); }
static bool setProfilePhase3Temp(void) { return setProfileTemp(SettingsOptions::ProfilePhase3Temp); }
static bool setProfilePhase4Temp(void) { return setProfileTemp(SettingsOptions::ProfilePhase4Temp); }
static bool setProfilePhase5Temp(void) { return setProfileTemp(SettingsOptions::ProfilePhase5Temp); }
static void displayProfilePreheatTemp(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePreheatTemp), 3, FontStyle::LARGE); }
static void displayProfilePhase1Temp(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase1Temp), 3, FontStyle::LARGE); }
static void displayProfilePhase2Temp(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase2Temp), 3, FontStyle::LARGE); }
static void displayProfilePhase3Temp(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase3Temp), 3, FontStyle::LARGE); }
static void displayProfilePhase4Temp(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase4Temp), 3, FontStyle::LARGE); }
static void displayProfilePhase5Temp(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase5Temp), 3, FontStyle::LARGE); }
static void displayProfilePreheatSpeed(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePreheatSpeed), 2, FontStyle::LARGE); }
static void displayProfileCooldownSpeed(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfileCooldownSpeed), 2, FontStyle::LARGE); }
static void displayProfilePhase1Duration(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase1Duration), 3, FontStyle::LARGE); }
static void displayProfilePhase2Duration(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase1Duration), 3, FontStyle::LARGE); }
static void displayProfilePhase3Duration(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase1Duration), 3, FontStyle::LARGE); }
static void displayProfilePhase4Duration(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase1Duration), 3, FontStyle::LARGE); }
static void displayProfilePhase5Duration(void) { OLED::printNumber(getSettingValue(SettingsOptions::ProfilePhase1Duration), 3, FontStyle::LARGE); }
static bool showProfileOptions(void) { return getSettingValue(SettingsOptions::ProfilePhases); }
static bool showProfilePhase2Options(void) { return getSettingValue(SettingsOptions::ProfilePhases) >= 2; }
static bool showProfilePhase3Options(void) { return getSettingValue(SettingsOptions::ProfilePhases) >= 3; }
static bool showProfilePhase4Options(void) { return getSettingValue(SettingsOptions::ProfilePhases) >= 4; }
static bool showProfilePhase5Options(void) { return getSettingValue(SettingsOptions::ProfilePhases) >= 5; }
static void displaySensitivity(void) { OLED::printNumber(getSettingValue(SettingsOptions::Sensitivity), 1, FontStyle::LARGE, false); }
static bool showSleepOptions(void) { return getSettingValue(SettingsOptions::Sensitivity) > 0; }