1
0
forked from me/IronOS

Add tip coeff as setting parameter

This commit is contained in:
firebie
2020-04-13 19:31:08 +03:00
parent 92ce6128ee
commit 7f6a862e50
32 changed files with 307 additions and 46 deletions

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -282,6 +282,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -285,6 +285,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -284,6 +284,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}

View File

@@ -283,6 +283,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -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"
}
}
}

View File

@@ -283,6 +283,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -283,6 +283,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -282,6 +282,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}
}

View File

@@ -281,6 +281,14 @@
"Pulse W"
],
"desc": "Keep awake pulse power intensity"
},
"TipGain": {
"text": "TG",
"text2": [
"Modify",
"tip gain"
],
"desc": "Tip gain"
}
}
}

View File

@@ -287,6 +287,11 @@ var def =
"id": "PowerPulsePower",
"maxLen": 6,
"maxLen2": 16
},
{
"id": "TipGain",
"maxLen": 6,
"maxLen2": 8
}
]
}

View File

@@ -12,7 +12,7 @@
#include <stdint.h>
#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

View File

@@ -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;

View File

@@ -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
}

View File

@@ -27,7 +27,7 @@
* This was bought to my attention by <Kuba Sztandera>
*/
#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) {

View File

@@ -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;

View File

@@ -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