mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Starting GUI render refactor to be more immediate mode
Update TemperatureAdjust.cpp . Cleanup Soldering Sleep SolderingProfiles Soldering Rework Rough pass GUI Temp Adjust Cleanup old OperatingMode Debug Menu
This commit is contained in:
@@ -1,39 +1,36 @@
|
||||
|
||||
|
||||
#include "OperatingModes.h"
|
||||
void performCJCC(void) {
|
||||
OperatingMode performCJCC(const ButtonState buttons, guiContext *cxt) {
|
||||
// Calibrate Cold Junction Compensation directly at boot, before internal components get warm.
|
||||
OLED::refresh();
|
||||
osDelay(50);
|
||||
if (!isTipDisconnected() && abs(int(TipThermoModel::getTipInC() - getHandleTemperature(0) / 10)) < 10) {
|
||||
uint16_t setoffset = 0;
|
||||
// Take 16 samples
|
||||
if (cxt->scratch_state.state1 < 16) {
|
||||
cxt->scratch_state.state3 += getTipRawTemp(1);
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SmallSymbolDot, FontStyle::SMALL);
|
||||
for (uint8_t x = 0; x < (cxt->scratch_state.state1 / 4); x++)
|
||||
OLED::print(SmallSymbolDot, FontStyle::SMALL);
|
||||
cxt->scratch_state.state1++;
|
||||
return OperatingMode::CJCCalibration;
|
||||
}
|
||||
|
||||
// If the thermo-couple at the end of the tip, and the handle are at
|
||||
// equilibrium, then the output should be zero, as there is no temperature
|
||||
// differential.
|
||||
while (setoffset == 0) {
|
||||
uint32_t offset = 0;
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
offset += getTipRawTemp(1);
|
||||
// cycle through the filter a fair bit to ensure we're stable.
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SmallSymbolDot, FontStyle::SMALL);
|
||||
for (uint8_t x = 0; x < (i / 4); x++) {
|
||||
OLED::print(SmallSymbolDot, FontStyle::SMALL);
|
||||
}
|
||||
OLED::refresh();
|
||||
osDelay(100);
|
||||
}
|
||||
setoffset = TipThermoModel::convertTipRawADCTouV(offset / 16, true);
|
||||
|
||||
uint16_t setOffset = TipThermoModel::convertTipRawADCTouV(cxt->scratch_state.state3 / 16, true);
|
||||
setSettingValue(SettingsOptions::CalibrationOffset, setOffset);
|
||||
if (warnUser(translatedString(Tr->CJCCalibrationDone), buttons)) {
|
||||
// Preventing to repeat calibration at boot automatically (only one shot).
|
||||
setSettingValue(SettingsOptions::CalibrateCJC, 0);
|
||||
saveSettings();
|
||||
return OperatingMode::InitialisationDone;
|
||||
}
|
||||
setSettingValue(SettingsOptions::CalibrationOffset, setoffset);
|
||||
OLED::clearScreen();
|
||||
warnUser(translatedString(Tr->CalibrationDone), 3 * TICKS_SECOND);
|
||||
OLED::refresh();
|
||||
// Preventing to repeat calibration at boot automatically (only one shot).
|
||||
setSettingValue(SettingsOptions::CalibrateCJC, 0);
|
||||
saveSettings();
|
||||
return OperatingMode::CJCCalibration;
|
||||
}
|
||||
// Cant run calibration without the tip and for temps to be close
|
||||
return OperatingMode::InitialisationDone;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user