diff --git a/.gitignore b/.gitignore
index dbe746f1..7301eaeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,3 +48,4 @@ workspace/TS100A/Release/TS100A.map
workspace/TS100A/Release/TS100A.list
workspace/TS100A/Release/TS100A.hex
workspace/TS100A/.settings/language.settings.xml
+workspace/TS100A/.metadata/
diff --git a/Development Resources/TS100/TS100.ioc b/Development Resources/TS100/TS100.ioc
index c79fdcc2..77ff394f 100644
--- a/Development Resources/TS100/TS100.ioc
+++ b/Development Resources/TS100/TS100.ioc
@@ -11,13 +11,15 @@ ADC1.DiscontinuousConvMode=DISABLE
ADC1.EnableAnalogWatchDog=false
ADC1.EnableRegularConversion=ENABLE
ADC1.ExternalTrigConv=ADC_SOFTWARE_START
-ADC1.ExternalTrigInjecConv=ADC_EXTERNALTRIGINJECCONV_T3_CC4
-ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConv,InjNumberOfConversion,EnableAnalogWatchDog,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,master,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,Rank-5\#ChannelInjectedConversion,Channel-5\#ChannelInjectedConversion,SamplingTime-5\#ChannelInjectedConversion,InjectedOffset-5\#ChannelInjectedConversion,ExternalTrigInjecConv
+ADC1.ExternalTrigInjecConv=ADC_EXTERNALTRIGINJECCONV_T2_CC1
+ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConv,InjNumberOfConversion,EnableAnalogWatchDog,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,master,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,Rank-5\#ChannelInjectedConversion,Channel-5\#ChannelInjectedConversion,SamplingTime-5\#ChannelInjectedConversion,InjectedOffset-5\#ChannelInjectedConversion,ExternalTrigInjecConv,InjectedConvMode,Mode
ADC1.InjNumberOfConversion=4
+ADC1.InjectedConvMode=None
ADC1.InjectedOffset-2\#ChannelInjectedConversion=0
ADC1.InjectedOffset-3\#ChannelInjectedConversion=0
ADC1.InjectedOffset-4\#ChannelInjectedConversion=0
ADC1.InjectedOffset-5\#ChannelInjectedConversion=0
+ADC1.Mode=ADC_DUALMODE_REGSIMULT_INJECSIMULT
ADC1.NbrOfConversion=2
ADC1.NbrOfConversionFlag=1
ADC1.Rank-0\#ChannelRegularConversion=1
@@ -34,36 +36,67 @@ ADC1.SamplingTime-4\#ChannelInjectedConversion=ADC_SAMPLETIME_239CYCLES_5
ADC1.SamplingTime-5\#ChannelInjectedConversion=ADC_SAMPLETIME_71CYCLES_5
ADC1.ScanConvMode=ADC_SCAN_ENABLE
ADC1.master=1
-Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY
-Dma.ADC1.0.Instance=DMA1_Channel1
-Dma.ADC1.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
-Dma.ADC1.0.MemInc=DMA_MINC_ENABLE
-Dma.ADC1.0.Mode=DMA_CIRCULAR
-Dma.ADC1.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
-Dma.ADC1.0.PeriphInc=DMA_PINC_DISABLE
-Dma.ADC1.0.Priority=DMA_PRIORITY_VERY_HIGH
-Dma.ADC1.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
-Dma.I2C1_RX.1.Direction=DMA_PERIPH_TO_MEMORY
-Dma.I2C1_RX.1.Instance=DMA1_Channel7
-Dma.I2C1_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
-Dma.I2C1_RX.1.MemInc=DMA_MINC_ENABLE
-Dma.I2C1_RX.1.Mode=DMA_NORMAL
-Dma.I2C1_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
-Dma.I2C1_RX.1.PeriphInc=DMA_PINC_DISABLE
-Dma.I2C1_RX.1.Priority=DMA_PRIORITY_MEDIUM
-Dma.I2C1_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
-Dma.I2C1_TX.2.Direction=DMA_MEMORY_TO_PERIPH
-Dma.I2C1_TX.2.Instance=DMA1_Channel6
-Dma.I2C1_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
-Dma.I2C1_TX.2.MemInc=DMA_MINC_ENABLE
-Dma.I2C1_TX.2.Mode=DMA_NORMAL
-Dma.I2C1_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
-Dma.I2C1_TX.2.PeriphInc=DMA_PINC_DISABLE
-Dma.I2C1_TX.2.Priority=DMA_PRIORITY_MEDIUM
-Dma.I2C1_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
-Dma.Request0=ADC1
-Dma.Request1=I2C1_RX
-Dma.Request2=I2C1_TX
+ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_8
+ADC2.Channel-1\#ChannelInjectedConversion=ADC_CHANNEL_8
+ADC2.Channel-2\#ChannelInjectedConversion=ADC_CHANNEL_8
+ADC2.Channel-3\#ChannelInjectedConversion=ADC_CHANNEL_8
+ADC2.Channel-4\#ChannelInjectedConversion=ADC_CHANNEL_8
+ADC2.ContinuousConvMode=DISABLE
+ADC2.DataAlign=ADC_DATAALIGN_RIGHT
+ADC2.DiscontinuousConvMode=DISABLE
+ADC2.EnableAnalogWatchDog=false
+ADC2.EnableRegularConversion=ENABLE
+ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,Rank-1\#ChannelInjectedConversion,Channel-1\#ChannelInjectedConversion,SamplingTime-1\#ChannelInjectedConversion,InjectedOffset-1\#ChannelInjectedConversion,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,InjNumberOfConversion,Mode,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,InjectedConvMode,EnableAnalogWatchDog
+ADC2.InjNumberOfConversion=4
+ADC2.InjectedConvMode=None
+ADC2.InjectedOffset-1\#ChannelInjectedConversion=0
+ADC2.InjectedOffset-2\#ChannelInjectedConversion=0
+ADC2.InjectedOffset-3\#ChannelInjectedConversion=0
+ADC2.InjectedOffset-4\#ChannelInjectedConversion=0
+ADC2.Mode=ADC_DUALMODE_REGSIMULT_INJECSIMULT
+ADC2.NbrOfConversion=1
+ADC2.NbrOfConversionFlag=1
+ADC2.Rank-0\#ChannelRegularConversion=1
+ADC2.Rank-1\#ChannelInjectedConversion=1
+ADC2.Rank-2\#ChannelInjectedConversion=2
+ADC2.Rank-3\#ChannelInjectedConversion=3
+ADC2.Rank-4\#ChannelInjectedConversion=4
+ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-1\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-2\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-3\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.SamplingTime-4\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
+ADC2.ScanConvMode=ADC_SCAN_ENABLE
+Dma.ADC1.2.Direction=DMA_PERIPH_TO_MEMORY
+Dma.ADC1.2.Instance=DMA1_Channel1
+Dma.ADC1.2.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
+Dma.ADC1.2.MemInc=DMA_MINC_ENABLE
+Dma.ADC1.2.Mode=DMA_CIRCULAR
+Dma.ADC1.2.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
+Dma.ADC1.2.PeriphInc=DMA_PINC_DISABLE
+Dma.ADC1.2.Priority=DMA_PRIORITY_VERY_HIGH
+Dma.ADC1.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
+Dma.I2C1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
+Dma.I2C1_RX.0.Instance=DMA1_Channel7
+Dma.I2C1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
+Dma.I2C1_RX.0.MemInc=DMA_MINC_ENABLE
+Dma.I2C1_RX.0.Mode=DMA_NORMAL
+Dma.I2C1_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
+Dma.I2C1_RX.0.PeriphInc=DMA_PINC_DISABLE
+Dma.I2C1_RX.0.Priority=DMA_PRIORITY_MEDIUM
+Dma.I2C1_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
+Dma.I2C1_TX.1.Direction=DMA_MEMORY_TO_PERIPH
+Dma.I2C1_TX.1.Instance=DMA1_Channel6
+Dma.I2C1_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
+Dma.I2C1_TX.1.MemInc=DMA_MINC_ENABLE
+Dma.I2C1_TX.1.Mode=DMA_NORMAL
+Dma.I2C1_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
+Dma.I2C1_TX.1.PeriphInc=DMA_PINC_DISABLE
+Dma.I2C1_TX.1.Priority=DMA_PRIORITY_MEDIUM
+Dma.I2C1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
+Dma.Request0=I2C1_RX
+Dma.Request1=I2C1_TX
+Dma.Request2=ADC1
Dma.RequestsNb=3
FREERTOS.FootprintOK=true
FREERTOS.INCLUDE_vTaskDelete=0
@@ -82,16 +115,17 @@ IWDG.Prescaler=IWDG_PRESCALER_256
KeepUserPlacement=false
Mcu.Family=STM32F1
Mcu.IP0=ADC1
-Mcu.IP1=DMA
-Mcu.IP2=FREERTOS
-Mcu.IP3=I2C1
-Mcu.IP4=IWDG
-Mcu.IP5=NVIC
-Mcu.IP6=RCC
-Mcu.IP7=SYS
-Mcu.IP8=TIM2
-Mcu.IP9=TIM3
-Mcu.IPNb=10
+Mcu.IP1=ADC2
+Mcu.IP10=TIM3
+Mcu.IP2=DMA
+Mcu.IP3=FREERTOS
+Mcu.IP4=I2C1
+Mcu.IP5=IWDG
+Mcu.IP6=NVIC
+Mcu.IP7=RCC
+Mcu.IP8=SYS
+Mcu.IP9=TIM2
+Mcu.IPNb=11
Mcu.Name=STM32F103T(8-B)Ux
Mcu.Package=VFQFPN36
Mcu.Pin0=PA6
@@ -119,8 +153,8 @@ Mcu.PinsNb=21
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103T8Ux
-MxCube.Version=4.25.0
-MxDb.Version=DB.4.0.250
+MxCube.Version=4.26.0
+MxDb.Version=DB.4.0.260
NVIC.ADC1_2_IRQn=true\:5\:0\:false\:false\:true\:true\:true
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
NVIC.DMA1_Channel1_IRQn=true\:5\:0\:false\:false\:true\:true\:true
@@ -204,7 +238,7 @@ ProjectManager.BackupPrevious=false
ProjectManager.CompilerOptimize=3
ProjectManager.ComputerToolchain=false
ProjectManager.CoupleFile=false
-ProjectManager.CustomerFirmwarePackage=C\:/Users/Ralim/STM32Cube/Repository/STM32Cube_FW_F1_V1.6.1
+ProjectManager.CustomerFirmwarePackage=
ProjectManager.DefaultFWLocation=true
ProjectManager.DeletePrevious=true
ProjectManager.DeviceId=STM32F103T8Ux
@@ -216,15 +250,15 @@ ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=1
ProjectManager.MainLocation=Src
-ProjectManager.PreviousToolchain=SW4STM32
+ProjectManager.PreviousToolchain=TrueSTUDIO
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=TS100.ioc
ProjectManager.ProjectName=TS100
ProjectManager.StackSize=0x400
-ProjectManager.TargetToolchain=SW4STM32
+ProjectManager.TargetToolchain=TrueSTUDIO
ProjectManager.ToolChainLocation=
-ProjectManager.UnderRoot=false
-ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-SystemClock_Config-RCC-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_IWDG_Init-IWDG-false-HAL-true,8-MX_TIM2_Init-TIM2-false-HAL-true
+ProjectManager.UnderRoot=true
+ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-SystemClock_Config-RCC-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_IWDG_Init-IWDG-false-HAL-true,8-MX_TIM2_Init-TIM2-false-HAL-true,9-MX_ADC2_Init-ADC2-false-HAL-true
RCC.ADCFreqValue=8000000
RCC.ADCPresc=RCC_ADCPCLK2_DIV8
RCC.AHBFreq_Value=64000000
@@ -249,8 +283,8 @@ RCC.USBFreq_Value=42666666.666666664
RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5
SH.ADCx_IN7.0=ADC1_IN7,IN7
SH.ADCx_IN7.ConfNb=1
-SH.ADCx_IN8.0=ADC2_IN8
-SH.ADCx_IN8.1=ADC1_IN8,IN8
+SH.ADCx_IN8.0=ADC1_IN8,IN8
+SH.ADCx_IN8.1=ADC2_IN8,IN8
SH.ADCx_IN8.ConfNb=2
SH.ADCx_IN9.0=ADC2_IN9
SH.ADCx_IN9.1=ADC1_IN9,IN9
diff --git a/Translation Editor/BitmapEditor.html b/Translation Editor/BitmapEditor.html
index 39c9cae9..4da92db4 100644
--- a/Translation Editor/BitmapEditor.html
+++ b/Translation Editor/BitmapEditor.html
@@ -1,245 +1,245 @@
-
-
-
-
-
- TS100 Bitmap Editor
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ TS100 Bitmap Editor
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Translation Editor/TranslationEditor.html b/Translation Editor/TranslationEditor.html
index 76ba4b1b..35d50c8d 100644
--- a/Translation Editor/TranslationEditor.html
+++ b/Translation Editor/TranslationEditor.html
@@ -1,341 +1,341 @@
-
-
-
-
-
- TS100 Translation Editor
-
-
-
-
-
-
-
-
-
-
-
TS100 Translation Editor - {{ current.languageLocalName }} [{{current.languageCode}}]
-
-
-
-
-
-
-
-
Obsolete
-
-
- {{entry.id}} |
- {{entry.value}} |
-
-
-
-
-
Messages and Strings
-
-
- {{message.id}} |
-
- {{constraintString(message)}}
- {{referent.messages[message.id]}}
- {{message.note}}
-
- |
-
-
-
-
Characters
-
-
- {{char.id}} |
-
- {{constraintString(char)}}
- {{referent.characters[char.id]}}
-
- |
-
-
-
-
Menu Groups
-
-
-
Menu Options
-
-
- | Menu Type |
-
-
- |
-
-
- {{menu.id}} |
-
-
- Menu Name (Single-Line)
- {{constraintString(menu, current.menuDouble)}}
- {{referent.menuOptions[menu.id].text}}
-
-
-
- Menu Name (Double-Line)
- {{constraintString(menu, current.menuDouble)}}
- {{referent.menuOptions[menu.id].text2}}
-
-
- Description
- {{referent.menuOptions[menu.id].desc}}
-
- |
-
-
-
-
-
-
-
+
+
+
+
+
+ TS100 Translation Editor
+
+
+
+
+
+
+
+
+
+
+
TS100 Translation Editor - {{ current.languageLocalName }} [{{current.languageCode}}]
+
+
+
+
+
+
+
+
Obsolete
+
+
+ {{entry.id}} |
+ {{entry.value}} |
+
+
+
+
+
Messages and Strings
+
+
+ {{message.id}} |
+
+ {{constraintString(message)}}
+ {{referent.messages[message.id]}}
+ {{message.note}}
+
+ |
+
+
+
+
Characters
+
+
+ {{char.id}} |
+
+ {{constraintString(char)}}
+ {{referent.characters[char.id]}}
+
+ |
+
+
+
+
Menu Groups
+
+
+
Menu Options
+
+
+ | Menu Type |
+
+
+ |
+
+
+ {{menu.id}} |
+
+
+ Menu Name (Single-Line)
+ {{constraintString(menu, current.menuDouble)}}
+ {{referent.menuOptions[menu.id].text}}
+
+
+
+ Menu Name (Double-Line)
+ {{constraintString(menu, current.menuDouble)}}
+ {{referent.menuOptions[menu.id].text2}}
+
+
+ Description
+ {{referent.menuOptions[menu.id].desc}}
+
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Translation Editor/TranslationsParser.html b/Translation Editor/TranslationsParser.html
index 42752a04..e34c0c69 100644
--- a/Translation Editor/TranslationsParser.html
+++ b/Translation Editor/TranslationsParser.html
@@ -1,317 +1,317 @@
-
-
-
-
-
- TS100 Translation Parser
-
-
-
-
-
-
-
-
-
-
-
TS100 Translation Parser
-
-
-
-
-
-
+
+
+
+
+
+ TS100 Translation Parser
+
+
+
+
+
+
+
+
+
+
+
TS100 Translation Parser
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Translation Editor/translations.css b/Translation Editor/translations.css
index e1ffdcc5..21d808af 100644
--- a/Translation Editor/translations.css
+++ b/Translation Editor/translations.css
@@ -1,110 +1,110 @@
-* {
- font-family: sans-serif;
-}
-
-h1 {
- color: #66A;
-}
-
-h1 span {
- color: #000;
-}
-
-table.data, div.data {
- border: 1px solid #888;
- width: 100%;
-}
-
-div.value {
- margin: 2px;
-}
-
-.header input {
- width: 50% !important;
-}
-
-input.short {
- width: 150px !important;
- font-family: monospace;
-}
-
-.header .selected {
- display: block;
- font-family: monospace;
-}
-
-.stringId {
- font-family: monospace;
- font-weight: bold;
-}
-
-.label {
- background-color: #ddf;
- padding: 0.5em;
- width: 20%;
- color: #66A;
-}
-
-.value {
- background-color: #eef;
-}
-
-.value .label {
- width: 99%;
- font-weight: bold;
-}
-
-td input {
- width: 99%;
-}
-
-input.unchanged, input.empty, .unchanged input, .empty input {
- background-color: #ffc;
-}
-
-input.invalid, .invalid input {
- background-color: #f99;
-}
-
-.ref, .tran input {
- font-family: monospace;
-}
-
-.ref::before, .ref::after {
- color: #99F;
- font-family: sans-serif;
- content: "\"";
-}
-
-.note {
- color : #66A;
- font-style: italic;
-}
-
-div.constraint {
- float: right;
- display: inline-block;
- font-family: monospace;
- color: #66A;
-}
-
-.invalid .constraint {
- color: #f00;
-}
-
-.value {
- font-size: smaller;
-}
-
-.hidden {
- display: none;
-}
-
-.footer {
- margin-top: 0.5em;
- margin-bottom: 0.5em;
-}
-
-.saved {
- background-color: #ddd;
+* {
+ font-family: sans-serif;
+}
+
+h1 {
+ color: #66A;
+}
+
+h1 span {
+ color: #000;
+}
+
+table.data, div.data {
+ border: 1px solid #888;
+ width: 100%;
+}
+
+div.value {
+ margin: 2px;
+}
+
+.header input {
+ width: 50% !important;
+}
+
+input.short {
+ width: 150px !important;
+ font-family: monospace;
+}
+
+.header .selected {
+ display: block;
+ font-family: monospace;
+}
+
+.stringId {
+ font-family: monospace;
+ font-weight: bold;
+}
+
+.label {
+ background-color: #ddf;
+ padding: 0.5em;
+ width: 20%;
+ color: #66A;
+}
+
+.value {
+ background-color: #eef;
+}
+
+.value .label {
+ width: 99%;
+ font-weight: bold;
+}
+
+td input {
+ width: 99%;
+}
+
+input.unchanged, input.empty, .unchanged input, .empty input {
+ background-color: #ffc;
+}
+
+input.invalid, .invalid input {
+ background-color: #f99;
+}
+
+.ref, .tran input {
+ font-family: monospace;
+}
+
+.ref::before, .ref::after {
+ color: #99F;
+ font-family: sans-serif;
+ content: "\"";
+}
+
+.note {
+ color : #66A;
+ font-style: italic;
+}
+
+div.constraint {
+ float: right;
+ display: inline-block;
+ font-family: monospace;
+ color: #66A;
+}
+
+.invalid .constraint {
+ color: #f00;
+}
+
+.value {
+ font-size: smaller;
+}
+
+.hidden {
+ display: none;
+}
+
+.footer {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+.saved {
+ background-color: #ddd;
}
\ No newline at end of file
diff --git a/Translation Editor/translations_commons.js b/Translation Editor/translations_commons.js
index 4bb3b7c8..53f77c36 100644
--- a/Translation Editor/translations_commons.js
+++ b/Translation Editor/translations_commons.js
@@ -1,68 +1,68 @@
-function saveToFile(txt, filename){
- var a = document.createElement('a');
- a.setAttribute("style", "display: none");
- document.body.appendChild(a);
- a.setAttribute('href', 'data:application/json;charset=utf-8,'+encodeURIComponent(txt));
- a.setAttribute('download', filename);
- a.click();
- document.body.removeChild(a);
-}
-
-function saveJSON(obj, filename){
- var txt = JSON.stringify(obj,"", "\t");
- saveToFile(txt, filename);
-}
-
-function showJSON(obj, filename) {
- var txt = JSON.stringify(obj,"", "\t");
- var a = window.open("", "_blank").document;
- a.write("");
- a.write(txt);
- a.title = filename;
-}
-
-function startsWith(str, prefix) {
- return str.substring(0, prefix.length) == prefix;
-}
-
-function endsWith(str, suffix) {
- return str.substring(str.length-suffix.length) == suffix;
-}
-
-function isDefined(obj) {
- return typeof obj !== 'undefined';
-}
-
-function isNumber(obj) {
- return isDefined(obj) && obj != null;
-}
-
-function isDefinedNN(obj) {
- return isDefined(obj) && obj != null;
-}
-
-function padLeft(str, chr, maxLen) {
- str = str.toString();
- return str.length < maxLen ? padLeft(chr + str, chr, maxLen) : str;
-}
-
-// sourceArray contains a list of objects that have a property "id". This methods makes a map using the "id" as a key, and the owning object as a value.
-function copyArrayToMap(sourceArray, map) {
- if (!isDefined(map)) {
- map = {};
- }
- var len = sourceArray.length;
- for (var i = 0; i");
+ a.write(txt);
+ a.title = filename;
+}
+
+function startsWith(str, prefix) {
+ return str.substring(0, prefix.length) == prefix;
+}
+
+function endsWith(str, suffix) {
+ return str.substring(str.length-suffix.length) == suffix;
+}
+
+function isDefined(obj) {
+ return typeof obj !== 'undefined';
+}
+
+function isNumber(obj) {
+ return isDefined(obj) && obj != null;
+}
+
+function isDefinedNN(obj) {
+ return isDefined(obj) && obj != null;
+}
+
+function padLeft(str, chr, maxLen) {
+ str = str.toString();
+ return str.length < maxLen ? padLeft(chr + str, chr, maxLen) : str;
+}
+
+// sourceArray contains a list of objects that have a property "id". This methods makes a map using the "id" as a key, and the owning object as a value.
+function copyArrayToMap(sourceArray, map) {
+ if (!isDefined(map)) {
+ map = {};
+ }
+ var len = sourceArray.length;
+ for (var i = 0; iInstance, Channel));
@@ -1117,7 +1117,7 @@ HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
* @arg TIM_CHANNEL_4: TIM Channel 4 selected
* @retval HAL status
*/
-HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
+HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
{
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
diff --git a/workspace/TS100/inc/Settings.h b/workspace/TS100/inc/Settings.h
index 0c733c43..8d653943 100644
--- a/workspace/TS100/inc/Settings.h
+++ b/workspace/TS100/inc/Settings.h
@@ -11,7 +11,7 @@
#define SETTINGS_H_
#include
#include "stm32f1xx_hal.h"
-#define SETTINGSVERSION 0x14 /*Change this if you change the struct below to prevent people getting out of sync*/
+#define SETTINGSVERSION 0x15 /*Change this if you change the struct below to prevent people getting out of sync*/
/*
* This struct must be a multiple of 2 bytes as it is saved / restored from flash in uint16_t chunks
@@ -38,6 +38,8 @@ typedef struct {
uint8_t PID_I; //PID I Term
uint8_t PID_D; //PID D Term
uint8_t version; //Used to track if a reset is needed on firmware upgrade
+ uint8_t customTipGain; // Tip gain value if custom tuned, or 0 if using a tipType param
+ uint8_t tipType;
uint32_t padding; //This is here for in case we are not an even divisor so that nothing gets cut off
} systemSettingsType;
diff --git a/workspace/TS100/inc/Setup.h b/workspace/TS100/inc/Setup.h
index 1e1e7c99..3e8c5f46 100644
--- a/workspace/TS100/inc/Setup.h
+++ b/workspace/TS100/inc/Setup.h
@@ -15,6 +15,7 @@ extern "C" {
#include "stm32f1xx_hal.h"
extern ADC_HandleTypeDef hadc1;
+extern ADC_HandleTypeDef hadc2;
extern DMA_HandleTypeDef hdma_adc1;
extern DMA_HandleTypeDef hdma_i2c1_rx;
diff --git a/workspace/TS100/inc/Translation.h b/workspace/TS100/inc/Translation.h
index d13c9157..7c8605f8 100644
--- a/workspace/TS100/inc/Translation.h
+++ b/workspace/TS100/inc/Translation.h
@@ -17,8 +17,8 @@ enum ShortNameType {
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
*/
extern const enum ShortNameType SettingsShortNameType;
-extern const char* SettingsShortNames[17][2];
-extern const char* SettingsDescriptions[17];
+extern const char* SettingsShortNames[20][2];
+extern const char* SettingsDescriptions[20];
extern const char* SettingsMenuEntries[4];
extern const char* SettingsMenuEntriesDescriptions[4];
diff --git a/workspace/TS100/inc/hardware.h b/workspace/TS100/inc/hardware.h
index ca149c43..93a5ddc2 100644
--- a/workspace/TS100/inc/hardware.h
+++ b/workspace/TS100/inc/hardware.h
@@ -14,11 +14,21 @@ extern "C" {
#endif
enum Orientation {
- ORIENTATION_LEFT_HAND = 0,
- ORIENTATION_RIGHT_HAND = 1,
- ORIENTATION_FLAT = 3
+ ORIENTATION_LEFT_HAND = 0, ORIENTATION_RIGHT_HAND = 1, ORIENTATION_FLAT = 3
+};
+/*
+ * Keep in a uint8_t range for the ID's
+ */
+enum TipType {
+ TS_B2 = 0,
+ TS_D24 = 1,
+ TS_BC2 = 2,
+ TS_C1 = 3,
+ Tip_MiniWare=4,
+ HAKKO_BC2=4,
+ Tip_Hakko=5,
+ Tip_Custom=5,
};
-
#define KEY_B_Pin GPIO_PIN_6
#define KEY_B_GPIO_Port GPIOA
#define TMP36_INPUT_Pin GPIO_PIN_7
@@ -54,6 +64,7 @@ uint16_t ftoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToF(uint16_t raw);
void setCalibrationOffset(int16_t offSet);
+void setTipType(enum TipType tipType, uint8_t manualCalGain);
#ifdef __cplusplus
}
#endif
diff --git a/workspace/TS100/inc/main.hpp b/workspace/TS100/inc/main.hpp
index 632f3ca3..f91bf0a4 100644
--- a/workspace/TS100/inc/main.hpp
+++ b/workspace/TS100/inc/main.hpp
@@ -4,7 +4,7 @@
#include
#include "Setup.h"
#include "OLED.hpp"
-
+extern uint16_t currentlyActiveTemperatureTarget;
extern OLED lcd;
extern MMA8652FC accel;
extern uint8_t PCBVersion;
@@ -25,6 +25,8 @@ enum ButtonState {
ButtonState getButtonState();
void waitForButtonPressOrTimeout(uint32_t timeout);
+void waitForButtonPress();
+void GUIDelay();
#ifdef __cplusplus
extern "C" {
#endif
@@ -36,7 +38,8 @@ void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
-void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName );
+void vApplicationStackOverflowHook( xTaskHandle *pxTask,
+ signed portCHAR *pcTaskName);
#ifdef __cplusplus
}
diff --git a/workspace/TS100/src/FRToSI2C.cpp b/workspace/TS100/src/FRToSI2C.cpp
index 63784d50..b50f86d2 100644
--- a/workspace/TS100/src/FRToSI2C.cpp
+++ b/workspace/TS100/src/FRToSI2C.cpp
@@ -7,7 +7,7 @@
#include "FRToSI2C.hpp"
-void FRToSI2C::CpltCallback() {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) FRToSI2C::CpltCallback() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
i2c->State = HAL_I2C_STATE_READY;//Force state reset
if (I2CSemaphore) {
diff --git a/workspace/TS100/src/OLED.cpp b/workspace/TS100/src/OLED.cpp
index 15e85070..6c638ae6 100644
--- a/workspace/TS100/src/OLED.cpp
+++ b/workspace/TS100/src/OLED.cpp
@@ -42,17 +42,8 @@ uint8_t OLED_Setup_Array[] = { /**/
};
//Setup based on the SSD1307 and modified for the SSD1306
-const uint8_t REFRESH_COMMANDS[17] = {
- 0x80, 0xAF,
- 0x80, 0x21,
- 0x80, 0x20,
- 0x80, 0x7F,
- 0x80, 0xC0,
- 0x80, 0x22,
- 0x80, 0x00,
- 0x80, 0x01,
- 0x40
-};
+const uint8_t REFRESH_COMMANDS[17] = { 0x80, 0xAF, 0x80, 0x21, 0x80, 0x20, 0x80,
+ 0x7F, 0x80, 0xC0, 0x80, 0x22, 0x80, 0x00, 0x80, 0x01, 0x40 };
OLED::OLED(FRToSI2C* i2cHandle) {
i2c = i2cHandle;
@@ -70,11 +61,12 @@ OLED::OLED(FRToSI2C* i2cHandle) {
void OLED::initialize() {
memcpy(&screenBuffer[0], &REFRESH_COMMANDS[0], sizeof(REFRESH_COMMANDS));
- HAL_Delay(5);
+ HAL_Delay(50);
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
- HAL_Delay(10);
+ HAL_Delay(50);
//Send the setup settings
- i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
+ i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
+ sizeof(OLED_Setup_Array));
displayOnOff(true);
}
@@ -145,19 +137,20 @@ void OLED::setRotation(bool leftHanded) {
//send command struct again with changes
if (leftHanded) {
- OLED_Setup_Array[11] = 0xC8; //c1?
- OLED_Setup_Array[19] = 0xA1;
+ OLED_Setup_Array[11] = 0xC8; //c1?
+ OLED_Setup_Array[19] = 0xA1;
} else {
- OLED_Setup_Array[11] = 0xC0;
- OLED_Setup_Array[19] = 0xA0;
- }
- i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
- inLeftHandedMode = leftHanded;
+ OLED_Setup_Array[11] = 0xC0;
+ OLED_Setup_Array[19] = 0xA0;
+ }
+ i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
+ sizeof(OLED_Setup_Array));
+ inLeftHandedMode = leftHanded;
screenBuffer[5] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
screenBuffer[7] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
- }
+}
//print a string to the current cursor location
void OLED::print(const char* str) {
@@ -190,9 +183,13 @@ void OLED::setFont(uint8_t fontNumber) {
//maximum places is 5
void OLED::printNumber(uint16_t number, uint8_t places) {
- char buffer[6] = { 0 };
-
- if (places == 5) {
+ char buffer[7] = { 0 };
+
+ if (places >= 5) {
+ buffer[5] = '0' + number % 10;
+ number /= 10;
+ }
+ if (places > 4) {
buffer[4] = '0' + number % 10;
number /= 10;
}
@@ -291,7 +288,7 @@ void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
}
void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
-bool clear) {
+ bool clear) {
//Draw this in 3 sections
//This is basically a N wide version of vertical line
diff --git a/workspace/TS100/src/Settings.cpp b/workspace/TS100/src/Settings.cpp
index 840aebb4..5ceea20f 100644
--- a/workspace/TS100/src/Settings.cpp
+++ b/workspace/TS100/src/Settings.cpp
@@ -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();
}
diff --git a/workspace/TS100/src/Setup.c b/workspace/TS100/src/Setup.c
index 8cbf54a1..5df7a5bf 100644
--- a/workspace/TS100/src/Setup.c
+++ b/workspace/TS100/src/Setup.c
@@ -6,6 +6,7 @@
*/
#include "Setup.h"
ADC_HandleTypeDef hadc1;
+ADC_HandleTypeDef hadc2;
DMA_HandleTypeDef hdma_adc1;
I2C_HandleTypeDef hi2c1;
@@ -27,6 +28,7 @@ static void MX_TIM3_Init(void);
static void MX_TIM2_Init(void);
static void MX_DMA_Init(void);
static void MX_GPIO_Init(void);
+static void MX_ADC2_Init(void);
void Setup_HAL() {
SystemClock_Config();
@@ -34,12 +36,16 @@ void Setup_HAL() {
MX_DMA_Init();
MX_I2C1_Init();
MX_ADC1_Init();
+ MX_ADC2_Init();
MX_TIM3_Init();
MX_TIM2_Init();
MX_IWDG_Init();
-
- HAL_ADC_Start_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
+ HAL_ADC_Start(&hadc2);
+ HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
HAL_ADCEx_InjectedStart(&hadc1); //enable injected readings
+ HAL_ADCEx_InjectedStart(&hadc2); //enable injected readings
+
+
}
//channel 0 -> temperature sensor, 1-> VIN
@@ -99,6 +105,7 @@ void SystemClock_Config(void) {
/* ADC1 init function */
static void MX_ADC1_Init(void) {
+ ADC_MultiModeTypeDef multimode;
ADC_ChannelConfTypeDef sConfig;
ADC_InjectionConfTypeDef sConfigInjected;
@@ -113,6 +120,11 @@ static void MX_ADC1_Init(void) {
hadc1.Init.NbrOfConversion = 2;
HAL_ADC_Init(&hadc1);
+ /**Configure the ADC multi-mode
+ */
+ multimode.Mode = ADC_DUALMODE_REGSIMULT_INJECSIMULT;
+ HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode);
+
/**Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_7;
@@ -159,6 +171,59 @@ static void MX_ADC1_Init(void) {
;
}
+/* ADC2 init function */
+static void MX_ADC2_Init(void) {
+
+ ADC_ChannelConfTypeDef sConfig;
+ ADC_InjectionConfTypeDef sConfigInjected;
+
+ /**Common config
+ */
+ hadc2.Instance = ADC2;
+ hadc2.Init.ScanConvMode = ADC_SCAN_ENABLE;
+ hadc2.Init.ContinuousConvMode = ENABLE;
+ hadc2.Init.DiscontinuousConvMode = DISABLE;
+ hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
+ hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
+ hadc2.Init.NbrOfConversion = 2;
+ HAL_ADC_Init(&hadc2);
+
+ /**Configure Regular Channel
+ */
+ sConfig.Channel = ADC_CHANNEL_8;
+ sConfig.Rank = ADC_REGULAR_RANK_1;
+ sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
+ HAL_ADC_ConfigChannel(&hadc2, &sConfig);
+ sConfig.Channel = ADC_CHANNEL_8;
+ sConfig.Rank = ADC_REGULAR_RANK_2;
+ sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
+ HAL_ADC_ConfigChannel(&hadc2, &sConfig);
+
+ /**Configure Injected Channel
+ */
+ sConfigInjected.InjectedChannel = ADC_CHANNEL_8;
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_1;
+ sConfigInjected.InjectedNbrOfConversion = 4;
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
+ sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
+ sConfigInjected.AutoInjectedConv = DISABLE;
+ sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
+ sConfigInjected.InjectedOffset = 0;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
+
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_2;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_3;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+ sConfigInjected.InjectedRank = ADC_INJECTED_RANK_4;
+ HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
+
+ // Run ADC internal calibration
+ while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
+ ;
+
+}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
@@ -370,6 +435,7 @@ static void MX_GPIO_Init(void) {
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(OLED_RESET_GPIO_Port, &GPIO_InitStruct);
+ HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
/* Configure GPIO pins : INT_Orientation_Pin INT_Movement_Pin */
/* Not used anymore*/
diff --git a/workspace/TS100/src/Translation.cpp b/workspace/TS100/src/Translation.cpp
index 7392af15..4ea1a970 100644
--- a/workspace/TS100/src/Translation.cpp
+++ b/workspace/TS100/src/Translation.cpp
@@ -8,54 +8,11 @@
#ifndef LANG
#define LANG_EN
#endif
-// TEMPLATES for short names - choose one and use it as base for your
-// translation:
-
-//const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-//const char* SettingsShortNames[17][2] = {
-// /* (<= 5) Power source (DC or batt) */ {"PWRSC"},
-// /* (<= 4) Sleep temperature */ {"STMP"},
-// /* (<= 4) Sleep timeout */ {"STME"},
-// /* (<= 5) Shutdown timeout */ {"SHTME"},
-// /* (<= 6) Motion sensitivity level */ {"MSENSE"},
-// /* (<= 6) Temperature in F and C */ {"TMPUNT"},
-// /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"},
-// /* (<= 6) Display rotation mode */ {"DSPROT"},
-// /* (<= 6) Boost enabled */ {"BOOST"},
-// /* (<= 4) Boost temperature */ {"BTMP"},
-// /* (<= 6) Automatic start mode */ {"ASTART"},
-// /* (<= 6) Cooldown blink */ {"CLBLNK"},
-// /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"},
-// /* (<= 8) Settings reset command */ {"RESET?"},
-// /* (<= 8) Calibrate input voltage */ {"CAL VIN?"},
-// /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"},
-// /* (<= 6) Message Scroll Speed */ {"DESCSP"},
-//};
-
-//const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-//const char* SettingsShortNames[17][2] = {
-// /* (<= 11) Power source (DC or batt) */ {"Power", "source"},
-// /* (<= 9) Sleep temperature */ {"Sleep", "temp"},
-// /* (<= 9) Sleep timeout */ {"Sleep", "timeout"},
-// /* (<= 11) Shutdown timeout */ {"Shutdown", "timeout"},
-// /* (<= 13) Motion sensitivity level */ {"Motion", "sensitivity"},
-// /* (<= 13) Temperature in F and C */ {"Temperature", "units"},
-// /* (<= 13) Advanced idle display mode enabled */ {"Detailed", "idle screen"},
-// /* (<= 13) Display rotation mode */ {"Display", "orientation"},
-// /* (<= 13) Boost enabled */ {"Boost mode", "enabled"},
-// /* (<= 9) Boost temperature */ {"Boost", "temp"},
-// /* (<= 13) Automatic start mode */ {"Auto", "start"},
-// /* (<= 13) Cooldown blink */ {"Cooldown", "blink"},
-// /* (<= 16) Temperature calibration enter menu */ {"Calibrate", "temperature?"},
-// /* (<= 16) Settings reset command */ {"Factory", "Reset?"},
-// /* (<= 16) Calibrate input voltage */ {"Calibrate", "input voltage?"},
-// /* (<= 13) Advanced soldering screen enabled */ {"Detailed", "solder screen"},
-// /* (<= 11) Display Help Text Scroll Speed */ {"Description","Scroll Speed"},
-//};
+// TEMPLATE: Please use the English translations
#ifdef LANG_EN
-const char* SettingsDescriptions[17] = {
+const char* SettingsDescriptions[20] = {
// These are all the help text for all the settings.
// No requirements on spacing or length.
/* Power source (DC or batt) */"Power source. Sets cutoff voltage. ",
@@ -75,8 +32,12 @@ const char* SettingsDescriptions[17] = {
/* Calibrate input voltage */"VIN Calibration. Buttons adjust, long press to exit",
/* Advanced soldering screen enabled */"Display detailed information while soldering",
/* Description Scroll Speed */"Speed this text scrolls past at",
+ /* Tip Model */"Tip Model selection ",
+ /* Simple Calibration Mode */"Simple Calibration using Hot water",
+ /* Advanced Calibration Mode */"Advanced calibration using thermocouple on the tip"
-#ifdef PIDSETTINGS
+
+ #ifdef PIDSETTINGS
"PID P term. Inverse values! This acts as a divisor. So Larger numbers == typically smaller in other systems",
"PID I term. Inverse values! This acts as a divisor. So Larger numbers == typically smaller in other systems",
@@ -112,7 +73,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Power", "source"},
/* (<= 9) Sleep temperature */{"Sleep", "temp"},
/* (<= 9) Sleep timeout */{"Sleep", "timeout"},
@@ -130,6 +91,9 @@ const char* SettingsShortNames[17][2] = {
/* (<= 16) Calibrate input voltage */{"Calibrate", "input voltage?"},
/* (<= 13) Advanced soldering screen enabled */{"Detailed", "solder screen"},
/* (<= 11) Display Help Text Scroll Speed */{"Description","Scroll Speed"},
+ /* (<= 08) The Tip model being selected */{"Tip","Model"},
+ /* (<= 16) Simple Calibration */{"Simple","Calibration"},
+ /* (<= 16) Advanced Calibration */{"Advanced","Calibration"},
#ifdef PIDSETTINGS
{ "PID","P"},
@@ -139,6 +103,7 @@ const char* SettingsShortNames[17][2] = {
};
+
// SettingsMenuEntries lengths <= 13 per line (\n starts second line)
const char* SettingsMenuEntries[4] = {
/* Soldering Menu */"Soldering\nSettings",
@@ -203,7 +168,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Източник", "захранване"},
/* (<= 9) Sleep temperature */{"Темп.", "сън"},
/* (<= 9) Sleep timeout */{"Време", "сън"},
@@ -292,7 +257,7 @@ const char SettingFastChar = '+';
const char SettingSlowChar = '-';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Источник","питания"}, //8,7
/* (<= 9) Sleep temperature */{"Темпер.","сна"}, //7,3
/* (<= 9) Sleep timeout */{"Таймаут","сна"}, //7,3
@@ -457,7 +422,7 @@ const char SettingFastChar = 'N';//'F';
const char SettingSlowChar = 'H';//'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Virtalähde", "DC"},
/* (<= 9) Sleep temperature */{"Lepotilan", "lämpötila"},
/* (<= 9) Sleep timeout */{"Lepotilan", "viive"},
@@ -544,7 +509,7 @@ const char SettingFastChar = 'V';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Sorgente", "alimentaz"},
/* (<= 9) Sleep temperature */{"Temp", "standby"},
/* (<= 9) Sleep timeout */{"Timer", "standby"},
@@ -628,7 +593,7 @@ const char SettingFastChar = 'R';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Source", "d'alim"},
/* (<= 9) Sleep temperature */{"Temp.", "veille"},
/* (<= 9) Sleep timeout */{"Délai", "veille"},
@@ -718,7 +683,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Spannungs-", "quelle"},
/* (<= 9) Sleep temperature */{"Ruhetemp-", "eratur"},
/* (<= 9) Sleep timeout */{"Ruhever-", "zögerung"},
@@ -799,7 +764,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -880,7 +845,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -961,7 +926,7 @@ const char SettingFastChar = 'B';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Izvor", "napajanja"},
/* (<= 9) Sleep temperature */{"Temp", "spavanja"},
/* (<= 9) Sleep timeout */{"Vrijeme", "spavanja"},
@@ -1040,7 +1005,7 @@ const char SettingFastChar = 'R';
const char SettingSlowChar = 'P';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Zdroj", "napájení"},
/* (<= 9) Sleep temperature */{"Teplota v", "r. spánku"},
/* (<= 9) Sleep timeout */{"Čas do", "r. spánku"},
@@ -1125,7 +1090,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -1206,7 +1171,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -1287,7 +1252,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -1467,7 +1432,7 @@ const char SettingFastChar = 'T';
const char SettingSlowChar = 'N';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Maitinimo", "šaltinis"},
/* (<= 9) Sleep temperature */{"Miego", "temperat."},
/* (<= 9) Sleep timeout */{"Miego", "laikas"},
@@ -1549,7 +1514,7 @@ const char SettingFastChar = '+';
const char SettingSlowChar = '-';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Джерело","живлення"}, //7,8
/* (<= 9) Sleep temperature */{"Темпер.","сну"}, //7,3
/* (<= 9) Sleep timeout */{"Таймаут","сну"}, //7,3
@@ -1633,7 +1598,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Spannings-", "bron"},
/* (<= 9) Sleep temperature */{"Slaap", "temp"},
/* (<= 9) Sleep timeout */{"Slaap", "time-out"},
@@ -1719,7 +1684,7 @@ const char SettingFastChar = 'S';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Ström-", "källa"},
/* (<= 9) Sleep temperature */{"Vilo-", "temp"},
/* (<= 9) Sleep timeout */{"Vilo-", "timeout"},
@@ -1806,7 +1771,7 @@ const char SettingFastChar = 'B';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
-const char* SettingsShortNames[17][2] =
+const char* SettingsShortNames[20][2] =
{
/* (<= 11) Power source (DC or batt) */{ "Izvor", "napajanja" },
/* (<= 9) Sleep temperature */{ "Temp", "spavanja" },
@@ -1884,7 +1849,7 @@ const char SettingAutoChar = 'A';
const char SettingFastChar = 'H';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
-const char* SettingsShortNames[17][2] = {
+const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"Kilde"},
/* (<= 4) Sleep temperature */{"DTmp"},
/* (<= 4) Sleep timeout */{"DTid"},
diff --git a/workspace/TS100/src/gui.cpp b/workspace/TS100/src/gui.cpp
index aa5cc229..59b3e74e 100644
--- a/workspace/TS100/src/gui.cpp
+++ b/workspace/TS100/src/gui.cpp
@@ -52,11 +52,19 @@ static void settings_setCoolingBlinkEnabled(void);
static void settings_displayCoolingBlinkEnabled(void);
static void settings_setResetSettings(void);
static void settings_displayResetSettings(void);
+static void settings_setTipModel(void);
+static void settings_displayTipModel(void);
static void settings_setCalibrate(void);
static void settings_displayCalibrate(void);
static void settings_setCalibrateVIN(void);
static void settings_displayCalibrateVIN(void);
+//Calibration Menu
+static void calibration_displaySimpleCal(void); // Hot water cal
+static void calibration_enterSimpleCal(void);
+static void calibration_displayAdvancedCal(void); // two point cal
+static void calibration_enterAdvancedCal(void);
+
//Menu functions
static void settings_displaySolderingMenu(void);
static void settings_enterSolderingMenu(void);
@@ -185,6 +193,8 @@ const menuitem advancedMenu[] = {
settings_displayAdvancedSolderingScreens } }, /* Advanced soldering screen*/
{ (const char*) SettingsDescriptions[13], { settings_setResetSettings }, {
settings_displayResetSettings } }, /*Resets settings*/
+{ (const char*) SettingsDescriptions[17], { settings_setTipModel }, {
+ settings_displayTipModel } }, /*Select tip Model */
{ (const char*) SettingsDescriptions[12], { settings_setCalibrate }, {
settings_displayCalibrate } }, /*Calibrate tip*/
{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
@@ -201,6 +211,13 @@ const menuitem advancedMenu[] = {
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
};
+const menuitem calibrationMenu[] { { (const char*) SettingsDescriptions[6], {
+ calibration_enterSimpleCal }, { calibration_displaySimpleCal } },
+/* Simple Cal*/
+{ (const char*) SettingsDescriptions[6], { calibration_enterAdvancedCal }, {
+ calibration_displayAdvancedCal } }, /* Advanced Cal */
+{ NULL, { NULL }, { NULL } } };
+
static void printShortDescriptionSingleLine(uint32_t shortDescIndex) {
lcd.setFont(0);
lcd.setCharCursor(0, 0);
@@ -569,30 +586,214 @@ static void settings_displayResetSettings(void) {
printShortDescription(13, 7);
}
-static void settings_setCalibrate(void) {
- if (userConfirmation(SettingsCalibrationWarning)) {
- //User confirmed
- //So we now perform the actual calculation
+static void settings_setTipModel(void) {
+ systemSettings.tipType++;
+ systemSettings.tipType %= (Tip_Custom + 1); //Wrap after custom
+
+}
+static void settings_displayTipModel(void) {
+ printShortDescription(17, 4);
+ //Print in small text the tip model
+ lcd.setFont(1);
+ //set the cursor
+ //Print the mfg
+ lcd.setCursor(40, 0);
+ if (systemSettings.tipType < Tip_MiniWare) {
+ lcd.print("TS100");
+ } else if (systemSettings.tipType < Tip_Hakko) {
+ lcd.print("HAKKO");
+ } else if (systemSettings.tipType == Tip_Custom) {
+ lcd.print("User");
+ }
+ lcd.setCursor(40, 8);
+ switch ((enum TipType) systemSettings.tipType) {
+ case TS_B2:
+ lcd.print(" B2 ");
+ break;
+ case TS_D24:
+ lcd.print(" D24 ");
+ break;
+ case TS_BC2:
+ lcd.print(" BC2 ");
+ break;
+ case TS_C1:
+ lcd.print(" C1 ");
+ break;
+ case HAKKO_BC2:
+ lcd.print(" BC2 ");
+ break;
+ case Tip_Custom:
+ lcd.print("Tuned");
+ break;
+ default:
+ lcd.print("????");
+ break;
+ }
+}
+static void calibration_displaySimpleCal(void) {
+ printShortDescription(18, 5);
+}
+static void dotDelay() {
+ for (uint8_t i = 0; i < 20; i++) {
+ getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
lcd.clearScreen();
lcd.setCursor(0, 0);
- lcd.print(".....");
+ for (uint8_t x = 0; x < i / 4; x++)
+ lcd.print(".");
lcd.refresh();
+ osDelay(50);
+ }
+}
+static void setTipOffset() {
+ setCalibrationOffset(0); //turn off the current offset
+ dotDelay();
- setCalibrationOffset(0); //turn off the current offset
- for (uint8_t i = 0; i < 20; i++) {
- getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
- osDelay(20);
+ //If the thermocouple at the end of the tip, and the handle are at equalibrium, then the output should be zero, as there is no temperature differential.
+
+ int32_t offset = 0;
+ for (uint8_t i = 0; i < 15; i++) {
+ offset += getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
+
+ lcd.clearScreen();
+ lcd.setCursor(0, 0);
+
+ for (uint8_t x = 0; x < i / 4; x++)
+ lcd.print(".");
+ lcd.refresh();
+ osDelay(200);
+ }
+ systemSettings.CalibrationOffset = offset / 15;
+ setCalibrationOffset(systemSettings.CalibrationOffset); //store the error
+ osDelay(100);
+}
+static void calibration_enterSimpleCal(void) {
+//User has entered into the simple cal routine
+ if (userConfirmation(SettingsCalibrationWarning)) {
+ //User has confirmed their handle is at ambient
+ //So take the offset measurement
+ setTipOffset();
+ //Next we want the user to put the tip into 100C water so we can calculate their tip's gain
+ //Gain is the m term from rise/run plot of raw readings vs (tip-handle)
+ //Thus we want to calculate ([TipRawHot-TipRawCold])/(ActualHot-HandleHot)-(ActualCold-HandleCold)
+ //Thus we first need to store -> TiprawCold,HandleCold,ActualCold==HandleCold -> RawTipCold
+ uint32_t RawTipCold = getTipRawTemp(0) * 10;
+ lcd.clearScreen();
+ lcd.setCursor(0, 0);
+ lcd.setFont(1);
+ lcd.print("Please Insert Tip\nInto Boiling Water");
+ lcd.refresh();
+ osDelay(200);
+ waitForButtonPress();
+ dotDelay(); //cycle the filter a bit
+ //Now take the three hot measurements
+ //Assume water is boiling at 100C
+ uint32_t RawTipHot = getTipRawTemp(0) * 10;
+ uint32_t HandleTempHot = getHandleTemperature() / 10;
+
+ uint32_t gain = (RawTipHot - RawTipCold) / (100 - HandleTempHot);
+
+ //Show this to the user
+ lcd.clearScreen();
+ lcd.setCursor(0, 0);
+ lcd.print("Your G: ");
+ lcd.printNumber(gain, 6);
+ lcd.print("\n~= 120-140");
+ lcd.refresh();
+ osDelay(2000);
+ waitForButtonPress();
+ lcd.clearScreen();
+ lcd.setCursor(0, 0);
+ lcd.print("H: ");
+ lcd.printNumber(RawTipHot, 8);
+ lcd.setCursor(0, 8);
+ lcd.print("C: ");
+ lcd.printNumber(RawTipCold, 8);
+ lcd.refresh();
+ osDelay(2000);
+ waitForButtonPress();
+ }
+}
+static void calibration_displayAdvancedCal(void) {
+ printShortDescription(19, 5);
+}
+static void calibration_enterAdvancedCal(void) {
+ //Advanced cal
+ if (userConfirmation(SettingsCalibrationWarning)) {
+ //User has confirmed their handle is at ambient
+ //So take the offset measurement
+ setTipOffset();
+ //The tip now has a known ADC offset
+ //Head up until it is at 350C
+ //Then let the user adjust the gain value until it converges
+ systemSettings.customTipGain = 120;
+ bool exit = false;
+
+ while (exit == false) {
+ //Set tip to 350C
+ currentlyActiveTemperatureTarget = ctoTipMeasurement(350);
+ //Check if user has pressed button to change the gain
+ ButtonState buttons = getButtonState();
+ switch (buttons) {
+ case BUTTON_NONE:
+ break;
+ case BUTTON_BOTH:
+ case BUTTON_B_LONG:
+ case BUTTON_F_LONG:
+ exit = true;
+ break;
+ case BUTTON_F_SHORT:
+ systemSettings.customTipGain++;
+ break;
+ case BUTTON_B_SHORT: {
+ systemSettings.customTipGain--;
+ }
+ break;
+ default:
+ break;
+ }
+ if (systemSettings.customTipGain > 200)
+ systemSettings.customTipGain = 200;
+ else if (systemSettings.customTipGain <= 100)
+ systemSettings.customTipGain = 100;
+ lcd.setCursor(0, 0);
+ lcd.clearScreen();
+ lcd.setFont(0);
+ if (lcd.getRotation())
+ lcd.drawChar('-');
+ else
+ lcd.drawChar('+');
+
+ lcd.drawChar(' ');
+ lcd.printNumber(systemSettings.customTipGain, 4);
+ lcd.drawChar(' ');
+ if (lcd.getRotation())
+ lcd.drawChar('+');
+ else
+ lcd.drawChar('-');
+ lcd.refresh();
+ GUIDelay();
}
- osDelay(100);
- uint16_t rawTempC = tipMeasurementToC(getTipRawTemp(0));
- //We now measure the current reported tip temperature
- uint16_t handleTempC = getHandleTemperature() / 10;
- //We now have an error between these that we want to store as the offset
- rawTempC = rawTempC - handleTempC;
- systemSettings.CalibrationOffset = rawTempC;
- setCalibrationOffset(rawTempC); //store the error
- osDelay(100);
+ }
+}
+//Provide the user the option to tune their own tip if custom is selected
+//If not only do single point tuning as per usual
+static void settings_setCalibrate(void) {
+ if (systemSettings.tipType == Tip_Custom) {
+ //Two types of calibration
+ //1. Basic, idle temp + hot water (100C)
+ //2. Advanced, 100C + 350C, we keep PID tracking to a temperature target
+ return gui_Menu(calibrationMenu);
+ }
+ //Else
+ // Ask user if handle is at the tip temperature
+ // Any error between handle and the tip will be a direct offset in the control loop
+
+ else if (userConfirmation(SettingsCalibrationWarning)) {
+ //User confirmed
+ //So we now perform the actual calculation
+ setTipOffset();
+
}
}
diff --git a/workspace/TS100/src/hardware.c b/workspace/TS100/src/hardware.c
index 08b909bf..0dc1172f 100644
--- a/workspace/TS100/src/hardware.c
+++ b/workspace/TS100/src/hardware.c
@@ -9,6 +9,14 @@
#include "hardware.h"
volatile uint16_t PWMSafetyTimer = 0;
volatile int16_t CalibrationTempOffset = 0;
+uint16_t tipGainCalValue = 0;
+uint16_t lookupTipDefaultCalValue(enum TipType tipID);
+void setTipType(enum TipType tipType, uint8_t manualCalGain) {
+ if (manualCalGain)
+ tipGainCalValue = manualCalGain;
+ else
+ tipGainCalValue = lookupTipDefaultCalValue(tipType);
+}
void setCalibrationOffset(int16_t offSet) {
CalibrationTempOffset = offSet;
}
@@ -29,48 +37,95 @@ uint16_t getHandleTemperature() {
}
uint16_t tipMeasurementToC(uint16_t raw) {
- return ((raw - 532) / 33) + (getHandleTemperature() / 10)
- - CalibrationTempOffset;
- //Surprisingly that appears to be a fairly good linear best fit
+
+ //((Raw Tip-RawOffset) * calibrationgain) / 1000 = tip delta in CX10
+ // tip delta in CX10 + handleTemp in CX10 = tip absolute temp in CX10
+ //Div answer by 10 to get final result
+
+ uint32_t tipDelta = ((raw - CalibrationTempOffset) * tipGainCalValue)
+ / 1000;
+ tipDelta += getHandleTemperature();
+
+ return tipDelta / 10;
+
}
uint16_t ctoTipMeasurement(uint16_t temp) {
- //We need to compensate for cold junction temp
- return ((temp - (getHandleTemperature() / 10) + CalibrationTempOffset) * 33)
- + 532;
+ //[ (temp-handle/10) * 10000 ]/calibrationgain = tip raw delta
+ // tip raw delta + tip offset = tip ADC reading
+ int32_t TipRaw = ((temp - (getHandleTemperature() / 10)) * 10000)
+ / tipGainCalValue;
+ TipRaw += CalibrationTempOffset;
+ return TipRaw;
}
uint16_t tipMeasurementToF(uint16_t raw) {
- return ((((raw - 532) / 33) + (getHandleTemperature() / 10)
- - CalibrationTempOffset) * 9) / 5 + 32;
+ //Convert result from C to F
+ return (tipMeasurementToC(raw) * 9) / 5 + 32;
}
uint16_t ftoTipMeasurement(uint16_t temp) {
-
- return (((((temp - 32) * 5) / 9) - (getHandleTemperature() / 10)
- + CalibrationTempOffset) * 33) + 532;
+//Convert the temp back to C from F
+ return ctoTipMeasurement(((temp - 32) * 5) / 9);
}
-uint16_t getTipInstantTemperature() {
+uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipInstantTemperature() {
uint16_t sum;
sum = HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_2);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_4);
- return sum;
+ sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_1);
+ sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_2);
+ sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_3);
+ sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_4);
+
+ return sum; // 8x over sample
}
-uint16_t getTipRawTemp(uint8_t instant) {
+/*
+ * Loopup table for the tip calibration values for
+ * the gain of the tip's
+ * This can be found by line of best fit of TipRaw on X, and TipTemp-handle on Y.
+ * Then take the m term * 10000
+ * */
+uint16_t lookupTipDefaultCalValue(enum TipType tipID) {
+
+ switch (tipID) {
+ case TS_D24:
+ return 141;
+ break;
+ case TS_BC2:
+ return (133 + 129) / 2;
+ break;
+ case TS_C1:
+ return 133;
+ break;
+ case TS_B2:
+ return 133;
+ default:
+ return 132; // make this the average of all
+ break;
+ }
+}
+
+uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipRawTemp(
+ uint8_t instant) {
static int64_t filterFP = 0;
- const uint8_t filterBeta = 5; //higher values smooth out more, but reduce responsiveness
+ static uint16_t lastSample = 0;
+ const uint8_t filterBeta = 7; //higher values smooth out more, but reduce responsiveness
if (instant == 1) {
uint16_t itemp = getTipInstantTemperature();
filterFP = (filterFP << filterBeta) - filterFP;
filterFP += (itemp << 9);
filterFP = filterFP >> filterBeta;
+ uint16_t temp = itemp;
+ itemp += lastSample;
+ itemp /= 2;
+ lastSample = temp;
return itemp;
} else if (instant == 2) {
- filterFP = (getTipInstantTemperature() << 9);
+ filterFP = (getTipInstantTemperature() << 8);
return filterFP >> 9;
} else {
return filterFP >> 9;
@@ -101,24 +156,28 @@ uint16_t getInputVoltageX10(uint8_t divisor) {
preFillneeded = 1;
return sum / divisor;
}
+volatile uint32_t pendingPWM = 0;
uint8_t getTipPWM() {
- return htim2.Instance->CCR4;
+ return pendingPWM;
}
-void setTipPWM(uint8_t pulse) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) setTipPWM(uint8_t pulse) {
PWMSafetyTimer = 2; //This is decremented in the handler for PWM so that the tip pwm is disabled if the PID task is not scheduled often enough.
if (pulse > 100)
pulse = 100;
- htim2.Instance->CCR4 = pulse;
+
+ pendingPWM = pulse;
}
-//Thse are called by the HAL after the corresponding events from the system timers.
+//These are called by the HAL after the corresponding events from the system timers.
-void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PeriodElapsedCallback(
+ TIM_HandleTypeDef *htim) {
//Period has elapsed
if (htim->Instance == TIM2) {
//we want to turn on the output again
PWMSafetyTimer--; //We decrement this safety value so that lockups in the scheduler will not cause the PWM to become locked in an active driving state.
//While we could assume this could never happen, its a small price for increased safety
+ htim2.Instance->CCR4 = pendingPWM;
if (htim2.Instance->CCR4 && PWMSafetyTimer) {
htim3.Instance->CCR1 = 50;
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
@@ -127,21 +186,20 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
htim3.Instance->CCR1 = 0;
}
} else if (htim->Instance == TIM1) {
+ // STM uses this for internal functions as a counter for timeouts
HAL_IncTick();
}
}
-void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_PulseFinishedCallback(
+ TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM2) {
- //This was a pulse event
+ //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);
htim3.Instance->CCR1 = 0;
- } /*else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_13, GPIO_PIN_RESET);
- HAL_GPIO_WritePin(GPIOA, GPIO_PIN_14, GPIO_PIN_RESET);
- }*/
+ }
}
}
diff --git a/workspace/TS100/src/main.cpp b/workspace/TS100/src/main.cpp
index 85ce3e89..221ff5b4 100644
--- a/workspace/TS100/src/main.cpp
+++ b/workspace/TS100/src/main.cpp
@@ -68,6 +68,7 @@ int main(void) {
HAL_IWDG_Refresh(&hiwdg);
restoreSettings(); // load the settings from flash
setCalibrationOffset(systemSettings.CalibrationOffset);
+ setTipType((enum TipType)systemSettings.tipType, systemSettings.customTipGain); //apply tip type selection
HAL_IWDG_Refresh(&hiwdg);
/* Create the thread(s) */
@@ -97,6 +98,9 @@ void printVoltage() {
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
}
void GUIDelay() {
+ //Called in all UI looping tasks,
+ //This limits the re-draw rate to the LCD and also lets the DMA run
+ //As the gui task can very easily fill this bus with transactions, which will prevent the movement detection from running
osDelay(50);
}
void gui_drawTipTemp(bool symbol) {
@@ -187,7 +191,7 @@ ButtonState getButtonState() {
return BUTTON_NONE;
}
-static void waitForButtonPress() {
+ void waitForButtonPress() {
// we are just lazy and sleep until user confirms button press
// This also eats the button press event!
ButtonState buttons = getButtonState();
@@ -314,15 +318,11 @@ static void gui_solderingTempAdjust() {
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp > 850)
systemSettings.SolderingTemp = 850;
- } else {
- if (systemSettings.SolderingTemp > 450)
- systemSettings.SolderingTemp = 450;
- }
-
- if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp < 120)
systemSettings.SolderingTemp = 120;
} else {
+ if (systemSettings.SolderingTemp > 450)
+ systemSettings.SolderingTemp = 450;
if (systemSettings.SolderingTemp < 50)
systemSettings.SolderingTemp = 50;
}
@@ -343,9 +343,9 @@ static void gui_solderingTempAdjust() {
lcd.drawSymbol(1);
lcd.drawChar(' ');
if (lcd.getRotation())
- lcd.drawChar('+');
- else
- lcd.drawChar('-');
+ lcd.drawChar('+');
+ else
+ lcd.drawChar('-');
lcd.refresh();
GUIDelay();
}
@@ -500,7 +500,7 @@ static void gui_solderingMode() {
lcd.setCursor(0, 0);
lcd.clearScreen();
lcd.setFont(0);
- if (tipTemp > 16300) {
+ if (tipTemp > 32752) {
lcd.print(BadTipString);
lcd.refresh();
currentlyActiveTemperatureTarget = 0;
@@ -508,10 +508,11 @@ static void gui_solderingMode() {
return;
} else {
if (systemSettings.detailedSoldering) {
- lcd.setFont(1);
- lcd.print(SolderingAdvancedPowerPrompt); //Power:
- lcd.printNumber(getTipPWM(), 3);
- lcd.print("%");
+ lcd.setFont(1);/*
+ lcd.print(SolderingAdvancedPowerPrompt); //Power:
+ lcd.printNumber(getTipPWM(), 3);
+ lcd.print("%");*/
+ lcd.printNumber(getTipRawTemp(0), 6);
if (systemSettings.sensitivity && systemSettings.SleepTime) {
lcd.print(" ");
@@ -596,7 +597,7 @@ static void gui_solderingMode() {
static const char *HEADERS[] = {
__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
- "Ctip: ", "Vin :" };
+ "Ctip: ", "Vin :", "THan: " };
void showVersion(void) {
uint8_t screen = 0;
@@ -629,7 +630,7 @@ void showVersion(void) {
lcd.printNumber(lastMovementTime / 100, 5);
break;
case 7:
- lcd.printNumber(getTipRawTemp(0), 5);
+ lcd.printNumber(getTipRawTemp(0), 6);
break;
case 8:
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
@@ -637,6 +638,8 @@ void showVersion(void) {
case 9:
printVoltage();
break;
+ case 10:
+ lcd.printNumber(getHandleTemperature(), 3);
default:
break;
}
@@ -647,14 +650,14 @@ void showVersion(void) {
return;
else if (b == BUTTON_F_SHORT) {
screen++;
- screen = screen % 10;
+ screen = screen % 11;
}
GUIDelay();
}
}
/* StartGUITask function */
-void startGUITask(void const *argument) {
+void startGUITask(void const *argument __unused) {
i2cDev.FRToSInit();
uint8_t tempWarningState = 0;
bool buttonLockout = false;
@@ -814,7 +817,7 @@ void startGUITask(void const *argument) {
}
/* StartPIDTask function */
-void startPIDTask(void const *argument) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) startPIDTask(void const *argument __unused) {
/*
* We take the current tip temperature & evaluate the next step for the tip
* control PWM
@@ -843,8 +846,8 @@ void startPIDTask(void const *argument) {
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
if (currentlyActiveTemperatureTarget) {
// Compute the PID loop in here
- // Because our values here are quite large for all measurements (0-16k ~=
- // 33 counts per C)
+ // Because our values here are quite large for all measurements (0-32k ~=
+ // 66 counts per C)
// P I & D are divisors, so inverse logic applies (beware)
// Cap the max set point to 450C
@@ -854,9 +857,12 @@ void startPIDTask(void const *argument) {
int32_t rawTempError = currentlyActiveTemperatureTarget
- rawTemp;
+
int32_t ierror = (rawTempError
/ ((int32_t) systemSettings.PID_I));
+
integralCount += ierror;
+
if (integralCount > (itermMax / 2))
integralCount = itermMax / 2; // prevent too much lead
else if (integralCount < -itermMax)
@@ -878,9 +884,11 @@ void startPIDTask(void const *argument) {
output = 0;
}
- /*if (currentlyActiveTemperatureTarget < rawTemp) {
- output = 0;
- }*/
+ if (currentlyActiveTemperatureTarget < rawTemp) {
+ output = 0;
+ integralCount = 0;
+ derivativeLastValue = 0;
+ }
setTipPWM(output);
derivativeLastValue = rawTemp; // store for next loop
@@ -891,11 +899,17 @@ void startPIDTask(void const *argument) {
}
HAL_IWDG_Refresh(&hiwdg);
+ } else {
+ if (currentlyActiveTemperatureTarget == 0) {
+ setTipPWM(0); // disable the output driver if the output is set to be off
+ integralCount = 0;
+ derivativeLastValue = 0;
+ }
}
}
}
#define MOVFilter 8
-void startMOVTask(void const *argument) {
+void startMOVTask(void const *argument __unused) {
osDelay(250); // wait for accelerometer to stabilize
lcd.setRotation(systemSettings.OrientationMode & 1);
lastMovementTime = 0;
@@ -1011,41 +1025,48 @@ bool showBootLogoIfavailable() {
return true;
}
-void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc) {
+/*
+ * Catch the IRQ that says that the conversion is done on the temperature readings coming in
+ * Once these have come in we can unblock the PID so that it runs again
+ */
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_ADCEx_InjectedConvCpltCallback(
+ ADC_HandleTypeDef* hadc) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
-
- if (pidTaskNotification) {
- /* Notify the task that the transmission is complete. */
- vTaskNotifyGiveFromISR(pidTaskNotification, &xHigherPriorityTaskWoken);
-
- /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
- should be performed to ensure the interrupt returns directly to the highest
- priority task. The macro used for this purpose is dependent on the port in
- use and may be called portEND_SWITCHING_ISR(). */
- portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
+ if (hadc == &hadc1) {
+ if (pidTaskNotification) {
+ vTaskNotifyGiveFromISR(pidTaskNotification,
+ &xHigherPriorityTaskWoken);
+ portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
+ }
}
}
-void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterRxCpltCallback(
+ I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
-void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterTxCpltCallback(
+ I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
-void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MemTxCpltCallback(
+ I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
-void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_ErrorCallback(
+ I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
-void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_AbortCpltCallback(
+ I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
-void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c) {
+void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MemRxCpltCallback(
+ I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
-void vApplicationStackOverflowHook( xTaskHandle *pxTask,
- signed portCHAR *pcTaskName) {
+void vApplicationStackOverflowHook( xTaskHandle *pxTask __unused,
+ signed portCHAR *pcTaskName __unused) {
//We dont have a good way to handle a stack overflow at this point in time
NVIC_SystemReset();
diff --git a/workspace/TS100/src/stm32f1xx_hal_msp.c b/workspace/TS100/src/stm32f1xx_hal_msp.c
index 3c14bc06..0057ed84 100644
--- a/workspace/TS100/src/stm32f1xx_hal_msp.c
+++ b/workspace/TS100/src/stm32f1xx_hal_msp.c
@@ -30,7 +30,8 @@ void HAL_MspInit(void) {
*/
//__HAL_AFIO_REMAP_SWJ_NOJTAG()
//;
- __HAL_AFIO_REMAP_SWJ_DISABLE(); /*Disable swd for debug io use*/
+ __HAL_AFIO_REMAP_SWJ_DISABLE()
+ ; /*Disable swd for debug io use*/
}
@@ -70,6 +71,21 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) {
/* ADC1 interrupt Init */
HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
+ } else {
+ __HAL_RCC_ADC2_CLK_ENABLE()
+ ;
+
+ /**ADC2 GPIO Configuration
+ PB0 ------> ADC2_IN8
+ PB1 ------> ADC2_IN9
+ */
+ GPIO_InitStruct.Pin = TIP_TEMP_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+ /* ADC2 interrupt Init */
+ HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
+ HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
}
}
diff --git a/workspace/TS100A/.cproject b/workspace/TS100A/.cproject
index b2071019..e652f4fe 100644
--- a/workspace/TS100A/.cproject
+++ b/workspace/TS100A/.cproject
@@ -35,15 +35,15 @@
diff --git a/workspace/TS100A/.settings/language.settings.xml b/workspace/TS100A/.settings/language.settings.xml
index e8cd38e4..b3648380 100644
--- a/workspace/TS100A/.settings/language.settings.xml
+++ b/workspace/TS100A/.settings/language.settings.xml
@@ -4,7 +4,7 @@
-
+