1
0
forked from me/IronOS

Merge master into navigation-animations

This commit is contained in:
Patrick Horlebein
2020-04-17 09:38:16 +02:00
13 changed files with 173 additions and 66 deletions

4
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
# These are supported funding model platforms
ko_fi: ralim
custom: https://paypal.me/RalimTek

7
.gitignore vendored
View File

@@ -72,7 +72,6 @@ workspace/TS100/Core/Inc/unit.h
# IDE configs # IDE configs
.vs/* .vs/*
.settings/* .settings/*
.project
..cproject.swp ..cproject.swp
# Visual Studios # Visual Studios
@@ -104,9 +103,6 @@ local.properties
# PyDev specific (Python IDE for Eclipse) # PyDev specific (Python IDE for Eclipse)
*.pydevproject *.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools # CDT- autotools
.autotools .autotools
@@ -193,5 +189,4 @@ fabric.properties
# Editor-based Rest Client # Editor-based Rest Client
.idea/httpRequests .idea/httpRequests
.mxproject CoreCompileInputs.cache
CoreCompileInputs.cache

View File

@@ -21,7 +21,9 @@
"TipDisconnectedString": "PUNTA ASSENTE", "TipDisconnectedString": "PUNTA ASSENTE",
"SolderingAdvancedPowerPrompt": "Potenz:", "SolderingAdvancedPowerPrompt": "Potenz:",
"OffString": "OFF", "OffString": "OFF",
"ResetOKMessage": "Reset OK" "ResetOKMessage": "Reset OK",
"YourGainMessage": "Guad.: ",
"SettingsResetMessage": "Reset effettuato"
}, },
"characters": { "characters": {
"SettingRightChar": "D", "SettingRightChar": "D",
@@ -160,7 +162,7 @@
"Avviso", "Avviso",
"punta calda" "punta calda"
], ],
"desc": "Mostra, lampeggiante, la temperatura durante il raffreddamento se la punta è ancora calda" "desc": "Evidenzia il valore di temperatura durante il raffreddamento se la punta è ancora calda"
}, },
"TemperatureCalibration": { "TemperatureCalibration": {
"text": "", "text": "",
@@ -237,42 +239,42 @@
"PowerLimitEnable": { "PowerLimitEnable": {
"text": "PLIMEN", "text": "PLIMEN",
"text2": [ "text2": [
"P Limit", "Limitatore",
"Enable" "di potenza"
], ],
"desc": "Enable power limit" "desc": "Abilita un limitatore per la potenza massima erogabile al saldatore"
}, },
"PowerLimit": { "PowerLimit": {
"text": "PLIM", "text": "PLIM",
"text2": [ "text2": [
"Power", "Limite",
"Limit" "di potenza"
], ],
"desc": "Maximum power the iron can use <Watts>" "desc": "Imposta il valore di potenza massima erogabile al saldatore <watt>"
}, },
"ReverseButtonTempChange": { "ReverseButtonTempChange": {
"text": "RVTCHG", "text": "RVTCHG",
"text2": [ "text2": [
"Key +-", "Inversione",
"reverse?" "tasti"
], ],
"desc": "Reverse the tip temperature change buttons plus minus assignment." "desc": "Inverti i tasti per impostare la temperatura della punta "
}, },
"TempChangeShortStep": { "TempChangeShortStep": {
"text": "TCHGST", "text": "TCHGST",
"text2": [ "text2": [
"Temp change", "Cambio temp",
"short?" "pressione breve"
], ],
"desc": "Temperature change steps on short button press!" "desc": "Varia la temperatura della punta attraverso una breve pressione dei tasti"
}, },
"TempChangeLongStep": { "TempChangeLongStep": {
"text": "TCHGLT", "text": "TCHGLT",
"text2": [ "text2": [
"Temp change", "Cambio temp",
"long?" "pressione lunga"
], ],
"desc": "Temperature change steps on long button press!" "desc": "Varia la temperatura della punta attraverso una lunga pressione dei tasti"
} }
} }
} }

View File

@@ -255,26 +255,26 @@
"ReverseButtonTempChange": { "ReverseButtonTempChange": {
"text": "RVTCHG", "text": "RVTCHG",
"text2": [ "text2": [
"Key +-", "Инвертировать",
"reverse?" "кнопки +-?"
], ],
"desc": "Reverse the tip temperature change buttons plus minus assignment." "desc": "Инвертировать кнопки изменения температуры."
}, },
"TempChangeShortStep": { "TempChangeShortStep": {
"text": "TCHGST", "text": "TCHGST",
"text2": [ "text2": [
"Temp change", "Изменение темп.",
"short?" "коротко?"
], ],
"desc": "Temperature change steps on short button press!" "desc": "Изменять температуру при коротком нажатии!"
}, },
"TempChangeLongStep": { "TempChangeLongStep": {
"text": "TCHGLT", "text": "TCHGLT",
"text2": [ "text2": [
"Temp change", "Изменение темп.",
"long?" "долго?"
], ],
"desc": "Temperature change steps on long button press!" "desc": "Изменять температуру при длинном нажатии!"
} }
} }
} }

View File

@@ -253,26 +253,26 @@
"ReverseButtonTempChange": { "ReverseButtonTempChange": {
"text": "RVTCHG", "text": "RVTCHG",
"text2": [ "text2": [
"Key +-", "Інвертувати",
"reverse?" "кнопки +-?"
], ],
"desc": "Reverse the tip temperature change buttons plus minus assignment." "desc": "Інвертувати кнопки зміни температури."
}, },
"TempChangeShortStep": { "TempChangeShortStep": {
"text": "TCHGST", "text": "TCHGST",
"text2": [ "text2": [
"Temp change", "Зміна темп.",
"short?" "коротко?"
], ],
"desc": "Temperature change steps on short button press!" "desc": "Змінювати температуру при короткому натисканні!"
}, },
"TempChangeLongStep": { "TempChangeLongStep": {
"text": "TCHGLT", "text": "TCHGLT",
"text2": [ "text2": [
"Temp change", "Зміна темп.",
"long?" "довго?"
], ],
"desc": "Temperature change steps on long button press!" "desc": "Змінювати температуру при довгому натисканні!"
} }
} }
} }

File diff suppressed because one or more lines are too long

31
workspace/TS100/.project Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TS100</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
</natures>
</projectDescription>

View File

@@ -24,6 +24,7 @@ extern "C" {
#endif #endif
#define DEVICEADDR_OLED (0x3c<<1) #define DEVICEADDR_OLED (0x3c<<1)
#define OLED_WIDTH 96 #define OLED_WIDTH 96
#define OLED_HEIGHT 16
#define FRAMEBUFFER_START 17 #define FRAMEBUFFER_START 17
class OLED { class OLED {
@@ -99,6 +100,7 @@ public:
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
bool clear); bool clear);
static void drawHeatSymbol(uint8_t state); static void drawHeatSymbol(uint8_t state);
static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator
static void transitionToContents(uint8_t *framebuffer, bool forwardNavigation); static void transitionToContents(uint8_t *framebuffer, bool forwardNavigation);
static void set_framebuffer(uint8_t *buffer); static void set_framebuffer(uint8_t *buffer);
private: private:

View File

@@ -125,6 +125,25 @@ void OLED::drawChar(char c) {
cursor_x += fontWidth; cursor_x += fontWidth;
} }
/*
* Draws a one pixel wide scrolling indicator. y is the upper vertical position
* of the indicator in pixels (0..<16).
*/
void OLED::drawScrollIndicator(uint8_t y, uint8_t height) {
union u_type {
uint16_t whole;
uint8_t strips[2];
} column;
column.whole = (1 << height) - 1;
column.whole <<= y;
// Draw a one pixel wide bar to the left with a single pixel as
// the scroll indicator.
fillArea(OLED_WIDTH - 1, 0, 1, 8, column.strips[0]);
fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]);
}
/** /**
* Plays a transition animation between two framebuffers. * Plays a transition animation between two framebuffers.
* @param framebuffer Second framebuffer to use for animation. * @param framebuffer Second framebuffer to use for animation.

View File

@@ -32,7 +32,7 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC) {
// This takes the raw ADC samples, converts these to uV // 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) // Then divides this down by the gain to convert to the uV on the input to the op-amp (A+B terminals)
// Then remove the calibration value that is stored as a tip offset // Then remove the calibration value that is stored as a tip offset
uint32_t vddRailmVX10 = 33000; //TODO use ADC Vref to calculate this uint32_t vddRailmVX10 = 33000; //The vreg is +-2%, but we have no higher accuracy available
// 4096 * 8 readings for full scale // 4096 * 8 readings for full scale
// Convert the input ADC reading back into mV times 10 format. // Convert the input ADC reading back into mV times 10 format.
uint32_t rawInputmVX10 = (rawADC * vddRailmVX10) / (4096 * 8); uint32_t rawInputmVX10 = (rawADC * vddRailmVX10) / (4096 * 8);
@@ -71,7 +71,7 @@ int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
} }
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
//based on new measurements, tip is quite linear at 24.9uV per deg C = 2.49 per 0.1C //based on new measurements, tip is quite linear
// //
tipuVDelta *= TIP_GAIN; tipuVDelta *= TIP_GAIN;
tipuVDelta /= 10000; tipuVDelta /= 10000;

View File

@@ -264,6 +264,8 @@ static void printShortDescription(uint32_t shortDescIndex,
// prepare cursor for value // prepare cursor for value
OLED::setFont(0); OLED::setFont(0);
OLED::setCharCursor(cursorCharPosition, 0); OLED::setCharCursor(cursorCharPosition, 0);
// make room for scroll indicator
OLED::setCursor(OLED::getCursorX() - 2, 0);
} }
static int userConfirmation(const char *message) { static int userConfirmation(const char *message) {
@@ -782,7 +784,8 @@ static void displayMenu(size_t index) {
OLED::print(SettingsMenuEntries[index]); OLED::print(SettingsMenuEntries[index]);
// Draw symbol // Draw symbol
// 16 pixel wide image // 16 pixel wide image
OLED::drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index])); // 2 pixel wide scrolling indicator
OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
} }
static void settings_displayCalibrateVIN(void) { static void settings_displayCalibrateVIN(void) {
@@ -825,6 +828,11 @@ void gui_Menu(const menuitem *menu) {
ButtonState lastButtonState = BUTTON_NONE; ButtonState lastButtonState = BUTTON_NONE;
static bool enterGUIMenu = true; static bool enterGUIMenu = true;
enterGUIMenu = true; enterGUIMenu = true;
uint8_t scrollContentSize = 0;
for (uint8_t i = 0; menu[i].draw.func != NULL; i++) {
scrollContentSize += 1;
}
// Animated menu opening. // Animated menu opening.
if (menu[currentScreen].draw.func != NULL) { if (menu[currentScreen].draw.func != NULL) {
@@ -851,6 +859,9 @@ void gui_Menu(const menuitem *menu) {
|| menu[currentScreen].description == NULL) { || menu[currentScreen].description == NULL) {
OLED::clearScreen(); OLED::clearScreen();
menu[currentScreen].draw.func(); menu[currentScreen].draw.func();
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
uint8_t position = currentScreen * indicatorHeight;
OLED::drawScrollIndicator(position, indicatorHeight);
lastOffset = -1; lastOffset = -1;
lcdRefresh = true; lcdRefresh = true;
} else { } else {

View File

@@ -233,10 +233,25 @@ void startQC(uint16_t divisor) {
// Delay 1.25 seconds // Delay 1.25 seconds
uint8_t enteredQC = 0; uint8_t enteredQC = 0;
vTaskDelay(125); for (uint16_t i = 0; i < 200 && enteredQC == 0; i++) {
// Check if D- is low to spot a QC charger vTaskDelay(1); //10mS pause
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET) if (i > 130) {
enteredQC = 1; if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET) {
enteredQC = 1;
}
if (i == 140) {
//For some marginal QC chargers, we try adding a pulldown
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Pin = GPIO_PIN_11;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
}
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pin = GPIO_PIN_11;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
if (enteredQC) { if (enteredQC) {
// We have a QC capable charger // We have a QC capable charger
QC_Seek9V(); QC_Seek9V();
@@ -280,19 +295,19 @@ static unsigned int sqrt32(unsigned long n) {
} }
} }
int16_t calculateMaxVoltage(uint8_t useHP) { int16_t calculateMaxVoltage(uint8_t useHP) {
// This measures the tip resistance, then it calculates the appropriate // This measures the tip resistance, then it calculates the appropriate
// voltage To stay under ~18W. Mosfet is "9A", so no issues there // voltage To stay under ~18W. Mosfet is "9A", so no issues there
// QC3.0 supports up to 18W, which is 2A @9V and 1.5A @12V // QC3.0 supports up to 18W, which is 2A @9V and 1.5A @12V
uint32_t milliOhms = 4500; uint32_t milliOhms = 4500;
// Check no tip // Check no tip
if (milliOhms > 10000) if (milliOhms > 10000)
return -1; return -1;
//Because of tolerance, if a user has asked for the higher power mode, then just goto 12V and call it a day //Because of tolerance, if a user has asked for the higher power mode, then just goto 12V and call it a day
if (useHP) if (useHP)
return 120; return 120;
// //
// V = sqrt(18W*R) // V = sqrt(18W*R)
// Convert this to sqrt(18W)*sqrt(milli ohms)*sqrt(1/1000) // Convert this to sqrt(18W)*sqrt(milli ohms)*sqrt(1/1000)
uint32_t Vx = sqrt32(milliOhms); uint32_t Vx = sqrt32(milliOhms);
if (useHP) if (useHP)
@@ -300,17 +315,17 @@ int16_t calculateMaxVoltage(uint8_t useHP) {
else else
Vx *= 1342; // sqrt(18) * sqrt(1/1000)*10000 Vx *= 1342; // sqrt(18) * sqrt(1/1000)*10000
// Round to nearest 200mV, // Round to nearest 200mV,
// So divide by 100 to start, to get in Vxx // So divide by 100 to start, to get in Vxx
Vx /= 100; Vx /= 100;
if (Vx % 10 >= 5) if (Vx % 10 >= 5)
Vx += 10; Vx += 10;
Vx /= 10; Vx /= 10;
// Round to nearest increment of 2 // Round to nearest increment of 2
if (Vx % 2 == 1) if (Vx % 2 == 1)
Vx++; Vx++;
//Because of how bad the tolerance is on detecting the tip resistance is //Because of how bad the tolerance is on detecting the tip resistance is
//Its more functional to bin this //Its more functional to bin this
if (Vx < 90) if (Vx < 90)
Vx = 90; Vx = 90;
else if (Vx >= 105) else if (Vx >= 105)
@@ -332,7 +347,7 @@ void setTipPWM(uint8_t pulse) {
// timers. // timers.
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
// Period has elapsed // Period has elapsed
if (htim->Instance == TIM2) { if (htim->Instance == TIM2) {
// we want to turn on the output again // we want to turn on the output again
PWMSafetyTimer--; PWMSafetyTimer--;
@@ -354,7 +369,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
} }
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) { void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
// This was a when the PWM for the output has timed out // This was a when the PWM for the output has timed out
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) { if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1); HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
} }

View File

@@ -4,4 +4,4 @@
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4' * i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
*/ */
#define BUILD_VERSION "v2.08" #define BUILD_VERSION "v2.09"