* Create README.md * Move to new folder * Migrating * Migrate Remainder * format fix (all but one) (#1889) * Update USBPDDebug_FS2711.cpp * Delete PrintVoltage.cpp * Copy in 128x32 template * Mask drawing for 96x16 * Import #1819 * Update Font.h * Homescreen * Update draw_homescreen_detailed.cpp * Fix oled normal draw for variable height * Update OLED.cpp * Draw settings icons * Update draw_homescreen_simplified.cpp * Update draw_power_source_icon.cpp * Fixup oled drawing for fill area * Update the region fill for mixed heights * Fix newline height * FIXUP! Draw icons in settings menu at correct size * Fix scrollbar * Update settingsGUI.cpp * S60(P) Disable auto display rotation * On tall oled, scroll in 2 line increments * Bugfix transition L<->R @discip I take it back, there was a bug :) * Draw every other one on transitions * . * cleanup * Bootup logo: Draw in centre * Update OLED.hpp --------- Co-authored-by: discip <53649486+discip@users.noreply.github.com>
43 lines
1.8 KiB
C++
43 lines
1.8 KiB
C++
#include "OperatingModes.h"
|
|
#include "ui_drawing.hpp"
|
|
|
|
OperatingMode performCJCC(const ButtonState buttons, guiContext *cxt) {
|
|
// Calibrate Cold Junction Compensation directly at boot, before internal components get warm.
|
|
|
|
// While we wait for the pre-start checks to finish, we cant run CJC (as the pre-start checks control the tip)
|
|
if (preStartChecks() == 0) {
|
|
OLED::setCursor(0, 0);
|
|
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
|
|
return OperatingMode::CJCCalibration;
|
|
}
|
|
|
|
if (!isTipDisconnected() && abs(int(TipThermoModel::getTipInC() - getHandleTemperature(0) / 10)) < 10) {
|
|
// Take 16 samples, only sample
|
|
if (cxt->scratch_state.state1 < 16) {
|
|
if ((xTaskGetTickCount() - cxt->scratch_state.state4) > TICKS_100MS) {
|
|
cxt->scratch_state.state3 += getTipRawTemp(1);
|
|
cxt->scratch_state.state1++;
|
|
cxt->scratch_state.state4 = xTaskGetTickCount();
|
|
}
|
|
ui_draw_cjc_sampling(cxt->scratch_state.state1 / 4);
|
|
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.
|
|
|
|
uint16_t setOffset = TipThermoModel::convertTipRawADCTouV(cxt->scratch_state.state3 / 16, true);
|
|
setSettingValue(SettingsOptions::CalibrationOffset, setOffset);
|
|
if (warnUser(translatedString(Tr->CalibrationDone), buttons)) {
|
|
// Preventing to repeat calibration at boot automatically (only one shot).
|
|
setSettingValue(SettingsOptions::CalibrateCJC, 0);
|
|
saveSettings();
|
|
return OperatingMode::InitialisationDone;
|
|
}
|
|
return OperatingMode::CJCCalibration;
|
|
}
|
|
// Cant run calibration without the tip and for temps to be close
|
|
return OperatingMode::StartupWarnings;
|
|
}
|