Adding adc2 & new temperature calibration proceedures. [WiP] (#361)
* Add rough calls to ADC2 [untested] * Using dual ADC injected modes * Start both ADCs * Move some IRQ's to ram exec * Stabilize PID a bit more * Add in ideas for tip type selection * Add tiptype formula / settings struct * Add function ids to the settings menu * Rough tip selection * Rough out new cal routine for simple tips * Hardware test is fairly close for first pass * Add Simple calibration case [UNTESTED] This adds the calibration option that uses boiling water to the calibration menu. This is untested, and may need gain adjustments before use. * Simple Cal Roughly working * Rough out advanced cal
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -48,3 +48,4 @@ workspace/TS100A/Release/TS100A.map
|
|||||||
workspace/TS100A/Release/TS100A.list
|
workspace/TS100A/Release/TS100A.list
|
||||||
workspace/TS100A/Release/TS100A.hex
|
workspace/TS100A/Release/TS100A.hex
|
||||||
workspace/TS100A/.settings/language.settings.xml
|
workspace/TS100A/.settings/language.settings.xml
|
||||||
|
workspace/TS100A/.metadata/
|
||||||
|
|||||||
@@ -11,13 +11,15 @@ ADC1.DiscontinuousConvMode=DISABLE
|
|||||||
ADC1.EnableAnalogWatchDog=false
|
ADC1.EnableAnalogWatchDog=false
|
||||||
ADC1.EnableRegularConversion=ENABLE
|
ADC1.EnableRegularConversion=ENABLE
|
||||||
ADC1.ExternalTrigConv=ADC_SOFTWARE_START
|
ADC1.ExternalTrigConv=ADC_SOFTWARE_START
|
||||||
ADC1.ExternalTrigInjecConv=ADC_EXTERNALTRIGINJECCONV_T3_CC4
|
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
|
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.InjNumberOfConversion=4
|
||||||
|
ADC1.InjectedConvMode=None
|
||||||
ADC1.InjectedOffset-2\#ChannelInjectedConversion=0
|
ADC1.InjectedOffset-2\#ChannelInjectedConversion=0
|
||||||
ADC1.InjectedOffset-3\#ChannelInjectedConversion=0
|
ADC1.InjectedOffset-3\#ChannelInjectedConversion=0
|
||||||
ADC1.InjectedOffset-4\#ChannelInjectedConversion=0
|
ADC1.InjectedOffset-4\#ChannelInjectedConversion=0
|
||||||
ADC1.InjectedOffset-5\#ChannelInjectedConversion=0
|
ADC1.InjectedOffset-5\#ChannelInjectedConversion=0
|
||||||
|
ADC1.Mode=ADC_DUALMODE_REGSIMULT_INJECSIMULT
|
||||||
ADC1.NbrOfConversion=2
|
ADC1.NbrOfConversion=2
|
||||||
ADC1.NbrOfConversionFlag=1
|
ADC1.NbrOfConversionFlag=1
|
||||||
ADC1.Rank-0\#ChannelRegularConversion=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.SamplingTime-5\#ChannelInjectedConversion=ADC_SAMPLETIME_71CYCLES_5
|
||||||
ADC1.ScanConvMode=ADC_SCAN_ENABLE
|
ADC1.ScanConvMode=ADC_SCAN_ENABLE
|
||||||
ADC1.master=1
|
ADC1.master=1
|
||||||
Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY
|
ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_8
|
||||||
Dma.ADC1.0.Instance=DMA1_Channel1
|
ADC2.Channel-1\#ChannelInjectedConversion=ADC_CHANNEL_8
|
||||||
Dma.ADC1.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
ADC2.Channel-2\#ChannelInjectedConversion=ADC_CHANNEL_8
|
||||||
Dma.ADC1.0.MemInc=DMA_MINC_ENABLE
|
ADC2.Channel-3\#ChannelInjectedConversion=ADC_CHANNEL_8
|
||||||
Dma.ADC1.0.Mode=DMA_CIRCULAR
|
ADC2.Channel-4\#ChannelInjectedConversion=ADC_CHANNEL_8
|
||||||
Dma.ADC1.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
ADC2.ContinuousConvMode=DISABLE
|
||||||
Dma.ADC1.0.PeriphInc=DMA_PINC_DISABLE
|
ADC2.DataAlign=ADC_DATAALIGN_RIGHT
|
||||||
Dma.ADC1.0.Priority=DMA_PRIORITY_VERY_HIGH
|
ADC2.DiscontinuousConvMode=DISABLE
|
||||||
Dma.ADC1.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
ADC2.EnableAnalogWatchDog=false
|
||||||
Dma.I2C1_RX.1.Direction=DMA_PERIPH_TO_MEMORY
|
ADC2.EnableRegularConversion=ENABLE
|
||||||
Dma.I2C1_RX.1.Instance=DMA1_Channel7
|
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
|
||||||
Dma.I2C1_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
ADC2.InjNumberOfConversion=4
|
||||||
Dma.I2C1_RX.1.MemInc=DMA_MINC_ENABLE
|
ADC2.InjectedConvMode=None
|
||||||
Dma.I2C1_RX.1.Mode=DMA_NORMAL
|
ADC2.InjectedOffset-1\#ChannelInjectedConversion=0
|
||||||
Dma.I2C1_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
ADC2.InjectedOffset-2\#ChannelInjectedConversion=0
|
||||||
Dma.I2C1_RX.1.PeriphInc=DMA_PINC_DISABLE
|
ADC2.InjectedOffset-3\#ChannelInjectedConversion=0
|
||||||
Dma.I2C1_RX.1.Priority=DMA_PRIORITY_MEDIUM
|
ADC2.InjectedOffset-4\#ChannelInjectedConversion=0
|
||||||
Dma.I2C1_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
ADC2.Mode=ADC_DUALMODE_REGSIMULT_INJECSIMULT
|
||||||
Dma.I2C1_TX.2.Direction=DMA_MEMORY_TO_PERIPH
|
ADC2.NbrOfConversion=1
|
||||||
Dma.I2C1_TX.2.Instance=DMA1_Channel6
|
ADC2.NbrOfConversionFlag=1
|
||||||
Dma.I2C1_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
ADC2.Rank-0\#ChannelRegularConversion=1
|
||||||
Dma.I2C1_TX.2.MemInc=DMA_MINC_ENABLE
|
ADC2.Rank-1\#ChannelInjectedConversion=1
|
||||||
Dma.I2C1_TX.2.Mode=DMA_NORMAL
|
ADC2.Rank-2\#ChannelInjectedConversion=2
|
||||||
Dma.I2C1_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
ADC2.Rank-3\#ChannelInjectedConversion=3
|
||||||
Dma.I2C1_TX.2.PeriphInc=DMA_PINC_DISABLE
|
ADC2.Rank-4\#ChannelInjectedConversion=4
|
||||||
Dma.I2C1_TX.2.Priority=DMA_PRIORITY_MEDIUM
|
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
|
||||||
Dma.I2C1_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
ADC2.SamplingTime-1\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
|
||||||
Dma.Request0=ADC1
|
ADC2.SamplingTime-2\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
|
||||||
Dma.Request1=I2C1_RX
|
ADC2.SamplingTime-3\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
|
||||||
Dma.Request2=I2C1_TX
|
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
|
Dma.RequestsNb=3
|
||||||
FREERTOS.FootprintOK=true
|
FREERTOS.FootprintOK=true
|
||||||
FREERTOS.INCLUDE_vTaskDelete=0
|
FREERTOS.INCLUDE_vTaskDelete=0
|
||||||
@@ -82,16 +115,17 @@ IWDG.Prescaler=IWDG_PRESCALER_256
|
|||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
Mcu.Family=STM32F1
|
Mcu.Family=STM32F1
|
||||||
Mcu.IP0=ADC1
|
Mcu.IP0=ADC1
|
||||||
Mcu.IP1=DMA
|
Mcu.IP1=ADC2
|
||||||
Mcu.IP2=FREERTOS
|
Mcu.IP10=TIM3
|
||||||
Mcu.IP3=I2C1
|
Mcu.IP2=DMA
|
||||||
Mcu.IP4=IWDG
|
Mcu.IP3=FREERTOS
|
||||||
Mcu.IP5=NVIC
|
Mcu.IP4=I2C1
|
||||||
Mcu.IP6=RCC
|
Mcu.IP5=IWDG
|
||||||
Mcu.IP7=SYS
|
Mcu.IP6=NVIC
|
||||||
Mcu.IP8=TIM2
|
Mcu.IP7=RCC
|
||||||
Mcu.IP9=TIM3
|
Mcu.IP8=SYS
|
||||||
Mcu.IPNb=10
|
Mcu.IP9=TIM2
|
||||||
|
Mcu.IPNb=11
|
||||||
Mcu.Name=STM32F103T(8-B)Ux
|
Mcu.Name=STM32F103T(8-B)Ux
|
||||||
Mcu.Package=VFQFPN36
|
Mcu.Package=VFQFPN36
|
||||||
Mcu.Pin0=PA6
|
Mcu.Pin0=PA6
|
||||||
@@ -119,8 +153,8 @@ Mcu.PinsNb=21
|
|||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F103T8Ux
|
Mcu.UserName=STM32F103T8Ux
|
||||||
MxCube.Version=4.25.0
|
MxCube.Version=4.26.0
|
||||||
MxDb.Version=DB.4.0.250
|
MxDb.Version=DB.4.0.260
|
||||||
NVIC.ADC1_2_IRQn=true\:5\:0\:false\:false\:true\:true\:true
|
NVIC.ADC1_2_IRQn=true\:5\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Channel1_IRQn=true\:5\:0\:false\:false\:true\:true\:true
|
NVIC.DMA1_Channel1_IRQn=true\:5\:0\:false\:false\:true\:true\:true
|
||||||
@@ -204,7 +238,7 @@ ProjectManager.BackupPrevious=false
|
|||||||
ProjectManager.CompilerOptimize=3
|
ProjectManager.CompilerOptimize=3
|
||||||
ProjectManager.ComputerToolchain=false
|
ProjectManager.ComputerToolchain=false
|
||||||
ProjectManager.CoupleFile=false
|
ProjectManager.CoupleFile=false
|
||||||
ProjectManager.CustomerFirmwarePackage=C\:/Users/Ralim/STM32Cube/Repository/STM32Cube_FW_F1_V1.6.1
|
ProjectManager.CustomerFirmwarePackage=
|
||||||
ProjectManager.DefaultFWLocation=true
|
ProjectManager.DefaultFWLocation=true
|
||||||
ProjectManager.DeletePrevious=true
|
ProjectManager.DeletePrevious=true
|
||||||
ProjectManager.DeviceId=STM32F103T8Ux
|
ProjectManager.DeviceId=STM32F103T8Ux
|
||||||
@@ -216,15 +250,15 @@ ProjectManager.KeepUserCode=true
|
|||||||
ProjectManager.LastFirmware=true
|
ProjectManager.LastFirmware=true
|
||||||
ProjectManager.LibraryCopy=1
|
ProjectManager.LibraryCopy=1
|
||||||
ProjectManager.MainLocation=Src
|
ProjectManager.MainLocation=Src
|
||||||
ProjectManager.PreviousToolchain=SW4STM32
|
ProjectManager.PreviousToolchain=TrueSTUDIO
|
||||||
ProjectManager.ProjectBuild=false
|
ProjectManager.ProjectBuild=false
|
||||||
ProjectManager.ProjectFileName=TS100.ioc
|
ProjectManager.ProjectFileName=TS100.ioc
|
||||||
ProjectManager.ProjectName=TS100
|
ProjectManager.ProjectName=TS100
|
||||||
ProjectManager.StackSize=0x400
|
ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=SW4STM32
|
ProjectManager.TargetToolchain=TrueSTUDIO
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=false
|
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
|
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.ADCFreqValue=8000000
|
||||||
RCC.ADCPresc=RCC_ADCPCLK2_DIV8
|
RCC.ADCPresc=RCC_ADCPCLK2_DIV8
|
||||||
RCC.AHBFreq_Value=64000000
|
RCC.AHBFreq_Value=64000000
|
||||||
@@ -249,8 +283,8 @@ RCC.USBFreq_Value=42666666.666666664
|
|||||||
RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5
|
RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5
|
||||||
SH.ADCx_IN7.0=ADC1_IN7,IN7
|
SH.ADCx_IN7.0=ADC1_IN7,IN7
|
||||||
SH.ADCx_IN7.ConfNb=1
|
SH.ADCx_IN7.ConfNb=1
|
||||||
SH.ADCx_IN8.0=ADC2_IN8
|
SH.ADCx_IN8.0=ADC1_IN8,IN8
|
||||||
SH.ADCx_IN8.1=ADC1_IN8,IN8
|
SH.ADCx_IN8.1=ADC2_IN8,IN8
|
||||||
SH.ADCx_IN8.ConfNb=2
|
SH.ADCx_IN8.ConfNb=2
|
||||||
SH.ADCx_IN9.0=ADC2_IN9
|
SH.ADCx_IN9.0=ADC2_IN9
|
||||||
SH.ADCx_IN9.1=ADC1_IN9,IN9
|
SH.ADCx_IN9.1=ADC1_IN9,IN9
|
||||||
|
|||||||
@@ -1085,7 +1085,7 @@ __weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
|
|||||||
* @arg TIM_CHANNEL_4: TIM Channel 4 selected
|
* @arg TIM_CHANNEL_4: TIM Channel 4 selected
|
||||||
* @retval HAL status
|
* @retval HAL status
|
||||||
*/
|
*/
|
||||||
HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
|
HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
|
||||||
{
|
{
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
|
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, 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
|
* @arg TIM_CHANNEL_4: TIM Channel 4 selected
|
||||||
* @retval HAL status
|
* @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 */
|
/* Check the parameters */
|
||||||
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
|
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#define SETTINGS_H_
|
#define SETTINGS_H_
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "stm32f1xx_hal.h"
|
#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
|
* 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_I; //PID I Term
|
||||||
uint8_t PID_D; //PID D Term
|
uint8_t PID_D; //PID D Term
|
||||||
uint8_t version; //Used to track if a reset is needed on firmware upgrade
|
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
|
uint32_t padding; //This is here for in case we are not an even divisor so that nothing gets cut off
|
||||||
} systemSettingsType;
|
} systemSettingsType;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ extern "C" {
|
|||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
|
|
||||||
extern ADC_HandleTypeDef hadc1;
|
extern ADC_HandleTypeDef hadc1;
|
||||||
|
extern ADC_HandleTypeDef hadc2;
|
||||||
extern DMA_HandleTypeDef hdma_adc1;
|
extern DMA_HandleTypeDef hdma_adc1;
|
||||||
|
|
||||||
extern DMA_HandleTypeDef hdma_i2c1_rx;
|
extern DMA_HandleTypeDef hdma_i2c1_rx;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ enum ShortNameType {
|
|||||||
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
|
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
|
||||||
*/
|
*/
|
||||||
extern const enum ShortNameType SettingsShortNameType;
|
extern const enum ShortNameType SettingsShortNameType;
|
||||||
extern const char* SettingsShortNames[17][2];
|
extern const char* SettingsShortNames[20][2];
|
||||||
extern const char* SettingsDescriptions[17];
|
extern const char* SettingsDescriptions[20];
|
||||||
extern const char* SettingsMenuEntries[4];
|
extern const char* SettingsMenuEntries[4];
|
||||||
extern const char* SettingsMenuEntriesDescriptions[4];
|
extern const char* SettingsMenuEntriesDescriptions[4];
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,21 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum Orientation {
|
enum Orientation {
|
||||||
ORIENTATION_LEFT_HAND = 0,
|
ORIENTATION_LEFT_HAND = 0, ORIENTATION_RIGHT_HAND = 1, ORIENTATION_FLAT = 3
|
||||||
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_Pin GPIO_PIN_6
|
||||||
#define KEY_B_GPIO_Port GPIOA
|
#define KEY_B_GPIO_Port GPIOA
|
||||||
#define TMP36_INPUT_Pin GPIO_PIN_7
|
#define TMP36_INPUT_Pin GPIO_PIN_7
|
||||||
@@ -54,6 +64,7 @@ uint16_t ftoTipMeasurement(uint16_t temp);
|
|||||||
uint16_t tipMeasurementToF(uint16_t raw);
|
uint16_t tipMeasurementToF(uint16_t raw);
|
||||||
|
|
||||||
void setCalibrationOffset(int16_t offSet);
|
void setCalibrationOffset(int16_t offSet);
|
||||||
|
void setTipType(enum TipType tipType, uint8_t manualCalGain);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <MMA8652FC.hpp>
|
#include <MMA8652FC.hpp>
|
||||||
#include "Setup.h"
|
#include "Setup.h"
|
||||||
#include "OLED.hpp"
|
#include "OLED.hpp"
|
||||||
|
extern uint16_t currentlyActiveTemperatureTarget;
|
||||||
extern OLED lcd;
|
extern OLED lcd;
|
||||||
extern MMA8652FC accel;
|
extern MMA8652FC accel;
|
||||||
extern uint8_t PCBVersion;
|
extern uint8_t PCBVersion;
|
||||||
@@ -25,6 +25,8 @@ enum ButtonState {
|
|||||||
|
|
||||||
ButtonState getButtonState();
|
ButtonState getButtonState();
|
||||||
void waitForButtonPressOrTimeout(uint32_t timeout);
|
void waitForButtonPressOrTimeout(uint32_t timeout);
|
||||||
|
void waitForButtonPress();
|
||||||
|
void GUIDelay();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@@ -36,7 +38,8 @@ void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c);
|
|||||||
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
|
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
|
||||||
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
|
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
|
||||||
void HAL_I2C_MemRxCpltCallback(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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "FRToSI2C.hpp"
|
#include "FRToSI2C.hpp"
|
||||||
|
|
||||||
void FRToSI2C::CpltCallback() {
|
void __attribute__ ((long_call, section (".data.ramfuncs"))) FRToSI2C::CpltCallback() {
|
||||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
i2c->State = HAL_I2C_STATE_READY;//Force state reset
|
i2c->State = HAL_I2C_STATE_READY;//Force state reset
|
||||||
if (I2CSemaphore) {
|
if (I2CSemaphore) {
|
||||||
|
|||||||
@@ -42,17 +42,8 @@ uint8_t OLED_Setup_Array[] = { /**/
|
|||||||
};
|
};
|
||||||
//Setup based on the SSD1307 and modified for the SSD1306
|
//Setup based on the SSD1307 and modified for the SSD1306
|
||||||
|
|
||||||
const uint8_t REFRESH_COMMANDS[17] = {
|
const uint8_t REFRESH_COMMANDS[17] = { 0x80, 0xAF, 0x80, 0x21, 0x80, 0x20, 0x80,
|
||||||
0x80, 0xAF,
|
0x7F, 0x80, 0xC0, 0x80, 0x22, 0x80, 0x00, 0x80, 0x01, 0x40 };
|
||||||
0x80, 0x21,
|
|
||||||
0x80, 0x20,
|
|
||||||
0x80, 0x7F,
|
|
||||||
0x80, 0xC0,
|
|
||||||
0x80, 0x22,
|
|
||||||
0x80, 0x00,
|
|
||||||
0x80, 0x01,
|
|
||||||
0x40
|
|
||||||
};
|
|
||||||
|
|
||||||
OLED::OLED(FRToSI2C* i2cHandle) {
|
OLED::OLED(FRToSI2C* i2cHandle) {
|
||||||
i2c = i2cHandle;
|
i2c = i2cHandle;
|
||||||
@@ -70,11 +61,12 @@ OLED::OLED(FRToSI2C* i2cHandle) {
|
|||||||
void OLED::initialize() {
|
void OLED::initialize() {
|
||||||
memcpy(&screenBuffer[0], &REFRESH_COMMANDS[0], sizeof(REFRESH_COMMANDS));
|
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_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
|
||||||
HAL_Delay(10);
|
HAL_Delay(50);
|
||||||
//Send the setup settings
|
//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);
|
displayOnOff(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,19 +137,20 @@ void OLED::setRotation(bool leftHanded) {
|
|||||||
|
|
||||||
//send command struct again with changes
|
//send command struct again with changes
|
||||||
if (leftHanded) {
|
if (leftHanded) {
|
||||||
OLED_Setup_Array[11] = 0xC8; //c1?
|
OLED_Setup_Array[11] = 0xC8; //c1?
|
||||||
OLED_Setup_Array[19] = 0xA1;
|
OLED_Setup_Array[19] = 0xA1;
|
||||||
} else {
|
} else {
|
||||||
OLED_Setup_Array[11] = 0xC0;
|
OLED_Setup_Array[11] = 0xC0;
|
||||||
OLED_Setup_Array[19] = 0xA0;
|
OLED_Setup_Array[19] = 0xA0;
|
||||||
}
|
}
|
||||||
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
|
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
|
||||||
inLeftHandedMode = leftHanded;
|
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[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[7] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
|
||||||
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
|
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//print a string to the current cursor location
|
//print a string to the current cursor location
|
||||||
void OLED::print(const char* str) {
|
void OLED::print(const char* str) {
|
||||||
@@ -190,9 +183,13 @@ void OLED::setFont(uint8_t fontNumber) {
|
|||||||
|
|
||||||
//maximum places is 5
|
//maximum places is 5
|
||||||
void OLED::printNumber(uint16_t number, uint8_t places) {
|
void OLED::printNumber(uint16_t number, uint8_t places) {
|
||||||
char buffer[6] = { 0 };
|
char buffer[7] = { 0 };
|
||||||
|
|
||||||
if (places == 5) {
|
if (places >= 5) {
|
||||||
|
buffer[5] = '0' + number % 10;
|
||||||
|
number /= 10;
|
||||||
|
}
|
||||||
|
if (places > 4) {
|
||||||
buffer[4] = '0' + number % 10;
|
buffer[4] = '0' + number % 10;
|
||||||
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,
|
void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
|
||||||
bool clear) {
|
bool clear) {
|
||||||
//Draw this in 3 sections
|
//Draw this in 3 sections
|
||||||
//This is basically a N wide version of vertical line
|
//This is basically a N wide version of vertical line
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ void saveSettings() {
|
|||||||
pEraseInit.PageAddress = FLASH_ADDR;
|
pEraseInit.PageAddress = FLASH_ADDR;
|
||||||
uint32_t failingAddress = 0;
|
uint32_t failingAddress = 0;
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
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_FLASH_Unlock();
|
||||||
HAL_Delay(10);
|
HAL_Delay(10);
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
@@ -35,7 +36,8 @@ void saveSettings() {
|
|||||||
|
|
||||||
for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
|
for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
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();
|
HAL_FLASH_Lock();
|
||||||
|
|
||||||
@@ -71,29 +73,30 @@ uint8_t lookupVoltageLevel(uint8_t level) {
|
|||||||
return (level * 33) + (33 * 2);
|
return (level * 33) + (33 * 2);
|
||||||
}
|
}
|
||||||
void resetSettings() {
|
void resetSettings() {
|
||||||
memset((void*)&systemSettings,0,sizeof(systemSettingsType));
|
memset((void*) &systemSettings, 0, sizeof(systemSettingsType));
|
||||||
systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
|
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.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.SolderingTemp = 320; //Default soldering temp is 320.0 C
|
||||||
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
|
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.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.OrientationMode = 2; //Default to automatic
|
||||||
systemSettings.sensitivity = 7; //Default high sensitivity
|
systemSettings.sensitivity = 7; //Default high sensitivity
|
||||||
systemSettings.voltageDiv = 117; //Default divider from schematic
|
systemSettings.voltageDiv = 117; //Default divider from schematic
|
||||||
systemSettings.ShutdownTime = 10; //How many minutes until the unit turns itself off
|
systemSettings.ShutdownTime = 10;//How many minutes until the unit turns itself off
|
||||||
systemSettings.boostModeEnabled = 1; //Default to safe, with no boost mode
|
systemSettings.boostModeEnabled = 1;//Default to safe, with no boost mode
|
||||||
systemSettings.BoostTemp = 420; //default to 400C
|
systemSettings.BoostTemp = 420; //default to 400C
|
||||||
systemSettings.autoStartMode = 0; //Auto start off for safety
|
systemSettings.autoStartMode = 0; //Auto start off for safety
|
||||||
systemSettings.coolingTempBlink = 0; //Blink the temperature on the cooling screen when its > 50C
|
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.temperatureInF = 0; //default to 0
|
systemSettings.temperatureInF = 0; //default to 0
|
||||||
systemSettings.descriptionScrollSpeed=0;//default to slow
|
systemSettings.descriptionScrollSpeed = 0; //default to slow
|
||||||
systemSettings.PID_P =42;
|
systemSettings.PID_P = 42;
|
||||||
systemSettings.PID_I =50;
|
systemSettings.PID_I = 50;
|
||||||
systemSettings.PID_D =15;
|
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();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "Setup.h"
|
#include "Setup.h"
|
||||||
ADC_HandleTypeDef hadc1;
|
ADC_HandleTypeDef hadc1;
|
||||||
|
ADC_HandleTypeDef hadc2;
|
||||||
DMA_HandleTypeDef hdma_adc1;
|
DMA_HandleTypeDef hdma_adc1;
|
||||||
|
|
||||||
I2C_HandleTypeDef hi2c1;
|
I2C_HandleTypeDef hi2c1;
|
||||||
@@ -27,6 +28,7 @@ static void MX_TIM3_Init(void);
|
|||||||
static void MX_TIM2_Init(void);
|
static void MX_TIM2_Init(void);
|
||||||
static void MX_DMA_Init(void);
|
static void MX_DMA_Init(void);
|
||||||
static void MX_GPIO_Init(void);
|
static void MX_GPIO_Init(void);
|
||||||
|
static void MX_ADC2_Init(void);
|
||||||
|
|
||||||
void Setup_HAL() {
|
void Setup_HAL() {
|
||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
@@ -34,12 +36,16 @@ void Setup_HAL() {
|
|||||||
MX_DMA_Init();
|
MX_DMA_Init();
|
||||||
MX_I2C1_Init();
|
MX_I2C1_Init();
|
||||||
MX_ADC1_Init();
|
MX_ADC1_Init();
|
||||||
|
MX_ADC2_Init();
|
||||||
MX_TIM3_Init();
|
MX_TIM3_Init();
|
||||||
MX_TIM2_Init();
|
MX_TIM2_Init();
|
||||||
MX_IWDG_Init();
|
MX_IWDG_Init();
|
||||||
|
HAL_ADC_Start(&hadc2);
|
||||||
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
|
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
|
||||||
HAL_ADCEx_InjectedStart(&hadc1); //enable injected readings
|
HAL_ADCEx_InjectedStart(&hadc1); //enable injected readings
|
||||||
|
HAL_ADCEx_InjectedStart(&hadc2); //enable injected readings
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//channel 0 -> temperature sensor, 1-> VIN
|
//channel 0 -> temperature sensor, 1-> VIN
|
||||||
@@ -99,6 +105,7 @@ void SystemClock_Config(void) {
|
|||||||
|
|
||||||
/* ADC1 init function */
|
/* ADC1 init function */
|
||||||
static void MX_ADC1_Init(void) {
|
static void MX_ADC1_Init(void) {
|
||||||
|
ADC_MultiModeTypeDef multimode;
|
||||||
|
|
||||||
ADC_ChannelConfTypeDef sConfig;
|
ADC_ChannelConfTypeDef sConfig;
|
||||||
ADC_InjectionConfTypeDef sConfigInjected;
|
ADC_InjectionConfTypeDef sConfigInjected;
|
||||||
@@ -113,6 +120,11 @@ static void MX_ADC1_Init(void) {
|
|||||||
hadc1.Init.NbrOfConversion = 2;
|
hadc1.Init.NbrOfConversion = 2;
|
||||||
HAL_ADC_Init(&hadc1);
|
HAL_ADC_Init(&hadc1);
|
||||||
|
|
||||||
|
/**Configure the ADC multi-mode
|
||||||
|
*/
|
||||||
|
multimode.Mode = ADC_DUALMODE_REGSIMULT_INJECSIMULT;
|
||||||
|
HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode);
|
||||||
|
|
||||||
/**Configure Regular Channel
|
/**Configure Regular Channel
|
||||||
*/
|
*/
|
||||||
sConfig.Channel = ADC_CHANNEL_7;
|
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 */
|
/* I2C1 init function */
|
||||||
static void MX_I2C1_Init(void) {
|
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.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(OLED_RESET_GPIO_Port, &GPIO_InitStruct);
|
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 */
|
/* Configure GPIO pins : INT_Orientation_Pin INT_Movement_Pin */
|
||||||
/* Not used anymore*/
|
/* Not used anymore*/
|
||||||
|
|||||||
@@ -8,54 +8,11 @@
|
|||||||
#ifndef LANG
|
#ifndef LANG
|
||||||
#define LANG_EN
|
#define LANG_EN
|
||||||
#endif
|
#endif
|
||||||
// TEMPLATES for short names - choose one and use it as base for your
|
// TEMPLATE: Please use the English translations
|
||||||
// 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"},
|
|
||||||
//};
|
|
||||||
|
|
||||||
#ifdef LANG_EN
|
#ifdef LANG_EN
|
||||||
|
|
||||||
const char* SettingsDescriptions[17] = {
|
const char* SettingsDescriptions[20] = {
|
||||||
// These are all the help text for all the settings.
|
// These are all the help text for all the settings.
|
||||||
// No requirements on spacing or length.
|
// No requirements on spacing or length.
|
||||||
/* Power source (DC or batt) */"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>",
|
/* Power source (DC or batt) */"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>",
|
||||||
@@ -75,8 +32,12 @@ const char* SettingsDescriptions[17] = {
|
|||||||
/* Calibrate input voltage */"VIN Calibration. Buttons adjust, long press to exit",
|
/* Calibrate input voltage */"VIN Calibration. Buttons adjust, long press to exit",
|
||||||
/* Advanced soldering screen enabled */"Display detailed information while soldering",
|
/* Advanced soldering screen enabled */"Display detailed information while soldering",
|
||||||
/* Description Scroll Speed */"Speed this text scrolls past at",
|
/* 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 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",
|
"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 char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Power", "source"},
|
||||||
/* (<= 9) Sleep temperature */{"Sleep", "temp"},
|
/* (<= 9) Sleep temperature */{"Sleep", "temp"},
|
||||||
/* (<= 9) Sleep timeout */{"Sleep", "timeout"},
|
/* (<= 9) Sleep timeout */{"Sleep", "timeout"},
|
||||||
@@ -130,6 +91,9 @@ const char* SettingsShortNames[17][2] = {
|
|||||||
/* (<= 16) Calibrate input voltage */{"Calibrate", "input voltage?"},
|
/* (<= 16) Calibrate input voltage */{"Calibrate", "input voltage?"},
|
||||||
/* (<= 13) Advanced soldering screen enabled */{"Detailed", "solder screen"},
|
/* (<= 13) Advanced soldering screen enabled */{"Detailed", "solder screen"},
|
||||||
/* (<= 11) Display Help Text Scroll Speed */{"Description","Scroll Speed"},
|
/* (<= 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
|
#ifdef PIDSETTINGS
|
||||||
|
|
||||||
{ "PID","P"},
|
{ "PID","P"},
|
||||||
@@ -139,6 +103,7 @@ const char* SettingsShortNames[17][2] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// SettingsMenuEntries lengths <= 13 per line (\n starts second line)
|
// SettingsMenuEntries lengths <= 13 per line (\n starts second line)
|
||||||
const char* SettingsMenuEntries[4] = {
|
const char* SettingsMenuEntries[4] = {
|
||||||
/* Soldering Menu */"Soldering\nSettings",
|
/* Soldering Menu */"Soldering\nSettings",
|
||||||
@@ -203,7 +168,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
||||||
const char* SettingsShortNames[17][2] = {
|
const char* SettingsShortNames[20][2] = {
|
||||||
/* (<= 11) Power source (DC or batt) */{"Източник", "захранване"},
|
/* (<= 11) Power source (DC or batt) */{"Източник", "захранване"},
|
||||||
/* (<= 9) Sleep temperature */{"Темп.", "сън"},
|
/* (<= 9) Sleep temperature */{"Темп.", "сън"},
|
||||||
/* (<= 9) Sleep timeout */{"Време", "сън"},
|
/* (<= 9) Sleep timeout */{"Време", "сън"},
|
||||||
@@ -292,7 +257,7 @@ const char SettingFastChar = '+';
|
|||||||
const char SettingSlowChar = '-';
|
const char SettingSlowChar = '-';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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
|
/* (<= 11) Power source (DC or batt) */{"Источник","питания"}, //8,7
|
||||||
/* (<= 9) Sleep temperature */{"Темпер.","сна"}, //7,3
|
/* (<= 9) Sleep temperature */{"Темпер.","сна"}, //7,3
|
||||||
/* (<= 9) Sleep timeout */{"Таймаут","сна"}, //7,3
|
/* (<= 9) Sleep timeout */{"Таймаут","сна"}, //7,3
|
||||||
@@ -457,7 +422,7 @@ const char SettingFastChar = 'N';//'F';
|
|||||||
const char SettingSlowChar = 'H';//'S';
|
const char SettingSlowChar = 'H';//'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Virtalähde", "DC"},
|
||||||
/* (<= 9) Sleep temperature */{"Lepotilan", "lämpötila"},
|
/* (<= 9) Sleep temperature */{"Lepotilan", "lämpötila"},
|
||||||
/* (<= 9) Sleep timeout */{"Lepotilan", "viive"},
|
/* (<= 9) Sleep timeout */{"Lepotilan", "viive"},
|
||||||
@@ -544,7 +509,7 @@ const char SettingFastChar = 'V';
|
|||||||
const char SettingSlowChar = 'L';
|
const char SettingSlowChar = 'L';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Sorgente", "alimentaz"},
|
||||||
/* (<= 9) Sleep temperature */{"Temp", "standby"},
|
/* (<= 9) Sleep temperature */{"Temp", "standby"},
|
||||||
/* (<= 9) Sleep timeout */{"Timer", "standby"},
|
/* (<= 9) Sleep timeout */{"Timer", "standby"},
|
||||||
@@ -628,7 +593,7 @@ const char SettingFastChar = 'R';
|
|||||||
const char SettingSlowChar = 'L';
|
const char SettingSlowChar = 'L';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Source", "d'alim"},
|
||||||
/* (<= 9) Sleep temperature */{"Temp.", "veille"},
|
/* (<= 9) Sleep temperature */{"Temp.", "veille"},
|
||||||
/* (<= 9) Sleep timeout */{"Délai", "veille"},
|
/* (<= 9) Sleep timeout */{"Délai", "veille"},
|
||||||
@@ -718,7 +683,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Spannungs-", "quelle"},
|
||||||
/* (<= 9) Sleep temperature */{"Ruhetemp-", "eratur"},
|
/* (<= 9) Sleep temperature */{"Ruhetemp-", "eratur"},
|
||||||
/* (<= 9) Sleep timeout */{"Ruhever-", "zögerung"},
|
/* (<= 9) Sleep timeout */{"Ruhever-", "zögerung"},
|
||||||
@@ -799,7 +764,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
|
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"},
|
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
|
||||||
/* (<= 4) Sleep temperature */{"STMP"},
|
/* (<= 4) Sleep temperature */{"STMP"},
|
||||||
/* (<= 4) Sleep timeout */{"STME"},
|
/* (<= 4) Sleep timeout */{"STME"},
|
||||||
@@ -880,7 +845,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
|
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"},
|
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
|
||||||
/* (<= 4) Sleep temperature */{"STMP"},
|
/* (<= 4) Sleep temperature */{"STMP"},
|
||||||
/* (<= 4) Sleep timeout */{"STME"},
|
/* (<= 4) Sleep timeout */{"STME"},
|
||||||
@@ -961,7 +926,7 @@ const char SettingFastChar = 'B';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Izvor", "napajanja"},
|
||||||
/* (<= 9) Sleep temperature */{"Temp", "spavanja"},
|
/* (<= 9) Sleep temperature */{"Temp", "spavanja"},
|
||||||
/* (<= 9) Sleep timeout */{"Vrijeme", "spavanja"},
|
/* (<= 9) Sleep timeout */{"Vrijeme", "spavanja"},
|
||||||
@@ -1040,7 +1005,7 @@ const char SettingFastChar = 'R';
|
|||||||
const char SettingSlowChar = 'P';
|
const char SettingSlowChar = 'P';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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í"},
|
/* (<= 11) Power source (DC or batt) */{"Zdroj", "napájení"},
|
||||||
/* (<= 9) Sleep temperature */{"Teplota v", "r. spánku"},
|
/* (<= 9) Sleep temperature */{"Teplota v", "r. spánku"},
|
||||||
/* (<= 9) Sleep timeout */{"Čas do", "r. spánku"},
|
/* (<= 9) Sleep timeout */{"Čas do", "r. spánku"},
|
||||||
@@ -1125,7 +1090,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
|
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"},
|
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
|
||||||
/* (<= 4) Sleep temperature */{"STMP"},
|
/* (<= 4) Sleep temperature */{"STMP"},
|
||||||
/* (<= 4) Sleep timeout */{"STME"},
|
/* (<= 4) Sleep timeout */{"STME"},
|
||||||
@@ -1206,7 +1171,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
|
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"},
|
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
|
||||||
/* (<= 4) Sleep temperature */{"STMP"},
|
/* (<= 4) Sleep temperature */{"STMP"},
|
||||||
/* (<= 4) Sleep timeout */{"STME"},
|
/* (<= 4) Sleep timeout */{"STME"},
|
||||||
@@ -1287,7 +1252,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
|
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"},
|
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
|
||||||
/* (<= 4) Sleep temperature */{"STMP"},
|
/* (<= 4) Sleep temperature */{"STMP"},
|
||||||
/* (<= 4) Sleep timeout */{"STME"},
|
/* (<= 4) Sleep timeout */{"STME"},
|
||||||
@@ -1467,7 +1432,7 @@ const char SettingFastChar = 'T';
|
|||||||
const char SettingSlowChar = 'N';
|
const char SettingSlowChar = 'N';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Maitinimo", "šaltinis"},
|
||||||
/* (<= 9) Sleep temperature */{"Miego", "temperat."},
|
/* (<= 9) Sleep temperature */{"Miego", "temperat."},
|
||||||
/* (<= 9) Sleep timeout */{"Miego", "laikas"},
|
/* (<= 9) Sleep timeout */{"Miego", "laikas"},
|
||||||
@@ -1549,7 +1514,7 @@ const char SettingFastChar = '+';
|
|||||||
const char SettingSlowChar = '-';
|
const char SettingSlowChar = '-';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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
|
/* (<= 11) Power source (DC or batt) */{"Джерело","живлення"}, //7,8
|
||||||
/* (<= 9) Sleep temperature */{"Темпер.","сну"}, //7,3
|
/* (<= 9) Sleep temperature */{"Темпер.","сну"}, //7,3
|
||||||
/* (<= 9) Sleep timeout */{"Таймаут","сну"}, //7,3
|
/* (<= 9) Sleep timeout */{"Таймаут","сну"}, //7,3
|
||||||
@@ -1633,7 +1598,7 @@ const char SettingFastChar = 'F';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Spannings-", "bron"},
|
||||||
/* (<= 9) Sleep temperature */{"Slaap", "temp"},
|
/* (<= 9) Sleep temperature */{"Slaap", "temp"},
|
||||||
/* (<= 9) Sleep timeout */{"Slaap", "time-out"},
|
/* (<= 9) Sleep timeout */{"Slaap", "time-out"},
|
||||||
@@ -1719,7 +1684,7 @@ const char SettingFastChar = 'S';
|
|||||||
const char SettingSlowChar = 'L';
|
const char SettingSlowChar = 'L';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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"},
|
/* (<= 11) Power source (DC or batt) */{"Ström-", "källa"},
|
||||||
/* (<= 9) Sleep temperature */{"Vilo-", "temp"},
|
/* (<= 9) Sleep temperature */{"Vilo-", "temp"},
|
||||||
/* (<= 9) Sleep timeout */{"Vilo-", "timeout"},
|
/* (<= 9) Sleep timeout */{"Vilo-", "timeout"},
|
||||||
@@ -1806,7 +1771,7 @@ const char SettingFastChar = 'B';
|
|||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
|
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
|
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" },
|
/* (<= 11) Power source (DC or batt) */{ "Izvor", "napajanja" },
|
||||||
/* (<= 9) Sleep temperature */{ "Temp", "spavanja" },
|
/* (<= 9) Sleep temperature */{ "Temp", "spavanja" },
|
||||||
@@ -1884,7 +1849,7 @@ const char SettingAutoChar = 'A';
|
|||||||
const char SettingFastChar = 'H';
|
const char SettingFastChar = 'H';
|
||||||
const char SettingSlowChar = 'L';
|
const char SettingSlowChar = 'L';
|
||||||
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
|
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"},
|
/* (<= 5) Power source (DC or batt) */{"Kilde"},
|
||||||
/* (<= 4) Sleep temperature */{"DTmp"},
|
/* (<= 4) Sleep temperature */{"DTmp"},
|
||||||
/* (<= 4) Sleep timeout */{"DTid"},
|
/* (<= 4) Sleep timeout */{"DTid"},
|
||||||
|
|||||||
@@ -52,11 +52,19 @@ static void settings_setCoolingBlinkEnabled(void);
|
|||||||
static void settings_displayCoolingBlinkEnabled(void);
|
static void settings_displayCoolingBlinkEnabled(void);
|
||||||
static void settings_setResetSettings(void);
|
static void settings_setResetSettings(void);
|
||||||
static void settings_displayResetSettings(void);
|
static void settings_displayResetSettings(void);
|
||||||
|
static void settings_setTipModel(void);
|
||||||
|
static void settings_displayTipModel(void);
|
||||||
static void settings_setCalibrate(void);
|
static void settings_setCalibrate(void);
|
||||||
static void settings_displayCalibrate(void);
|
static void settings_displayCalibrate(void);
|
||||||
static void settings_setCalibrateVIN(void);
|
static void settings_setCalibrateVIN(void);
|
||||||
static void settings_displayCalibrateVIN(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
|
//Menu functions
|
||||||
static void settings_displaySolderingMenu(void);
|
static void settings_displaySolderingMenu(void);
|
||||||
static void settings_enterSolderingMenu(void);
|
static void settings_enterSolderingMenu(void);
|
||||||
@@ -185,6 +193,8 @@ const menuitem advancedMenu[] = {
|
|||||||
settings_displayAdvancedSolderingScreens } }, /* Advanced soldering screen*/
|
settings_displayAdvancedSolderingScreens } }, /* Advanced soldering screen*/
|
||||||
{ (const char*) SettingsDescriptions[13], { settings_setResetSettings }, {
|
{ (const char*) SettingsDescriptions[13], { settings_setResetSettings }, {
|
||||||
settings_displayResetSettings } }, /*Resets settings*/
|
settings_displayResetSettings } }, /*Resets settings*/
|
||||||
|
{ (const char*) SettingsDescriptions[17], { settings_setTipModel }, {
|
||||||
|
settings_displayTipModel } }, /*Select tip Model */
|
||||||
{ (const char*) SettingsDescriptions[12], { settings_setCalibrate }, {
|
{ (const char*) SettingsDescriptions[12], { settings_setCalibrate }, {
|
||||||
settings_displayCalibrate } }, /*Calibrate tip*/
|
settings_displayCalibrate } }, /*Calibrate tip*/
|
||||||
{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
|
{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
|
||||||
@@ -201,6 +211,13 @@ const menuitem advancedMenu[] = {
|
|||||||
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
|
{ 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) {
|
static void printShortDescriptionSingleLine(uint32_t shortDescIndex) {
|
||||||
lcd.setFont(0);
|
lcd.setFont(0);
|
||||||
lcd.setCharCursor(0, 0);
|
lcd.setCharCursor(0, 0);
|
||||||
@@ -569,30 +586,214 @@ static void settings_displayResetSettings(void) {
|
|||||||
printShortDescription(13, 7);
|
printShortDescription(13, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setCalibrate(void) {
|
static void settings_setTipModel(void) {
|
||||||
if (userConfirmation(SettingsCalibrationWarning)) {
|
systemSettings.tipType++;
|
||||||
//User confirmed
|
systemSettings.tipType %= (Tip_Custom + 1); //Wrap after custom
|
||||||
//So we now perform the actual calculation
|
|
||||||
|
}
|
||||||
|
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.clearScreen();
|
||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
lcd.print(".....");
|
for (uint8_t x = 0; x < i / 4; x++)
|
||||||
|
lcd.print(".");
|
||||||
lcd.refresh();
|
lcd.refresh();
|
||||||
|
osDelay(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void setTipOffset() {
|
||||||
|
setCalibrationOffset(0); //turn off the current offset
|
||||||
|
dotDelay();
|
||||||
|
|
||||||
setCalibrationOffset(0); //turn off the current offset
|
//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.
|
||||||
for (uint8_t i = 0; i < 20; i++) {
|
|
||||||
getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
|
int32_t offset = 0;
|
||||||
osDelay(20);
|
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;
|
//Provide the user the option to tune their own tip if custom is selected
|
||||||
//We now have an error between these that we want to store as the offset
|
//If not only do single point tuning as per usual
|
||||||
rawTempC = rawTempC - handleTempC;
|
static void settings_setCalibrate(void) {
|
||||||
systemSettings.CalibrationOffset = rawTempC;
|
if (systemSettings.tipType == Tip_Custom) {
|
||||||
setCalibrationOffset(rawTempC); //store the error
|
//Two types of calibration
|
||||||
osDelay(100);
|
//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();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
volatile uint16_t PWMSafetyTimer = 0;
|
volatile uint16_t PWMSafetyTimer = 0;
|
||||||
volatile int16_t CalibrationTempOffset = 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) {
|
void setCalibrationOffset(int16_t offSet) {
|
||||||
CalibrationTempOffset = offSet;
|
CalibrationTempOffset = offSet;
|
||||||
}
|
}
|
||||||
@@ -29,48 +37,95 @@ uint16_t getHandleTemperature() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
uint16_t tipMeasurementToC(uint16_t raw) {
|
uint16_t tipMeasurementToC(uint16_t raw) {
|
||||||
return ((raw - 532) / 33) + (getHandleTemperature() / 10)
|
|
||||||
- CalibrationTempOffset;
|
//((Raw Tip-RawOffset) * calibrationgain) / 1000 = tip delta in CX10
|
||||||
//Surprisingly that appears to be a fairly good linear best fit
|
// 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) {
|
uint16_t ctoTipMeasurement(uint16_t temp) {
|
||||||
//We need to compensate for cold junction temp
|
//[ (temp-handle/10) * 10000 ]/calibrationgain = tip raw delta
|
||||||
return ((temp - (getHandleTemperature() / 10) + CalibrationTempOffset) * 33)
|
// tip raw delta + tip offset = tip ADC reading
|
||||||
+ 532;
|
int32_t TipRaw = ((temp - (getHandleTemperature() / 10)) * 10000)
|
||||||
|
/ tipGainCalValue;
|
||||||
|
TipRaw += CalibrationTempOffset;
|
||||||
|
return TipRaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t tipMeasurementToF(uint16_t raw) {
|
uint16_t tipMeasurementToF(uint16_t raw) {
|
||||||
return ((((raw - 532) / 33) + (getHandleTemperature() / 10)
|
//Convert result from C to F
|
||||||
- CalibrationTempOffset) * 9) / 5 + 32;
|
return (tipMeasurementToC(raw) * 9) / 5 + 32;
|
||||||
|
|
||||||
}
|
}
|
||||||
uint16_t ftoTipMeasurement(uint16_t temp) {
|
uint16_t ftoTipMeasurement(uint16_t temp) {
|
||||||
|
//Convert the temp back to C from F
|
||||||
return (((((temp - 32) * 5) / 9) - (getHandleTemperature() / 10)
|
return ctoTipMeasurement(((temp - 32) * 5) / 9);
|
||||||
+ CalibrationTempOffset) * 33) + 532;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getTipInstantTemperature() {
|
uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipInstantTemperature() {
|
||||||
uint16_t sum;
|
uint16_t sum;
|
||||||
sum = HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
|
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_2);
|
||||||
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
|
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
|
||||||
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_4);
|
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;
|
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) {
|
if (instant == 1) {
|
||||||
uint16_t itemp = getTipInstantTemperature();
|
uint16_t itemp = getTipInstantTemperature();
|
||||||
filterFP = (filterFP << filterBeta) - filterFP;
|
filterFP = (filterFP << filterBeta) - filterFP;
|
||||||
filterFP += (itemp << 9);
|
filterFP += (itemp << 9);
|
||||||
filterFP = filterFP >> filterBeta;
|
filterFP = filterFP >> filterBeta;
|
||||||
|
uint16_t temp = itemp;
|
||||||
|
itemp += lastSample;
|
||||||
|
itemp /= 2;
|
||||||
|
lastSample = temp;
|
||||||
return itemp;
|
return itemp;
|
||||||
} else if (instant == 2) {
|
} else if (instant == 2) {
|
||||||
filterFP = (getTipInstantTemperature() << 9);
|
filterFP = (getTipInstantTemperature() << 8);
|
||||||
return filterFP >> 9;
|
return filterFP >> 9;
|
||||||
} else {
|
} else {
|
||||||
return filterFP >> 9;
|
return filterFP >> 9;
|
||||||
@@ -101,24 +156,28 @@ uint16_t getInputVoltageX10(uint8_t divisor) {
|
|||||||
preFillneeded = 1;
|
preFillneeded = 1;
|
||||||
return sum / divisor;
|
return sum / divisor;
|
||||||
}
|
}
|
||||||
|
volatile uint32_t pendingPWM = 0;
|
||||||
uint8_t getTipPWM() {
|
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.
|
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)
|
if (pulse > 100)
|
||||||
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
|
//Period has elapsed
|
||||||
if (htim->Instance == TIM2) {
|
if (htim->Instance == TIM2) {
|
||||||
//we want to turn on the output again
|
//we want to turn on the output again
|
||||||
PWMSafetyTimer--; //We decrement this safety value so that lockups in the scheduler will not cause the PWM to become locked in an active driving state.
|
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
|
//While we could assume this could never happen, its a small price for increased safety
|
||||||
|
htim2.Instance->CCR4 = pendingPWM;
|
||||||
if (htim2.Instance->CCR4 && PWMSafetyTimer) {
|
if (htim2.Instance->CCR4 && PWMSafetyTimer) {
|
||||||
htim3.Instance->CCR1 = 50;
|
htim3.Instance->CCR1 = 50;
|
||||||
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
|
||||||
@@ -127,21 +186,20 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
|
|||||||
htim3.Instance->CCR1 = 0;
|
htim3.Instance->CCR1 = 0;
|
||||||
}
|
}
|
||||||
} else if (htim->Instance == TIM1) {
|
} else if (htim->Instance == TIM1) {
|
||||||
|
// STM uses this for internal functions as a counter for timeouts
|
||||||
HAL_IncTick();
|
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) {
|
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) {
|
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
|
||||||
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
|
||||||
htim3.Instance->CCR1 = 0;
|
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);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ int main(void) {
|
|||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
restoreSettings(); // load the settings from flash
|
restoreSettings(); // load the settings from flash
|
||||||
setCalibrationOffset(systemSettings.CalibrationOffset);
|
setCalibrationOffset(systemSettings.CalibrationOffset);
|
||||||
|
setTipType((enum TipType)systemSettings.tipType, systemSettings.customTipGain); //apply tip type selection
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
|
|
||||||
/* Create the thread(s) */
|
/* Create the thread(s) */
|
||||||
@@ -97,6 +98,9 @@ void printVoltage() {
|
|||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
||||||
}
|
}
|
||||||
void GUIDelay() {
|
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);
|
osDelay(50);
|
||||||
}
|
}
|
||||||
void gui_drawTipTemp(bool symbol) {
|
void gui_drawTipTemp(bool symbol) {
|
||||||
@@ -187,7 +191,7 @@ ButtonState getButtonState() {
|
|||||||
return BUTTON_NONE;
|
return BUTTON_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void waitForButtonPress() {
|
void waitForButtonPress() {
|
||||||
// we are just lazy and sleep until user confirms button press
|
// we are just lazy and sleep until user confirms button press
|
||||||
// This also eats the button press event!
|
// This also eats the button press event!
|
||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
@@ -314,15 +318,11 @@ static void gui_solderingTempAdjust() {
|
|||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
if (systemSettings.SolderingTemp > 850)
|
if (systemSettings.SolderingTemp > 850)
|
||||||
systemSettings.SolderingTemp = 850;
|
systemSettings.SolderingTemp = 850;
|
||||||
} else {
|
|
||||||
if (systemSettings.SolderingTemp > 450)
|
|
||||||
systemSettings.SolderingTemp = 450;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (systemSettings.temperatureInF) {
|
|
||||||
if (systemSettings.SolderingTemp < 120)
|
if (systemSettings.SolderingTemp < 120)
|
||||||
systemSettings.SolderingTemp = 120;
|
systemSettings.SolderingTemp = 120;
|
||||||
} else {
|
} else {
|
||||||
|
if (systemSettings.SolderingTemp > 450)
|
||||||
|
systemSettings.SolderingTemp = 450;
|
||||||
if (systemSettings.SolderingTemp < 50)
|
if (systemSettings.SolderingTemp < 50)
|
||||||
systemSettings.SolderingTemp = 50;
|
systemSettings.SolderingTemp = 50;
|
||||||
}
|
}
|
||||||
@@ -343,9 +343,9 @@ static void gui_solderingTempAdjust() {
|
|||||||
lcd.drawSymbol(1);
|
lcd.drawSymbol(1);
|
||||||
lcd.drawChar(' ');
|
lcd.drawChar(' ');
|
||||||
if (lcd.getRotation())
|
if (lcd.getRotation())
|
||||||
lcd.drawChar('+');
|
lcd.drawChar('+');
|
||||||
else
|
else
|
||||||
lcd.drawChar('-');
|
lcd.drawChar('-');
|
||||||
lcd.refresh();
|
lcd.refresh();
|
||||||
GUIDelay();
|
GUIDelay();
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ static void gui_solderingMode() {
|
|||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
lcd.clearScreen();
|
lcd.clearScreen();
|
||||||
lcd.setFont(0);
|
lcd.setFont(0);
|
||||||
if (tipTemp > 16300) {
|
if (tipTemp > 32752) {
|
||||||
lcd.print(BadTipString);
|
lcd.print(BadTipString);
|
||||||
lcd.refresh();
|
lcd.refresh();
|
||||||
currentlyActiveTemperatureTarget = 0;
|
currentlyActiveTemperatureTarget = 0;
|
||||||
@@ -508,10 +508,11 @@ static void gui_solderingMode() {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (systemSettings.detailedSoldering) {
|
if (systemSettings.detailedSoldering) {
|
||||||
lcd.setFont(1);
|
lcd.setFont(1);/*
|
||||||
lcd.print(SolderingAdvancedPowerPrompt); //Power:
|
lcd.print(SolderingAdvancedPowerPrompt); //Power:
|
||||||
lcd.printNumber(getTipPWM(), 3);
|
lcd.printNumber(getTipPWM(), 3);
|
||||||
lcd.print("%");
|
lcd.print("%");*/
|
||||||
|
lcd.printNumber(getTipRawTemp(0), 6);
|
||||||
|
|
||||||
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
||||||
lcd.print(" ");
|
lcd.print(" ");
|
||||||
@@ -596,7 +597,7 @@ static void gui_solderingMode() {
|
|||||||
|
|
||||||
static const char *HEADERS[] = {
|
static const char *HEADERS[] = {
|
||||||
__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
|
__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
|
||||||
"Ctip: ", "Vin :" };
|
"Ctip: ", "Vin :", "THan: " };
|
||||||
|
|
||||||
void showVersion(void) {
|
void showVersion(void) {
|
||||||
uint8_t screen = 0;
|
uint8_t screen = 0;
|
||||||
@@ -629,7 +630,7 @@ void showVersion(void) {
|
|||||||
lcd.printNumber(lastMovementTime / 100, 5);
|
lcd.printNumber(lastMovementTime / 100, 5);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
lcd.printNumber(getTipRawTemp(0), 5);
|
lcd.printNumber(getTipRawTemp(0), 6);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
|
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
|
||||||
@@ -637,6 +638,8 @@ void showVersion(void) {
|
|||||||
case 9:
|
case 9:
|
||||||
printVoltage();
|
printVoltage();
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
lcd.printNumber(getHandleTemperature(), 3);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -647,14 +650,14 @@ void showVersion(void) {
|
|||||||
return;
|
return;
|
||||||
else if (b == BUTTON_F_SHORT) {
|
else if (b == BUTTON_F_SHORT) {
|
||||||
screen++;
|
screen++;
|
||||||
screen = screen % 10;
|
screen = screen % 11;
|
||||||
}
|
}
|
||||||
GUIDelay();
|
GUIDelay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* StartGUITask function */
|
/* StartGUITask function */
|
||||||
void startGUITask(void const *argument) {
|
void startGUITask(void const *argument __unused) {
|
||||||
i2cDev.FRToSInit();
|
i2cDev.FRToSInit();
|
||||||
uint8_t tempWarningState = 0;
|
uint8_t tempWarningState = 0;
|
||||||
bool buttonLockout = false;
|
bool buttonLockout = false;
|
||||||
@@ -814,7 +817,7 @@ void startGUITask(void const *argument) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* StartPIDTask function */
|
/* 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
|
* We take the current tip temperature & evaluate the next step for the tip
|
||||||
* control PWM
|
* control PWM
|
||||||
@@ -843,8 +846,8 @@ void startPIDTask(void const *argument) {
|
|||||||
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
|
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
|
||||||
if (currentlyActiveTemperatureTarget) {
|
if (currentlyActiveTemperatureTarget) {
|
||||||
// Compute the PID loop in here
|
// Compute the PID loop in here
|
||||||
// Because our values here are quite large for all measurements (0-16k ~=
|
// Because our values here are quite large for all measurements (0-32k ~=
|
||||||
// 33 counts per C)
|
// 66 counts per C)
|
||||||
// P I & D are divisors, so inverse logic applies (beware)
|
// P I & D are divisors, so inverse logic applies (beware)
|
||||||
|
|
||||||
// Cap the max set point to 450C
|
// Cap the max set point to 450C
|
||||||
@@ -854,9 +857,12 @@ void startPIDTask(void const *argument) {
|
|||||||
|
|
||||||
int32_t rawTempError = currentlyActiveTemperatureTarget
|
int32_t rawTempError = currentlyActiveTemperatureTarget
|
||||||
- rawTemp;
|
- rawTemp;
|
||||||
|
|
||||||
int32_t ierror = (rawTempError
|
int32_t ierror = (rawTempError
|
||||||
/ ((int32_t) systemSettings.PID_I));
|
/ ((int32_t) systemSettings.PID_I));
|
||||||
|
|
||||||
integralCount += ierror;
|
integralCount += ierror;
|
||||||
|
|
||||||
if (integralCount > (itermMax / 2))
|
if (integralCount > (itermMax / 2))
|
||||||
integralCount = itermMax / 2; // prevent too much lead
|
integralCount = itermMax / 2; // prevent too much lead
|
||||||
else if (integralCount < -itermMax)
|
else if (integralCount < -itermMax)
|
||||||
@@ -878,9 +884,11 @@ void startPIDTask(void const *argument) {
|
|||||||
output = 0;
|
output = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (currentlyActiveTemperatureTarget < rawTemp) {
|
if (currentlyActiveTemperatureTarget < rawTemp) {
|
||||||
output = 0;
|
output = 0;
|
||||||
}*/
|
integralCount = 0;
|
||||||
|
derivativeLastValue = 0;
|
||||||
|
}
|
||||||
setTipPWM(output);
|
setTipPWM(output);
|
||||||
derivativeLastValue = rawTemp; // store for next loop
|
derivativeLastValue = rawTemp; // store for next loop
|
||||||
|
|
||||||
@@ -891,11 +899,17 @@ void startPIDTask(void const *argument) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
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
|
#define MOVFilter 8
|
||||||
void startMOVTask(void const *argument) {
|
void startMOVTask(void const *argument __unused) {
|
||||||
osDelay(250); // wait for accelerometer to stabilize
|
osDelay(250); // wait for accelerometer to stabilize
|
||||||
lcd.setRotation(systemSettings.OrientationMode & 1);
|
lcd.setRotation(systemSettings.OrientationMode & 1);
|
||||||
lastMovementTime = 0;
|
lastMovementTime = 0;
|
||||||
@@ -1011,41 +1025,48 @@ bool showBootLogoIfavailable() {
|
|||||||
return true;
|
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;
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
if (hadc == &hadc1) {
|
||||||
if (pidTaskNotification) {
|
if (pidTaskNotification) {
|
||||||
/* Notify the task that the transmission is complete. */
|
vTaskNotifyGiveFromISR(pidTaskNotification,
|
||||||
vTaskNotifyGiveFromISR(pidTaskNotification, &xHigherPriorityTaskWoken);
|
&xHigherPriorityTaskWoken);
|
||||||
|
portYIELD_FROM_ISR(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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c) {
|
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterRxCpltCallback(
|
||||||
|
I2C_HandleTypeDef *hi2c __unused) {
|
||||||
i2cDev.CpltCallback();
|
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();
|
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();
|
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();
|
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();
|
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();
|
i2cDev.CpltCallback();
|
||||||
}
|
}
|
||||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask,
|
void vApplicationStackOverflowHook( xTaskHandle *pxTask __unused,
|
||||||
signed portCHAR *pcTaskName) {
|
signed portCHAR *pcTaskName __unused) {
|
||||||
//We dont have a good way to handle a stack overflow at this point in time
|
//We dont have a good way to handle a stack overflow at this point in time
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ void HAL_MspInit(void) {
|
|||||||
*/
|
*/
|
||||||
//__HAL_AFIO_REMAP_SWJ_NOJTAG()
|
//__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 */
|
/* ADC1 interrupt Init */
|
||||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
|
HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
|
||||||
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,15 +35,15 @@
|
|||||||
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
|
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.atollic.truestudio.as.general.incpath.1741841972" name="Include path" superClass="com.atollic.truestudio.as.general.incpath" useByScannerDiscovery="false" valueType="includePath">
|
<option id="com.atollic.truestudio.as.general.incpath.1741841972" name="Include path" superClass="com.atollic.truestudio.as.general.incpath" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\include""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\Middlewares\Third_Party\FreeRTOS\Source\include""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\portable""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\Middlewares\Third_Party\FreeRTOS\Source\portable""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\HAL_Driver\Inc\Legacy""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\HAL_Driver\Inc\Legacy""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\inc""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\inc""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\HAL_Driver\Inc""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\HAL_Driver\Inc""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\CMSIS\core""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\CMSIS\core""/>
|
||||||
<listOptionValue builtIn="false" value=""C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\CMSIS\device""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/../TS100\CMSIS\device""/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="com.atollic.truestudio.as.input.640267647" name="Input" superClass="com.atollic.truestudio.as.input"/>
|
<inputType id="com.atollic.truestudio.as.input.640267647" name="Input" superClass="com.atollic.truestudio.as.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="345853602457066550" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="296187985853974766" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
|||||||
Reference in New Issue
Block a user