diff --git a/Translation Editor/translation_bg.json b/Translation Editor/translation_bg.json index 5d1c5999..f40f1607 100644 --- a/Translation Editor/translation_bg.json +++ b/Translation Editor/translation_bg.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_cs.json b/Translation Editor/translation_cs.json index c656d8df..6d6d59d0 100644 --- a/Translation Editor/translation_cs.json +++ b/Translation Editor/translation_cs.json @@ -282,6 +282,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_da.json b/Translation Editor/translation_da.json index 7f49b8f1..6271ef61 100644 --- a/Translation Editor/translation_da.json +++ b/Translation Editor/translation_da.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_de.json b/Translation Editor/translation_de.json index f9b8f1fe..a93c4a93 100644 --- a/Translation Editor/translation_de.json +++ b/Translation Editor/translation_de.json @@ -285,6 +285,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_en.json b/Translation Editor/translation_en.json index 4615b68e..ba3b0187 100644 --- a/Translation Editor/translation_en.json +++ b/Translation Editor/translation_en.json @@ -284,6 +284,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } } diff --git a/Translation Editor/translation_es.json b/Translation Editor/translation_es.json index 8514667e..e6815b34 100644 --- a/Translation Editor/translation_es.json +++ b/Translation Editor/translation_es.json @@ -283,6 +283,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_fi.json b/Translation Editor/translation_fi.json index 089959d8..451359fd 100644 --- a/Translation Editor/translation_fi.json +++ b/Translation Editor/translation_fi.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_fr.json b/Translation Editor/translation_fr.json index b4e6707b..c2cbb387 100644 --- a/Translation Editor/translation_fr.json +++ b/Translation Editor/translation_fr.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } } diff --git a/Translation Editor/translation_hr.json b/Translation Editor/translation_hr.json index e4dbf726..6b91354d 100644 --- a/Translation Editor/translation_hr.json +++ b/Translation Editor/translation_hr.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_hu.json b/Translation Editor/translation_hu.json index 372a8a5a..ae4310eb 100644 --- a/Translation Editor/translation_hu.json +++ b/Translation Editor/translation_hu.json @@ -281,6 +281,14 @@ "bank üzem W" ], "desc": "Powerbank üzemnél nem engedi a powerbankot kikapcsolni idönkénti áram felvételt generál. " + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } } diff --git a/Translation Editor/translation_it.json b/Translation Editor/translation_it.json index 5793cb1c..5105f99c 100644 --- a/Translation Editor/translation_it.json +++ b/Translation Editor/translation_it.json @@ -283,6 +283,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } } diff --git a/Translation Editor/translation_lt.json b/Translation Editor/translation_lt.json index 38608dab..9e886301 100644 --- a/Translation Editor/translation_lt.json +++ b/Translation Editor/translation_lt.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_nl.json b/Translation Editor/translation_nl.json index afb7ea31..67d73f8d 100644 --- a/Translation Editor/translation_nl.json +++ b/Translation Editor/translation_nl.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_nl_be.json b/Translation Editor/translation_nl_be.json index c79e34fb..510721fc 100644 --- a/Translation Editor/translation_nl_be.json +++ b/Translation Editor/translation_nl_be.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_no.json b/Translation Editor/translation_no.json index 8b8fad56..887285af 100644 --- a/Translation Editor/translation_no.json +++ b/Translation Editor/translation_no.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_pl.json b/Translation Editor/translation_pl.json index acad6316..40e24718 100644 --- a/Translation Editor/translation_pl.json +++ b/Translation Editor/translation_pl.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_pt.json b/Translation Editor/translation_pt.json index c0d43e86..6a213ca2 100644 --- a/Translation Editor/translation_pt.json +++ b/Translation Editor/translation_pt.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_ru.json b/Translation Editor/translation_ru.json index 66b6843e..412106c8 100644 --- a/Translation Editor/translation_ru.json +++ b/Translation Editor/translation_ru.json @@ -283,6 +283,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } } \ No newline at end of file diff --git a/Translation Editor/translation_sk.json b/Translation Editor/translation_sk.json index 2eb45bf6..ea19f6e0 100644 --- a/Translation Editor/translation_sk.json +++ b/Translation Editor/translation_sk.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_sl.json b/Translation Editor/translation_sl.json index 87b8ef40..f6793c47 100644 --- a/Translation Editor/translation_sl.json +++ b/Translation Editor/translation_sl.json @@ -282,6 +282,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_sr_cyrl.json b/Translation Editor/translation_sr_cyrl.json index 000d3882..29ba5456 100644 --- a/Translation Editor/translation_sr_cyrl.json +++ b/Translation Editor/translation_sr_cyrl.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_sr_latn.json b/Translation Editor/translation_sr_latn.json index cc1009ea..30e71cfd 100644 --- a/Translation Editor/translation_sr_latn.json +++ b/Translation Editor/translation_sr_latn.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_sv.json b/Translation Editor/translation_sv.json index 7af2ab00..b5b40339 100644 --- a/Translation Editor/translation_sv.json +++ b/Translation Editor/translation_sv.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_tr.json b/Translation Editor/translation_tr.json index 9c818c1d..748ad723 100644 --- a/Translation Editor/translation_tr.json +++ b/Translation Editor/translation_tr.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } -} \ No newline at end of file +} diff --git a/Translation Editor/translation_uk.json b/Translation Editor/translation_uk.json index 9f9bbf98..05b82e96 100644 --- a/Translation Editor/translation_uk.json +++ b/Translation Editor/translation_uk.json @@ -281,6 +281,14 @@ "Pulse W" ], "desc": "Keep awake pulse power intensity" + }, + "TipGain": { + "text": "TG", + "text2": [ + "Modify", + "tip gain" + ], + "desc": "Tip gain" } } } diff --git a/Translation Editor/translations_def.js b/Translation Editor/translations_def.js index 8c11a4bd..2e6d4a2f 100644 --- a/Translation Editor/translations_def.js +++ b/Translation Editor/translations_def.js @@ -287,6 +287,11 @@ var def = "id": "PowerPulsePower", "maxLen": 6, "maxLen2": 16 + }, + { + "id": "TipGain", + "maxLen": 6, + "maxLen2": 8 } ] } diff --git a/workspace/TS100/Core/Inc/Settings.h b/workspace/TS100/Core/Inc/Settings.h index 604ca1b9..cde51fc4 100644 --- a/workspace/TS100/Core/Inc/Settings.h +++ b/workspace/TS100/Core/Inc/Settings.h @@ -12,7 +12,7 @@ #include #include "stm32f1xx_hal.h" #include "unit.h" -#define SETTINGSVERSION ( 0x1F ) +#define SETTINGSVERSION ( 0x20 ) /*Change this if you change the struct below to prevent people getting \ out of sync*/ @@ -51,6 +51,8 @@ typedef struct { uint8_t powerLimitEnable; // Allow toggling of power limit without changing value uint8_t powerLimit; // Maximum power iron allowed to output + + uint16_t TipGain; // uV/C * 10, it can be used to convert tip thermocouple voltage to temperateture TipV/TipGain = TipTemp uint8_t ReverseButtonTempChangeEnabled; // Change the plus and minus button assigment uint16_t TempChangeLongStep; // Change the plus and minus button assigment diff --git a/workspace/TS100/Core/Inc/Translation.h b/workspace/TS100/Core/Inc/Translation.h index 74c01e20..e918ae8a 100644 --- a/workspace/TS100/Core/Inc/Translation.h +++ b/workspace/TS100/Core/Inc/Translation.h @@ -19,8 +19,8 @@ extern const uint8_t USER_FONT_6x8[]; * use SettingsShortNames as SettingsShortNames[16][1].. second column undefined */ extern const enum ShortNameType SettingsShortNameType; -extern const char *SettingsShortNames[27][2]; -extern const char *SettingsDescriptions[27]; +extern const char *SettingsShortNames[28][2]; +extern const char *SettingsDescriptions[28]; extern const char *SettingsMenuEntries[4]; extern const char *SettingsCalibrationDone; diff --git a/workspace/TS100/Core/Src/Settings.cpp b/workspace/TS100/Core/Src/Settings.cpp index 7f0b84a5..70bb74eb 100644 --- a/workspace/TS100/Core/Src/Settings.cpp +++ b/workspace/TS100/Core/Src/Settings.cpp @@ -106,5 +106,6 @@ void resetSettings() { systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; // systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; // systemSettings.KeepAwakePulse= POWER_PULSE_DEFAULT; + systemSettings.TipGain = TIP_GAIN; saveSettings(); // Save defaults } diff --git a/workspace/TS100/Core/Src/TipThermoModel.cpp b/workspace/TS100/Core/Src/TipThermoModel.cpp index a75128f1..e35b2915 100644 --- a/workspace/TS100/Core/Src/TipThermoModel.cpp +++ b/workspace/TS100/Core/Src/TipThermoModel.cpp @@ -27,7 +27,7 @@ * This was bought to my attention by */ -#define op_amp_gain_stage (1+(OP_AMP_Rf/OP_AMP_Rin)) + uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC) { // This takes the raw ADC samples, converts these to uV // Then divides this down by the gain to convert to the uV on the input to the op-amp (A+B terminals) @@ -39,7 +39,7 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC) { uint32_t valueuV = rawInputmVX10 * 100; // shift into uV //Now to divide this down by the gain - valueuV = (valueuV) / op_amp_gain_stage; + valueuV = (valueuV) / OP_AMP_GAIN_STAGE; //Remove uV tipOffset if (valueuV >= systemSettings.CalibrationOffset) valueuV -= systemSettings.CalibrationOffset; @@ -73,17 +73,19 @@ int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { //based on new measurements, tip is quite linear // - tipuVDelta *= TIP_GAIN; - tipuVDelta /= 10000; + tipuVDelta *= 10; + tipuVDelta /= systemSettings.TipGain; + +#ifdef MODEL_TS80 + tipuVDelta /= OP_AMP_GAIN_STAGE_TS100 / OP_AMP_GAIN_STAGE_TS80; +#endif + return tipuVDelta; } #ifdef ENABLED_FAHRENHEIT_SUPPORT uint32_t TipThermoModel::convertuVToDegF(uint32_t tipuVDelta) { - tipuVDelta *= TIP_GAIN; - tipuVDelta /= 1000; - return ((tipuVDelta * 9) / 50) + 32; - //(Y °C × 9/5) + 32 =Y°F + return convertCtoF(convertuVToDegC(tipuVDelta)); } uint32_t TipThermoModel::convertCtoF(uint32_t degC) { diff --git a/workspace/TS100/Core/Src/gui.cpp b/workspace/TS100/Core/Src/gui.cpp index 41f7b9f8..ca4e92c1 100644 --- a/workspace/TS100/Core/Src/gui.cpp +++ b/workspace/TS100/Core/Src/gui.cpp @@ -60,6 +60,8 @@ static void settings_setResetSettings(void); static void settings_displayResetSettings(void); static void settings_setCalibrate(void); static void settings_displayCalibrate(void); +static void settings_setTipGain(void); +static void settings_displayTipGain(void); static void settings_setCalibrateVIN(void); static void settings_displayCalibrateVIN(void); static void settings_displayReverseButtonTempChangeEnabled(void); @@ -236,6 +238,8 @@ const menuitem advancedMenu[] = { settings_displayCalibrateVIN } }, /*Voltage input cal*/ { (const char*) SettingsDescriptions[26], { settings_setPowerPulse }, { settings_displayPowerPulse } }, /*Power Pulse adjustment */ +{ (const char*) SettingsDescriptions[27], { settings_setTipGain }, { + settings_displayTipGain } }, /*TipGain*/ { NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE }; @@ -752,6 +756,53 @@ static void settings_setCalibrateVIN(void) { } } +static void settings_setTipGain(void) { + OLED::setFont(0); + OLED::clearScreen(); + + for (;;) { + OLED::setCursor(0, 0); + OLED::printNumber(systemSettings.TipGain / 10, 2); + OLED::print(SymbolDot); + OLED::printNumber(systemSettings.TipGain % 10, 1); + + ButtonState buttons = getButtonState(); + switch (buttons) { + case BUTTON_F_SHORT: + systemSettings.TipGain -= 1; + break; + + case BUTTON_B_SHORT: + systemSettings.TipGain += 1; + break; + + case BUTTON_BOTH: + case BUTTON_F_LONG: + case BUTTON_B_LONG: + saveSettings(); + return; + break; + case BUTTON_NONE: + default: + break; + } + + OLED::refresh(); + osDelay(40); + + // Cap to sensible values + if (systemSettings.TipGain < 150) { + systemSettings.TipGain = 150; + } else if (systemSettings.TipGain > 300) { + systemSettings.TipGain = 300; + } + } +} + +static void settings_displayTipGain(void) { + printShortDescription(27, 5); +} + static void settings_setReverseButtonTempChangeEnabled(void) { systemSettings.ReverseButtonTempChangeEnabled = !systemSettings.ReverseButtonTempChangeEnabled; diff --git a/workspace/TS100/configuration.h b/workspace/TS100/configuration.h index 8dc1212f..1bdc13d0 100644 --- a/workspace/TS100/configuration.h +++ b/workspace/TS100/configuration.h @@ -62,6 +62,7 @@ #else #define POWER_PULSE_DEFAULT 5 #endif + /** * OLED Orientation Sensitivity on Automatic mode! * Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive> @@ -81,21 +82,26 @@ #define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow #define POWER_LIMIT_ENABLE 0 // 0: Disable 1: Enable - Default disabled power limit +#define TIP_GAIN 210 // 21 uV/C * 10, uV per deg C constant of the tip, Tip uV * 10 / coeff = tip temp + +#define OP_AMP_Rf_TS100 750*1000 // 750 Kilo-ohms -> From schematic, R1 +#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2 + +#define OP_AMP_GAIN_STAGE_TS100 (1+(OP_AMP_Rf_TS100/OP_AMP_Rin_TS100)) + +#define OP_AMP_Rf_TS80 180*1000 // 180 Kilo-ohms -> From schematic, R6 +#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3 + +#define OP_AMP_GAIN_STAGE_TS80 (1+(OP_AMP_Rf_TS80/OP_AMP_Rin_TS80)) + #ifdef MODEL_TS100 #define VOLTAGE_DIV 467 // 467 - Default divider from schematic #define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV #define PID_POWER_LIMIT 70 // Sets the max pwm power limit #define POWER_LIMIT 30 // 30 watts default limit #define MAX_POWER_LIMIT 65 // - #define POWER_LIMIT_STEPS 5 // - - /** - * TIP_GAIN = TIP_GAIN/1000 == uV per deg C constant of the tip - */ - #define OP_AMP_Rf 750*1000 // 750 Kilo-ohms -> From schematic, R1 - #define OP_AMP_Rin 2370 // 2.37 Kilo-ohms -> From schematic, R2 - #define TIP_GAIN 405 - + #define POWER_LIMIT_STEPS 5 // + #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 #endif #ifdef MODEL_TS80 @@ -105,11 +111,5 @@ #define POWER_LIMIT 24 // 24 watts default power limit #define MAX_POWER_LIMIT 30 // #define POWER_LIMIT_STEPS 2 - - /** - * TIP_GAIN = TIP_GAIN/1000 == uV per deg C constant of the tip - */ - #define OP_AMP_Rf 180*1000 // 180 Kilo-ohms -> From schematic, R6 - #define OP_AMP_Rin 2000 // 2.0 Kilo-ohms -> From schematic, R3 - #define TIP_GAIN 115 + #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 #endif