mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Adding adc2 & new temperature calibration proceedures. [WiP] (#361)
* Add rough calls to ADC2 [untested] * Using dual ADC injected modes * Start both ADCs * Move some IRQ's to ram exec * Stabilize PID a bit more * Add in ideas for tip type selection * Add tiptype formula / settings struct * Add function ids to the settings menu * Rough tip selection * Rough out new cal routine for simple tips * Hardware test is fairly close for first pass * Add Simple calibration case [UNTESTED] This adds the calibration option that uses boiling water to the calibration menu. This is untested, and may need gain adjustments before use. * Simple Cal Roughly working * Rough out advanced cal
This commit is contained in:
@@ -22,7 +22,8 @@ void saveSettings() {
|
||||
pEraseInit.PageAddress = FLASH_ADDR;
|
||||
uint32_t failingAddress = 0;
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
|
||||
__HAL_FLASH_CLEAR_FLAG(
|
||||
FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
|
||||
HAL_FLASH_Unlock();
|
||||
HAL_Delay(10);
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
@@ -35,7 +36,8 @@ void saveSettings() {
|
||||
|
||||
for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2), data[i]);
|
||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2),
|
||||
data[i]);
|
||||
}
|
||||
HAL_FLASH_Lock();
|
||||
|
||||
@@ -71,29 +73,30 @@ uint8_t lookupVoltageLevel(uint8_t level) {
|
||||
return (level * 33) + (33 * 2);
|
||||
}
|
||||
void resetSettings() {
|
||||
memset((void*)&systemSettings,0,sizeof(systemSettingsType));
|
||||
systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = 6; //How many seconds/minutes we wait until going to sleep - default 1 min
|
||||
memset((void*) &systemSettings, 0, sizeof(systemSettingsType));
|
||||
systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
|
||||
systemSettings.SleepTime = 6; //How many seconds/minutes we wait until going to sleep - default 1 min
|
||||
systemSettings.SolderingTemp = 320; //Default soldering temp is 320.0 C
|
||||
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
|
||||
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
|
||||
systemSettings.version = SETTINGSVERSION;//Store the version number to allow for easier upgrades
|
||||
systemSettings.detailedSoldering = 0; // Detailed soldering screen
|
||||
systemSettings.detailedIDLE=0; // Detailed idle screen (off for first time users)
|
||||
systemSettings.detailedIDLE = 0;// Detailed idle screen (off for first time users)
|
||||
systemSettings.OrientationMode = 2; //Default to automatic
|
||||
systemSettings.sensitivity = 7; //Default high sensitivity
|
||||
systemSettings.voltageDiv = 117; //Default divider from schematic
|
||||
systemSettings.ShutdownTime = 10; //How many minutes until the unit turns itself off
|
||||
systemSettings.boostModeEnabled = 1; //Default to safe, with no boost mode
|
||||
systemSettings.ShutdownTime = 10;//How many minutes until the unit turns itself off
|
||||
systemSettings.boostModeEnabled = 1;//Default to safe, with no boost mode
|
||||
systemSettings.BoostTemp = 420; //default to 400C
|
||||
systemSettings.autoStartMode = 0; //Auto start off for safety
|
||||
systemSettings.coolingTempBlink = 0; //Blink the temperature on the cooling screen when its > 50C
|
||||
systemSettings.CalibrationOffset = 10; //This appears to be quite close for both of my tips, in both of my handles
|
||||
systemSettings.coolingTempBlink = 0;//Blink the temperature on the cooling screen when its > 50C
|
||||
systemSettings.temperatureInF = 0; //default to 0
|
||||
systemSettings.descriptionScrollSpeed=0;//default to slow
|
||||
systemSettings.PID_P =42;
|
||||
systemSettings.PID_I =50;
|
||||
systemSettings.PID_D =15;
|
||||
|
||||
systemSettings.descriptionScrollSpeed = 0; //default to slow
|
||||
systemSettings.PID_P = 42;
|
||||
systemSettings.PID_I = 50;
|
||||
systemSettings.PID_D = 15;
|
||||
systemSettings.CalibrationOffset = 2780; // the adc offset
|
||||
systemSettings.customTipGain = 0; // The tip type is either default or a custom gain
|
||||
systemSettings.tipType = TS_B2;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user