From 74d144eef87c573cb450ba5a70190fbe27ea2e40 Mon Sep 17 00:00:00 2001 From: Patrick Horlebein Date: Fri, 3 Apr 2020 16:58:53 +0200 Subject: [PATCH 01/14] Add method to draw a scrolling indicator --- workspace/TS100/Core/Inc/OLED.hpp | 1 + workspace/TS100/Core/Src/OLED.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/workspace/TS100/Core/Inc/OLED.hpp b/workspace/TS100/Core/Inc/OLED.hpp index 381fd9f0..26a31524 100644 --- a/workspace/TS100/Core/Inc/OLED.hpp +++ b/workspace/TS100/Core/Inc/OLED.hpp @@ -99,6 +99,7 @@ public: static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool clear); static void drawHeatSymbol(uint8_t state); + static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator private: static void drawChar(char c); // Draw a character to a specific location static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer diff --git a/workspace/TS100/Core/Src/OLED.cpp b/workspace/TS100/Core/Src/OLED.cpp index bef541d1..ec9fa9ce 100644 --- a/workspace/TS100/Core/Src/OLED.cpp +++ b/workspace/TS100/Core/Src/OLED.cpp @@ -106,6 +106,25 @@ void OLED::drawChar(char c) { 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]); +} + void OLED::setRotation(bool leftHanded) { #ifdef MODEL_TS80 leftHanded = !leftHanded; From 153772cb68a640a817f31ef48187f0a01485dc87 Mon Sep 17 00:00:00 2001 From: Patrick Horlebein Date: Fri, 3 Apr 2020 17:12:31 +0200 Subject: [PATCH 02/14] Add a 2 pixel wide space in menus for scrolling indicator --- workspace/TS100/Core/Src/gui.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/workspace/TS100/Core/Src/gui.cpp b/workspace/TS100/Core/Src/gui.cpp index 42834655..8070fd39 100644 --- a/workspace/TS100/Core/Src/gui.cpp +++ b/workspace/TS100/Core/Src/gui.cpp @@ -264,6 +264,8 @@ static void printShortDescription(uint32_t shortDescIndex, // prepare cursor for value OLED::setFont(0); OLED::setCharCursor(cursorCharPosition, 0); + // make room for scroll indicator + OLED::setCursor(OLED::getCursorX() - 2, 0); } static int userConfirmation(const char *message) { @@ -782,7 +784,8 @@ static void displayMenu(size_t index) { OLED::print(SettingsMenuEntries[index]); // Draw symbol // 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) { From 07d35cadd919afb539065d2c0d46e2bb1a6ad3ca Mon Sep 17 00:00:00 2001 From: Patrick Horlebein Date: Fri, 3 Apr 2020 17:13:10 +0200 Subject: [PATCH 03/14] Draw scrolling indicator --- workspace/TS100/Core/Inc/OLED.hpp | 1 + workspace/TS100/Core/Src/gui.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/workspace/TS100/Core/Inc/OLED.hpp b/workspace/TS100/Core/Inc/OLED.hpp index 26a31524..23a2fd8e 100644 --- a/workspace/TS100/Core/Inc/OLED.hpp +++ b/workspace/TS100/Core/Inc/OLED.hpp @@ -24,6 +24,7 @@ extern "C" { #endif #define DEVICEADDR_OLED (0x3c<<1) #define OLED_WIDTH 96 +#define OLED_HEIGHT 16 #define FRAMEBUFFER_START 17 class OLED { diff --git a/workspace/TS100/Core/Src/gui.cpp b/workspace/TS100/Core/Src/gui.cpp index 8070fd39..793cc2bd 100644 --- a/workspace/TS100/Core/Src/gui.cpp +++ b/workspace/TS100/Core/Src/gui.cpp @@ -826,6 +826,11 @@ void gui_Menu(const menuitem *menu) { int16_t lastOffset = -1; bool lcdRefresh = true; ButtonState lastButtonState = BUTTON_NONE; + uint8_t scrollContentSize = 0; + + for (uint8_t i = 0; menu[i].draw.func != NULL; i++) { + scrollContentSize += 1; + } while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) { OLED::setFont(0); @@ -836,6 +841,9 @@ void gui_Menu(const menuitem *menu) { || menu[currentScreen].description == NULL) { OLED::clearScreen(); menu[currentScreen].draw.func(); + uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize; + uint8_t position = currentScreen * indicatorHeight; + OLED::drawScrollIndicator(position, indicatorHeight); lastOffset = -1; lcdRefresh = true; } else { From ad39fe9750216093309b9bedd01889ccb62c2b20 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Apr 2020 11:54:38 +1100 Subject: [PATCH 04/14] Update .gitignore Stop blacklisting IDE project configurations --- .gitignore | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 22d2ec0b..96c9ab2c 100644 --- a/.gitignore +++ b/.gitignore @@ -72,7 +72,6 @@ workspace/TS100/Core/Inc/unit.h # IDE configs .vs/* .settings/* -.project ..cproject.swp # Visual Studios @@ -104,9 +103,6 @@ local.properties # PyDev specific (Python IDE for Eclipse) *.pydevproject -# CDT-specific (C/C++ Development Tooling) -.cproject - # CDT- autotools .autotools @@ -193,5 +189,4 @@ fabric.properties # Editor-based Rest Client .idea/httpRequests -.mxproject -CoreCompileInputs.cache \ No newline at end of file +CoreCompileInputs.cache From 482d1c5b617284a41cc6877dfff698a77a25b854 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Apr 2020 12:00:02 +1100 Subject: [PATCH 05/14] Restore the project files If we keep removing these, it keeps requiring rebuilding the entire MX+IDE project which is a pain --- workspace/TS100/.mxproject | 28 ++++++++++++++++++++++++++++ workspace/TS100/.project | 31 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 workspace/TS100/.mxproject create mode 100644 workspace/TS100/.project diff --git a/workspace/TS100/.mxproject b/workspace/TS100/.mxproject new file mode 100644 index 00000000..4e68b791 --- /dev/null +++ b/workspace/TS100/.mxproject @@ -0,0 +1,28 @@ +[PreviousGenFiles] +AdvancedFolderStructure=true +HeaderFileListSize=4 +HeaderFiles#0=/home/ralim/source/ts100/workspace/TS100/Core/Inc/FreeRTOSConfig.h +HeaderFiles#1=/home/ralim/source/ts100/workspace/TS100/Core/Inc/stm32f1xx_it.h +HeaderFiles#2=/home/ralim/source/ts100/workspace/TS100/Core/Inc/stm32f1xx_hal_conf.h +HeaderFiles#3=/home/ralim/source/ts100/workspace/TS100/Core/Inc/main.h +HeaderFolderListSize=1 +HeaderPath#0=/home/ralim/source/ts100/workspace/TS100/Core/Inc +HeaderFiles=; +SourceFileListSize=5 +SourceFiles#0=/home/ralim/source/ts100/workspace/TS100/Core/Src/freertos.c +SourceFiles#1=/home/ralim/source/ts100/workspace/TS100/Core/Src/stm32f1xx_it.c +SourceFiles#2=/home/ralim/source/ts100/workspace/TS100/Core/Src/stm32f1xx_hal_msp.c +SourceFiles#3=/home/ralim/source/ts100/workspace/TS100/Core/Src/stm32f1xx_hal_timebase_tim.c +SourceFiles#4=/home/ralim/source/ts100/workspace/TS100/Core/Src/main.c +SourceFolderListSize=1 +SourcePath#0=/home/ralim/source/ts100/workspace/TS100/Core/Src +SourceFiles=; + +[PreviousLibFiles] +LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_iwdg.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Middlewares/Third_Party/FreeRTOS/Source/include/croutine.h;Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h;Middlewares/Third_Party/FreeRTOS/Source/include/event_groups.h;Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h;Middlewares/Third_Party/FreeRTOS/Source/include/list.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_prototypes.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h;Middlewares/Third_Party/FreeRTOS/Source/include/portable.h;Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h;Middlewares/Third_Party/FreeRTOS/Source/include/queue.h;Middlewares/Third_Party/FreeRTOS/Source/include/semphr.h;Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h;Middlewares/Third_Party/FreeRTOS/Source/include/task.h;Middlewares/Third_Party/FreeRTOS/Source/include/timers.h;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_iwdg.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Middlewares/Third_Party/FreeRTOS/Source/include/croutine.h;Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h;Middlewares/Third_Party/FreeRTOS/Source/include/event_groups.h;Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h;Middlewares/Third_Party/FreeRTOS/Source/include/list.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_prototypes.h;Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h;Middlewares/Third_Party/FreeRTOS/Source/include/portable.h;Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h;Middlewares/Third_Party/FreeRTOS/Source/include/queue.h;Middlewares/Third_Party/FreeRTOS/Source/include/semphr.h;Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h;Middlewares/Third_Party/FreeRTOS/Source/include/task.h;Middlewares/Third_Party/FreeRTOS/Source/include/timers.h;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm3.h; + +[PreviousUsedCubeIDEFiles] +SourceFiles=Core/Src/main.c;Core/Src/freertos.c;Core/Src/stm32f1xx_it.c;Core/Src/stm32f1xx_hal_msp.c;Core/Src/stm32f1xx_hal_timebase_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Core/Src/system_stm32f1xx.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Core/Src/system_stm32f1xx.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;null;Middlewares/Third_Party/FreeRTOS/Source/croutine.c;Middlewares/Third_Party/FreeRTOS/Source/event_groups.c;Middlewares/Third_Party/FreeRTOS/Source/list.c;Middlewares/Third_Party/FreeRTOS/Source/queue.c;Middlewares/Third_Party/FreeRTOS/Source/tasks.c;Middlewares/Third_Party/FreeRTOS/Source/timers.c;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c;Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c; +HeaderPath=Drivers/STM32F1xx_HAL_Driver/Inc;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;Middlewares/Third_Party/FreeRTOS/Source/include;Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3;Drivers/CMSIS/Device/ST/STM32F1xx/Include;Drivers/CMSIS/Include;Core/Inc; +CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;STM32F103xB; + diff --git a/workspace/TS100/.project b/workspace/TS100/.project new file mode 100644 index 00000000..0471bc04 --- /dev/null +++ b/workspace/TS100/.project @@ -0,0 +1,31 @@ + + + TS100 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.st.stm32cube.ide.mcu.MCUProjectNature + org.eclipse.cdt.core.cnature + com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAProjectNature + com.st.stm32cube.ide.mcu.MCUCubeProjectNature + com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + + From baa9ff66a83b7f1afc97372eae3d2d2251f3b59f Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Apr 2020 13:15:59 +1100 Subject: [PATCH 06/14] Update TipThermoModel.cpp Update comments --- workspace/TS100/Core/Src/TipThermoModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workspace/TS100/Core/Src/TipThermoModel.cpp b/workspace/TS100/Core/Src/TipThermoModel.cpp index d2fe293a..a75128f1 100644 --- a/workspace/TS100/Core/Src/TipThermoModel.cpp +++ b/workspace/TS100/Core/Src/TipThermoModel.cpp @@ -32,7 +32,7 @@ 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) // 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 // Convert the input ADC reading back into mV times 10 format. 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) { - //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 /= 10000; From eef2fb814824e42dd0853f716b07dceb1ed951f2 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Apr 2020 13:16:28 +1100 Subject: [PATCH 07/14] Slight reqork of QC logic to bring back older style + mix in another compatability hack --- workspace/TS100/Core/Src/hardware.cpp | 53 +++++++++++++++++---------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/workspace/TS100/Core/Src/hardware.cpp b/workspace/TS100/Core/Src/hardware.cpp index 5545f6ce..7deb1380 100644 --- a/workspace/TS100/Core/Src/hardware.cpp +++ b/workspace/TS100/Core/Src/hardware.cpp @@ -233,10 +233,25 @@ void startQC(uint16_t divisor) { // Delay 1.25 seconds uint8_t enteredQC = 0; - vTaskDelay(125); - // Check if D- is low to spot a QC charger - if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET) - enteredQC = 1; + for (uint16_t i = 0; i < 200 && enteredQC == 0; i++) { + vTaskDelay(1); //10mS pause + if (i > 130) { + 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) { // We have a QC capable charger QC_Seek9V(); @@ -280,19 +295,19 @@ static unsigned int sqrt32(unsigned long n) { } } int16_t calculateMaxVoltage(uint8_t useHP) { - // This measures the tip resistance, then it calculates the appropriate - // 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 +// This measures the tip resistance, then it calculates the appropriate +// 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 uint32_t milliOhms = 4500; - // Check no tip +// Check no tip if (milliOhms > 10000) 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) return 120; - // - // V = sqrt(18W*R) - // Convert this to sqrt(18W)*sqrt(milli ohms)*sqrt(1/1000) +// +// V = sqrt(18W*R) +// Convert this to sqrt(18W)*sqrt(milli ohms)*sqrt(1/1000) uint32_t Vx = sqrt32(milliOhms); if (useHP) @@ -300,17 +315,17 @@ int16_t calculateMaxVoltage(uint8_t useHP) { else Vx *= 1342; // sqrt(18) * sqrt(1/1000)*10000 - // Round to nearest 200mV, - // So divide by 100 to start, to get in Vxx +// Round to nearest 200mV, +// So divide by 100 to start, to get in Vxx Vx /= 100; if (Vx % 10 >= 5) Vx += 10; Vx /= 10; - // Round to nearest increment of 2 +// Round to nearest increment of 2 if (Vx % 2 == 1) Vx++; - //Because of how bad the tolerance is on detecting the tip resistance is - //Its more functional to bin this +//Because of how bad the tolerance is on detecting the tip resistance is +//Its more functional to bin this if (Vx < 90) Vx = 90; else if (Vx >= 105) @@ -332,7 +347,7 @@ void setTipPWM(uint8_t pulse) { // timers. void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { - // Period has elapsed +// Period has elapsed if (htim->Instance == TIM2) { // we want to turn on the output again PWMSafetyTimer--; @@ -354,7 +369,7 @@ void HAL_TIM_PeriodElapsedCallback(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) { HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1); } From af822d381653a11a7cc44a84c60675f934de15c5 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Apr 2020 13:27:17 +1100 Subject: [PATCH 08/14] Create FUNDING.yml --- .github/FUNDING.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..f3dc619c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +ko_fi: ralim +custom: https://paypal.me/RalimTek From fa58e167f17565ae6be00b965b9c4f0c09bf78c8 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sat, 4 Apr 2020 13:32:43 +1100 Subject: [PATCH 09/14] Update version.h --- workspace/TS100/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/TS100/version.h b/workspace/TS100/version.h index 66e80c41..a91c7099 100644 --- a/workspace/TS100/version.h +++ b/workspace/TS100/version.h @@ -4,4 +4,4 @@ * i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4' */ -#define BUILD_VERSION "v2.08" +#define BUILD_VERSION "v2.09" From 0911e2943db110c8a8b7699c75f0f616c59ff161 Mon Sep 17 00:00:00 2001 From: PlayDay Date: Sat, 4 Apr 2020 05:11:41 +0200 Subject: [PATCH 10/14] Update translation_uk.json --- Translation Editor/translation_uk.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Translation Editor/translation_uk.json b/Translation Editor/translation_uk.json index 0e27343a..707f4b8a 100644 --- a/Translation Editor/translation_uk.json +++ b/Translation Editor/translation_uk.json @@ -253,10 +253,10 @@ "ReverseButtonTempChange": { "text": "RVTCHG", "text2": [ - "Key +-", - "reverse?" + "Інвертувати", + "кнопки +-?" ], - "desc": "Reverse the tip temperature change buttons plus minus assignment." + "desc": "Інвертувати кнопки зміни температури." }, "TempChangeShortStep": { "text": "TCHGST", From 278663bd0e05a59ec37f27926a877eabec670a43 Mon Sep 17 00:00:00 2001 From: federck <33298498+federck@users.noreply.github.com> Date: Sat, 4 Apr 2020 19:33:40 +0300 Subject: [PATCH 11/14] Update translation_it *Italian translation update :grinning: --- Translation Editor/translation_it.json | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Translation Editor/translation_it.json b/Translation Editor/translation_it.json index bfcc0760..1c0f7562 100644 --- a/Translation Editor/translation_it.json +++ b/Translation Editor/translation_it.json @@ -21,7 +21,9 @@ "TipDisconnectedString": "PUNTA ASSENTE", "SolderingAdvancedPowerPrompt": "Potenz:", "OffString": "OFF", - "ResetOKMessage": "Reset OK" + "ResetOKMessage": "Reset OK", + "YourGainMessage": "Guad.: ", + "SettingsResetMessage": "Reset effettuato" }, "characters": { "SettingRightChar": "D", @@ -160,7 +162,7 @@ "Avviso", "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": { "text": "", @@ -237,42 +239,42 @@ "PowerLimitEnable": { "text": "PLIMEN", "text2": [ - "P Limit", - "Enable" + "Limitatore", + "di potenza" ], - "desc": "Enable power limit" + "desc": "Abilita un limitatore per la potenza massima erogabile al saldatore" }, "PowerLimit": { "text": "PLIM", "text2": [ - "Power", - "Limit" + "Limite", + "di potenza" ], - "desc": "Maximum power the iron can use " + "desc": "Imposta il valore di potenza massima erogabile al saldatore " }, "ReverseButtonTempChange": { "text": "RVTCHG", "text2": [ - "Key +-", - "reverse?" + "Inversione", + "tasti" ], - "desc": "Reverse the tip temperature change buttons plus minus assignment." + "desc": "Inverti i tasti per impostare la temperatura della punta " }, "TempChangeShortStep": { "text": "TCHGST", "text2": [ - "Temp change", - "short?" + "Cambio temp", + "pressione breve" ], - "desc": "Temperature change steps on short button press!" + "desc": "Varia la temperatura della punta attraverso una breve pressione dei tasti" }, "TempChangeLongStep": { "text": "TCHGLT", "text2": [ - "Temp change", - "long?" + "Cambio temp", + "pressione lunga" ], - "desc": "Temperature change steps on long button press!" + "desc": "Varia la temperatura della punta attraverso una lunga pressione dei tasti" } } -} \ No newline at end of file +} From 0b3816aee666f65d40a17efb21ff64eece5fc245 Mon Sep 17 00:00:00 2001 From: PlayDay Date: Mon, 6 Apr 2020 11:20:12 +0200 Subject: [PATCH 12/14] Update translation_uk.json --- Translation Editor/translation_uk.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Translation Editor/translation_uk.json b/Translation Editor/translation_uk.json index 707f4b8a..f072938c 100644 --- a/Translation Editor/translation_uk.json +++ b/Translation Editor/translation_uk.json @@ -261,18 +261,18 @@ "TempChangeShortStep": { "text": "TCHGST", "text2": [ - "Temp change", - "short?" + "Зміна темп.", + "коротко?" ], - "desc": "Temperature change steps on short button press!" + "desc": "Змінювати температуру при короткому натисканні!" }, "TempChangeLongStep": { "text": "TCHGLT", "text2": [ - "Temp change", - "long?" + "Зміна темп.", + "довго?" ], - "desc": "Temperature change steps on long button press!" + "desc": "Змінювати температуру при довгому натисканні!" } } } From 7f89b8a369ff915ec8e74ffbd5fe37d66823fa5e Mon Sep 17 00:00:00 2001 From: PlayDay Date: Mon, 6 Apr 2020 11:26:31 +0200 Subject: [PATCH 13/14] Update translation_ru.json --- Translation Editor/translation_ru.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Translation Editor/translation_ru.json b/Translation Editor/translation_ru.json index 46271bbe..6a8b6efc 100644 --- a/Translation Editor/translation_ru.json +++ b/Translation Editor/translation_ru.json @@ -255,26 +255,26 @@ "ReverseButtonTempChange": { "text": "RVTCHG", "text2": [ - "Key +-", - "reverse?" + "Инвертировать", + "кнопки +-?" ], - "desc": "Reverse the tip temperature change buttons plus minus assignment." + "desc": "Инвертировать кнопки изменения температуры." }, "TempChangeShortStep": { "text": "TCHGST", "text2": [ - "Temp change", - "short?" + "Изменение темп.", + "коротко?" ], - "desc": "Temperature change steps on short button press!" + "desc": "Изменять температуру при коротком нажатии!" }, "TempChangeLongStep": { "text": "TCHGLT", "text2": [ - "Temp change", - "long?" + "Изменение темп.", + "долго?" ], - "desc": "Temperature change steps on long button press!" + "desc": "Изменять температуру при длинном нажатии!" } } -} \ No newline at end of file +} From add8993da55f0dc7860102c35eff64782673d47e Mon Sep 17 00:00:00 2001 From: Patrick Horlebein Date: Thu, 16 Apr 2020 11:16:17 +0200 Subject: [PATCH 14/14] Use tabs instead of spaces. --- workspace/TS100/Core/Inc/OLED.hpp | 2 +- workspace/TS100/Core/Src/OLED.cpp | 24 ++++++++++++------------ workspace/TS100/Core/Src/gui.cpp | 22 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/workspace/TS100/Core/Inc/OLED.hpp b/workspace/TS100/Core/Inc/OLED.hpp index 23a2fd8e..f65216c0 100644 --- a/workspace/TS100/Core/Inc/OLED.hpp +++ b/workspace/TS100/Core/Inc/OLED.hpp @@ -100,7 +100,7 @@ public: static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, bool clear); static void drawHeatSymbol(uint8_t state); - static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator + static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator private: static void drawChar(char c); // Draw a character to a specific location static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer diff --git a/workspace/TS100/Core/Src/OLED.cpp b/workspace/TS100/Core/Src/OLED.cpp index ec9fa9ce..31c5f38b 100644 --- a/workspace/TS100/Core/Src/OLED.cpp +++ b/workspace/TS100/Core/Src/OLED.cpp @@ -111,18 +111,18 @@ void OLED::drawChar(char c) { * 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]); + 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]); } void OLED::setRotation(bool leftHanded) { diff --git a/workspace/TS100/Core/Src/gui.cpp b/workspace/TS100/Core/Src/gui.cpp index 793cc2bd..afa063d2 100644 --- a/workspace/TS100/Core/Src/gui.cpp +++ b/workspace/TS100/Core/Src/gui.cpp @@ -264,8 +264,8 @@ static void printShortDescription(uint32_t shortDescIndex, // prepare cursor for value OLED::setFont(0); OLED::setCharCursor(cursorCharPosition, 0); - // make room for scroll indicator - OLED::setCursor(OLED::getCursorX() - 2, 0); + // make room for scroll indicator + OLED::setCursor(OLED::getCursorX() - 2, 0); } static int userConfirmation(const char *message) { @@ -784,7 +784,7 @@ static void displayMenu(size_t index) { OLED::print(SettingsMenuEntries[index]); // Draw symbol // 16 pixel wide image - // 2 pixel wide scrolling indicator + // 2 pixel wide scrolling indicator OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index])); } @@ -826,11 +826,11 @@ void gui_Menu(const menuitem *menu) { int16_t lastOffset = -1; bool lcdRefresh = true; ButtonState lastButtonState = BUTTON_NONE; - uint8_t scrollContentSize = 0; - - for (uint8_t i = 0; menu[i].draw.func != NULL; i++) { - scrollContentSize += 1; - } + uint8_t scrollContentSize = 0; + + for (uint8_t i = 0; menu[i].draw.func != NULL; i++) { + scrollContentSize += 1; + } while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) { OLED::setFont(0); @@ -841,9 +841,9 @@ void gui_Menu(const menuitem *menu) { || menu[currentScreen].description == NULL) { OLED::clearScreen(); menu[currentScreen].draw.func(); - uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize; - uint8_t position = currentScreen * indicatorHeight; - OLED::drawScrollIndicator(position, indicatorHeight); + uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize; + uint8_t position = currentScreen * indicatorHeight; + OLED::drawScrollIndicator(position, indicatorHeight); lastOffset = -1; lcdRefresh = true; } else {