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:
Ben V. Brown
2018-09-17 22:18:39 +10:00
committed by GitHub
parent b3947ccc1c
commit 056353ed6a
25 changed files with 1934 additions and 1555 deletions

1
.gitignore vendored
View File

@@ -48,3 +48,4 @@ workspace/TS100A/Release/TS100A.map
workspace/TS100A/Release/TS100A.list
workspace/TS100A/Release/TS100A.hex
workspace/TS100A/.settings/language.settings.xml
workspace/TS100A/.metadata/

View File

@@ -11,13 +11,15 @@ ADC1.DiscontinuousConvMode=DISABLE
ADC1.EnableAnalogWatchDog=false
ADC1.EnableRegularConversion=ENABLE
ADC1.ExternalTrigConv=ADC_SOFTWARE_START
ADC1.ExternalTrigInjecConv=ADC_EXTERNALTRIGINJECCONV_T3_CC4
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConv,InjNumberOfConversion,EnableAnalogWatchDog,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,master,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,Rank-5\#ChannelInjectedConversion,Channel-5\#ChannelInjectedConversion,SamplingTime-5\#ChannelInjectedConversion,InjectedOffset-5\#ChannelInjectedConversion,ExternalTrigInjecConv
ADC1.ExternalTrigInjecConv=ADC_EXTERNALTRIGINJECCONV_T2_CC1
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,ExternalTrigConv,InjNumberOfConversion,EnableAnalogWatchDog,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,master,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,Rank-5\#ChannelInjectedConversion,Channel-5\#ChannelInjectedConversion,SamplingTime-5\#ChannelInjectedConversion,InjectedOffset-5\#ChannelInjectedConversion,ExternalTrigInjecConv,InjectedConvMode,Mode
ADC1.InjNumberOfConversion=4
ADC1.InjectedConvMode=None
ADC1.InjectedOffset-2\#ChannelInjectedConversion=0
ADC1.InjectedOffset-3\#ChannelInjectedConversion=0
ADC1.InjectedOffset-4\#ChannelInjectedConversion=0
ADC1.InjectedOffset-5\#ChannelInjectedConversion=0
ADC1.Mode=ADC_DUALMODE_REGSIMULT_INJECSIMULT
ADC1.NbrOfConversion=2
ADC1.NbrOfConversionFlag=1
ADC1.Rank-0\#ChannelRegularConversion=1
@@ -34,36 +36,67 @@ ADC1.SamplingTime-4\#ChannelInjectedConversion=ADC_SAMPLETIME_239CYCLES_5
ADC1.SamplingTime-5\#ChannelInjectedConversion=ADC_SAMPLETIME_71CYCLES_5
ADC1.ScanConvMode=ADC_SCAN_ENABLE
ADC1.master=1
Dma.ADC1.0.Direction=DMA_PERIPH_TO_MEMORY
Dma.ADC1.0.Instance=DMA1_Channel1
Dma.ADC1.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
Dma.ADC1.0.MemInc=DMA_MINC_ENABLE
Dma.ADC1.0.Mode=DMA_CIRCULAR
Dma.ADC1.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
Dma.ADC1.0.PeriphInc=DMA_PINC_DISABLE
Dma.ADC1.0.Priority=DMA_PRIORITY_VERY_HIGH
Dma.ADC1.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
Dma.I2C1_RX.1.Direction=DMA_PERIPH_TO_MEMORY
Dma.I2C1_RX.1.Instance=DMA1_Channel7
Dma.I2C1_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
Dma.I2C1_RX.1.MemInc=DMA_MINC_ENABLE
Dma.I2C1_RX.1.Mode=DMA_NORMAL
Dma.I2C1_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
Dma.I2C1_RX.1.PeriphInc=DMA_PINC_DISABLE
Dma.I2C1_RX.1.Priority=DMA_PRIORITY_MEDIUM
Dma.I2C1_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
Dma.I2C1_TX.2.Direction=DMA_MEMORY_TO_PERIPH
Dma.I2C1_TX.2.Instance=DMA1_Channel6
Dma.I2C1_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
Dma.I2C1_TX.2.MemInc=DMA_MINC_ENABLE
Dma.I2C1_TX.2.Mode=DMA_NORMAL
Dma.I2C1_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
Dma.I2C1_TX.2.PeriphInc=DMA_PINC_DISABLE
Dma.I2C1_TX.2.Priority=DMA_PRIORITY_MEDIUM
Dma.I2C1_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
Dma.Request0=ADC1
Dma.Request1=I2C1_RX
Dma.Request2=I2C1_TX
ADC2.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_8
ADC2.Channel-1\#ChannelInjectedConversion=ADC_CHANNEL_8
ADC2.Channel-2\#ChannelInjectedConversion=ADC_CHANNEL_8
ADC2.Channel-3\#ChannelInjectedConversion=ADC_CHANNEL_8
ADC2.Channel-4\#ChannelInjectedConversion=ADC_CHANNEL_8
ADC2.ContinuousConvMode=DISABLE
ADC2.DataAlign=ADC_DATAALIGN_RIGHT
ADC2.DiscontinuousConvMode=DISABLE
ADC2.EnableAnalogWatchDog=false
ADC2.EnableRegularConversion=ENABLE
ADC2.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,Rank-1\#ChannelInjectedConversion,Channel-1\#ChannelInjectedConversion,SamplingTime-1\#ChannelInjectedConversion,InjectedOffset-1\#ChannelInjectedConversion,Rank-2\#ChannelInjectedConversion,Channel-2\#ChannelInjectedConversion,SamplingTime-2\#ChannelInjectedConversion,InjectedOffset-2\#ChannelInjectedConversion,Rank-3\#ChannelInjectedConversion,Channel-3\#ChannelInjectedConversion,SamplingTime-3\#ChannelInjectedConversion,InjectedOffset-3\#ChannelInjectedConversion,Rank-4\#ChannelInjectedConversion,Channel-4\#ChannelInjectedConversion,SamplingTime-4\#ChannelInjectedConversion,InjectedOffset-4\#ChannelInjectedConversion,InjNumberOfConversion,Mode,DataAlign,ScanConvMode,ContinuousConvMode,DiscontinuousConvMode,EnableRegularConversion,NbrOfConversion,InjectedConvMode,EnableAnalogWatchDog
ADC2.InjNumberOfConversion=4
ADC2.InjectedConvMode=None
ADC2.InjectedOffset-1\#ChannelInjectedConversion=0
ADC2.InjectedOffset-2\#ChannelInjectedConversion=0
ADC2.InjectedOffset-3\#ChannelInjectedConversion=0
ADC2.InjectedOffset-4\#ChannelInjectedConversion=0
ADC2.Mode=ADC_DUALMODE_REGSIMULT_INJECSIMULT
ADC2.NbrOfConversion=1
ADC2.NbrOfConversionFlag=1
ADC2.Rank-0\#ChannelRegularConversion=1
ADC2.Rank-1\#ChannelInjectedConversion=1
ADC2.Rank-2\#ChannelInjectedConversion=2
ADC2.Rank-3\#ChannelInjectedConversion=3
ADC2.Rank-4\#ChannelInjectedConversion=4
ADC2.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
ADC2.SamplingTime-1\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
ADC2.SamplingTime-2\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
ADC2.SamplingTime-3\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
ADC2.SamplingTime-4\#ChannelInjectedConversion=ADC_SAMPLETIME_1CYCLE_5
ADC2.ScanConvMode=ADC_SCAN_ENABLE
Dma.ADC1.2.Direction=DMA_PERIPH_TO_MEMORY
Dma.ADC1.2.Instance=DMA1_Channel1
Dma.ADC1.2.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
Dma.ADC1.2.MemInc=DMA_MINC_ENABLE
Dma.ADC1.2.Mode=DMA_CIRCULAR
Dma.ADC1.2.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
Dma.ADC1.2.PeriphInc=DMA_PINC_DISABLE
Dma.ADC1.2.Priority=DMA_PRIORITY_VERY_HIGH
Dma.ADC1.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
Dma.I2C1_RX.0.Direction=DMA_PERIPH_TO_MEMORY
Dma.I2C1_RX.0.Instance=DMA1_Channel7
Dma.I2C1_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
Dma.I2C1_RX.0.MemInc=DMA_MINC_ENABLE
Dma.I2C1_RX.0.Mode=DMA_NORMAL
Dma.I2C1_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
Dma.I2C1_RX.0.PeriphInc=DMA_PINC_DISABLE
Dma.I2C1_RX.0.Priority=DMA_PRIORITY_MEDIUM
Dma.I2C1_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
Dma.I2C1_TX.1.Direction=DMA_MEMORY_TO_PERIPH
Dma.I2C1_TX.1.Instance=DMA1_Channel6
Dma.I2C1_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
Dma.I2C1_TX.1.MemInc=DMA_MINC_ENABLE
Dma.I2C1_TX.1.Mode=DMA_NORMAL
Dma.I2C1_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
Dma.I2C1_TX.1.PeriphInc=DMA_PINC_DISABLE
Dma.I2C1_TX.1.Priority=DMA_PRIORITY_MEDIUM
Dma.I2C1_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
Dma.Request0=I2C1_RX
Dma.Request1=I2C1_TX
Dma.Request2=ADC1
Dma.RequestsNb=3
FREERTOS.FootprintOK=true
FREERTOS.INCLUDE_vTaskDelete=0
@@ -82,16 +115,17 @@ IWDG.Prescaler=IWDG_PRESCALER_256
KeepUserPlacement=false
Mcu.Family=STM32F1
Mcu.IP0=ADC1
Mcu.IP1=DMA
Mcu.IP2=FREERTOS
Mcu.IP3=I2C1
Mcu.IP4=IWDG
Mcu.IP5=NVIC
Mcu.IP6=RCC
Mcu.IP7=SYS
Mcu.IP8=TIM2
Mcu.IP9=TIM3
Mcu.IPNb=10
Mcu.IP1=ADC2
Mcu.IP10=TIM3
Mcu.IP2=DMA
Mcu.IP3=FREERTOS
Mcu.IP4=I2C1
Mcu.IP5=IWDG
Mcu.IP6=NVIC
Mcu.IP7=RCC
Mcu.IP8=SYS
Mcu.IP9=TIM2
Mcu.IPNb=11
Mcu.Name=STM32F103T(8-B)Ux
Mcu.Package=VFQFPN36
Mcu.Pin0=PA6
@@ -119,8 +153,8 @@ Mcu.PinsNb=21
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F103T8Ux
MxCube.Version=4.25.0
MxDb.Version=DB.4.0.250
MxCube.Version=4.26.0
MxDb.Version=DB.4.0.260
NVIC.ADC1_2_IRQn=true\:5\:0\:false\:false\:true\:true\:true
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true
NVIC.DMA1_Channel1_IRQn=true\:5\:0\:false\:false\:true\:true\:true
@@ -204,7 +238,7 @@ ProjectManager.BackupPrevious=false
ProjectManager.CompilerOptimize=3
ProjectManager.ComputerToolchain=false
ProjectManager.CoupleFile=false
ProjectManager.CustomerFirmwarePackage=C\:/Users/Ralim/STM32Cube/Repository/STM32Cube_FW_F1_V1.6.1
ProjectManager.CustomerFirmwarePackage=
ProjectManager.DefaultFWLocation=true
ProjectManager.DeletePrevious=true
ProjectManager.DeviceId=STM32F103T8Ux
@@ -216,15 +250,15 @@ ProjectManager.KeepUserCode=true
ProjectManager.LastFirmware=true
ProjectManager.LibraryCopy=1
ProjectManager.MainLocation=Src
ProjectManager.PreviousToolchain=SW4STM32
ProjectManager.PreviousToolchain=TrueSTUDIO
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=TS100.ioc
ProjectManager.ProjectName=TS100
ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=SW4STM32
ProjectManager.TargetToolchain=TrueSTUDIO
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-SystemClock_Config-RCC-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_IWDG_Init-IWDG-false-HAL-true,8-MX_TIM2_Init-TIM2-false-HAL-true
ProjectManager.UnderRoot=true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_ADC1_Init-ADC1-false-HAL-true,5-SystemClock_Config-RCC-false-HAL-true,6-MX_TIM3_Init-TIM3-false-HAL-true,7-MX_IWDG_Init-IWDG-false-HAL-true,8-MX_TIM2_Init-TIM2-false-HAL-true,9-MX_ADC2_Init-ADC2-false-HAL-true
RCC.ADCFreqValue=8000000
RCC.ADCPresc=RCC_ADCPCLK2_DIV8
RCC.AHBFreq_Value=64000000
@@ -249,8 +283,8 @@ RCC.USBFreq_Value=42666666.666666664
RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5
SH.ADCx_IN7.0=ADC1_IN7,IN7
SH.ADCx_IN7.ConfNb=1
SH.ADCx_IN8.0=ADC2_IN8
SH.ADCx_IN8.1=ADC1_IN8,IN8
SH.ADCx_IN8.0=ADC1_IN8,IN8
SH.ADCx_IN8.1=ADC2_IN8,IN8
SH.ADCx_IN8.ConfNb=2
SH.ADCx_IN9.0=ADC2_IN9
SH.ADCx_IN9.1=ADC1_IN9,IN9

View File

@@ -1,245 +1,245 @@
<!doctype html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="translations_commons.js"></script>
<title>TS100 Bitmap Editor</title>
<style>
.matrix {
display: inline-block;
padding: 0px 0px 1px 1px ;
background-color: #666;
margin-top: 1em;
margin-bottom: 1em;
}
.matrix * {
font-size:0;
}
.c {
margin:1px 1px 0px 0px;
display: inline-block;
background-color: #fff;
height:10px;
width: 10px;
}
.x {
background-color: #000;
}
.header {
}
.data input, .data textarea {
margin-top: 1em;
width: 100%;
}
.actions {
}
</style>
<script>
var ink, pressed, ev;
function mousedown(e) {
c = window.event.target;
classes = c.className.split(" ");
if (classes.indexOf("c")<0) {
return;
}
ink = classes.indexOf("x")<0;
pressed = true;
ev = e;
enter(e);
}
function mouseup(e) {
ev = e;
pressed = false;
}
function enter(e) {
if (!pressed) {
return;
}
ev = e;
c = window.event.target;
paint(c, ink);
stringFromMatrix();
}
function paint(c, ink) {
var cellInk = isInk(c);
if (ink) {
if (!cellInk) {
c.className += " x";
}
} else {
if (cellInk) {
c.className = "c";
}
}
}
function isInk(c) {
try {
var classes = c.className.split(" ");
return classes.indexOf("x") >= 0;
} catch(e) {
return false;
}
}
function getMatrix() {
return document.getElementById("matrix");
}
function getCoordinatesFromId(str) {
i = str.indexOf('_');
return {
row: parseInt(str.substring(1, i)),
col: parseInt(str.substring(i+1))
}
}
function clearMatrix() {
for (var r = 0; r < app.matrix.rows; r++) {
for (var c = 0; c < app.matrix.cols; c++) {
paint(getCell(r, c), false);
}
}
}
function getCell(row, col) {
return document.getElementById("C"+row+"_"+col);
}
function toMatrix(str) {
app.encodedData = str;
clearMatrix();
var strs = str.split(/[ ,]/);
var pair = false;
var c = 0;
var rs = 7;
for (var i = 0; i<strs.length; i++) {
var d = strs[i];
if (d.length > 0) {
if (startsWith(d, "0x")) {
v = parseInt(d.substring(2), 16);
} else {
v = parseInt(d);
}
sv = padLeft(v.toString(2), "0", 8);
for (r = 0; r < 8; r++) {
paint(getCell(rs - r, c), sv.charAt(r) == '1');
}
c++;
if (c >= app.matrix.cols) {
c = 0;
rs += 8;
}
}
}
}
function stringFromMatrix() {
var str = "";
var delim = "";
var blocks = app.matrix.rows / 8;
var rs = 7;
for (var block = 0; block < blocks; block++) {
for (var c = 0; c < app.matrix.cols; c++) {
var b = 0;
for (var r = 0; r < 8; r++) {
var cell = document.getElementById("C"+(rs-r)+"_"+c);
if (isInk(cell)) {
b |= (1 << (7-r));
}
}
str += delim + "0x" + padLeft(b.toString(16).toUpperCase(), "0", 2);
delim = ",";
}
rs += 8;
}
app.encodedData = str;
return str;
}
function start() {
app = new Vue({
el : '#app',
data : {
matrix: {
cols: 12,
rows: 16
},
type: "big",
encodedData: ""
},
methods : {
VtoMatrix : function(val) {
toMatrix(val);
},
VchangeSize : function() {
if (app.type == "big") {
app.matrix.cols = 12;
app.matrix.rows = 16;
} else if (app.type == "small") {
app.matrix.cols = 6;
app.matrix.rows = 8;
} else if (app.type == "icon") {
app.matrix.cols = 16;
app.matrix.rows = 16;
} else if (app.type == "icon24") {
app.matrix.cols = 24;
app.matrix.rows = 16;
} else if (app.type == "screen") {
app.matrix.cols = 84;
app.matrix.rows = 16;
} else if (app.type == "fullscreen") {
app.matrix.cols = 96;
app.matrix.rows = 16;
}
stringFromMatrix();
}
}
});
toMatrix("0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5C,0x5C,0x5C,0x5C,0x5C,0x5C,0x40,0x3F,0x00");
}
window.onload=start;
</script>
</head>
<body>
<div id="app">
<div class="header">
<select v-model="type" v-on:change="VchangeSize()">
<option value="small">Small Font (6x8)</option>
<option value="big">Big Font (12x16)</option>
<option value="icon">Icon (16x16)</option>
<option value="icon24">Icon (24x16)</option>
<option value="screen">Screen (84x16)</option>
<option value="fullscreen">Full Screen (96x16)</option>
</select>
</div>
<div id="matrix" class="matrix" onmousedown="mousedown(this)" onmouseup="mouseup(this)" ondragstart="return false">
<div :id="'R'+(r-1)" class="r" v-for="r in matrix.rows">
<div :id="'C'+(r-1)+'_'+(c-1)" class="c" onmouseenter="enter(this)" v-for="c in matrix.cols"></div>
</div>
</div>
<div class="actions">
<input type="button" value="Clear" onclick="clearMatrix();stringFromMatrix()">
</div>
<div class="data">
<textarea v-model="encodedData" style="width:100%" v-on:change="VtoMatrix(encodedData)" rows=5>
</div>
</div>
</body>
<!doctype html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="translations_commons.js"></script>
<title>TS100 Bitmap Editor</title>
<style>
.matrix {
display: inline-block;
padding: 0px 0px 1px 1px ;
background-color: #666;
margin-top: 1em;
margin-bottom: 1em;
}
.matrix * {
font-size:0;
}
.c {
margin:1px 1px 0px 0px;
display: inline-block;
background-color: #fff;
height:10px;
width: 10px;
}
.x {
background-color: #000;
}
.header {
}
.data input, .data textarea {
margin-top: 1em;
width: 100%;
}
.actions {
}
</style>
<script>
var ink, pressed, ev;
function mousedown(e) {
c = window.event.target;
classes = c.className.split(" ");
if (classes.indexOf("c")<0) {
return;
}
ink = classes.indexOf("x")<0;
pressed = true;
ev = e;
enter(e);
}
function mouseup(e) {
ev = e;
pressed = false;
}
function enter(e) {
if (!pressed) {
return;
}
ev = e;
c = window.event.target;
paint(c, ink);
stringFromMatrix();
}
function paint(c, ink) {
var cellInk = isInk(c);
if (ink) {
if (!cellInk) {
c.className += " x";
}
} else {
if (cellInk) {
c.className = "c";
}
}
}
function isInk(c) {
try {
var classes = c.className.split(" ");
return classes.indexOf("x") >= 0;
} catch(e) {
return false;
}
}
function getMatrix() {
return document.getElementById("matrix");
}
function getCoordinatesFromId(str) {
i = str.indexOf('_');
return {
row: parseInt(str.substring(1, i)),
col: parseInt(str.substring(i+1))
}
}
function clearMatrix() {
for (var r = 0; r < app.matrix.rows; r++) {
for (var c = 0; c < app.matrix.cols; c++) {
paint(getCell(r, c), false);
}
}
}
function getCell(row, col) {
return document.getElementById("C"+row+"_"+col);
}
function toMatrix(str) {
app.encodedData = str;
clearMatrix();
var strs = str.split(/[ ,]/);
var pair = false;
var c = 0;
var rs = 7;
for (var i = 0; i<strs.length; i++) {
var d = strs[i];
if (d.length > 0) {
if (startsWith(d, "0x")) {
v = parseInt(d.substring(2), 16);
} else {
v = parseInt(d);
}
sv = padLeft(v.toString(2), "0", 8);
for (r = 0; r < 8; r++) {
paint(getCell(rs - r, c), sv.charAt(r) == '1');
}
c++;
if (c >= app.matrix.cols) {
c = 0;
rs += 8;
}
}
}
}
function stringFromMatrix() {
var str = "";
var delim = "";
var blocks = app.matrix.rows / 8;
var rs = 7;
for (var block = 0; block < blocks; block++) {
for (var c = 0; c < app.matrix.cols; c++) {
var b = 0;
for (var r = 0; r < 8; r++) {
var cell = document.getElementById("C"+(rs-r)+"_"+c);
if (isInk(cell)) {
b |= (1 << (7-r));
}
}
str += delim + "0x" + padLeft(b.toString(16).toUpperCase(), "0", 2);
delim = ",";
}
rs += 8;
}
app.encodedData = str;
return str;
}
function start() {
app = new Vue({
el : '#app',
data : {
matrix: {
cols: 12,
rows: 16
},
type: "big",
encodedData: ""
},
methods : {
VtoMatrix : function(val) {
toMatrix(val);
},
VchangeSize : function() {
if (app.type == "big") {
app.matrix.cols = 12;
app.matrix.rows = 16;
} else if (app.type == "small") {
app.matrix.cols = 6;
app.matrix.rows = 8;
} else if (app.type == "icon") {
app.matrix.cols = 16;
app.matrix.rows = 16;
} else if (app.type == "icon24") {
app.matrix.cols = 24;
app.matrix.rows = 16;
} else if (app.type == "screen") {
app.matrix.cols = 84;
app.matrix.rows = 16;
} else if (app.type == "fullscreen") {
app.matrix.cols = 96;
app.matrix.rows = 16;
}
stringFromMatrix();
}
}
});
toMatrix("0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5C,0x5C,0x5C,0x5C,0x5C,0x5C,0x40,0x3F,0x00");
}
window.onload=start;
</script>
</head>
<body>
<div id="app">
<div class="header">
<select v-model="type" v-on:change="VchangeSize()">
<option value="small">Small Font (6x8)</option>
<option value="big">Big Font (12x16)</option>
<option value="icon">Icon (16x16)</option>
<option value="icon24">Icon (24x16)</option>
<option value="screen">Screen (84x16)</option>
<option value="fullscreen">Full Screen (96x16)</option>
</select>
</div>
<div id="matrix" class="matrix" onmousedown="mousedown(this)" onmouseup="mouseup(this)" ondragstart="return false">
<div :id="'R'+(r-1)" class="r" v-for="r in matrix.rows">
<div :id="'C'+(r-1)+'_'+(c-1)" class="c" onmouseenter="enter(this)" v-for="c in matrix.cols"></div>
</div>
</div>
<div class="actions">
<input type="button" value="Clear" onclick="clearMatrix();stringFromMatrix()">
</div>
<div class="data">
<textarea v-model="encodedData" style="width:100%" v-on:change="VtoMatrix(encodedData)" rows=5>
</div>
</div>
</body>
</html>

View File

@@ -1,341 +1,341 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TS100 Translation Editor</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="translations_commons.js"></script>
<script src="translations_def.js"></script>
<script>
var app;
var defMap = {};
function save(){
saveJSON(app.current, "translation_"+app.current.languageCode.toLowerCase()+".json");
}
function view(){
showJSON(app.current, "translation_"+app.current.languageCode.toLowerCase()+".json");
}
function fileChanged(e) {
var target = e;
var id = target.id;
var file = target.files[0];
if (!file) {
return;
}
var fr = new FileReader();
fr.onload = function(e) {
try {
var json = JSON.parse(e.target.result);
} catch (ex) {
console.log(ex);
alert("Invalid JSON file: " + file.name);
return;
}
if (id == "referent-lang-file") {
if (checkTranslationFile(file.name)) {
app.referent = json;
app.meta.referentLoaded = true;
}
} else if (id == "current-lang-file") {
if (checkTranslationFile(file.name)) {
app.current = json;
app.meta.currentLoaded = true;
}
}
synchronizeData();
}
fr.readAsText(file);
}
function synchronizeData() {
app.obsolete = {};
copyMissing(app.def.messages, app.referent.messages, app.current.messages);
copyMissing(app.def.characters, app.referent.characters, app.current.characters);
copyMissing(app.def.menuGroups, app.referent.menuGroups, app.current.menuGroups);
copyMissing(app.def.menuOptions, app.referent.menuOptions, app.current.menuOptions);
}
/**
* Copy all missing properties from referent to current
* for each entry in definition
*/
function copyMissing(defList, referentMap, currentMap) {
if (!isDefined(defList) || !isDefined(referentMap) || !isDefined(currentMap)) {
return;
}
var len = defList.length;
for (var i = 0; i < len; i++) {
var id = defList[i].id;
if (!isDefined(referentMap[id])) {
referentMap[id] = '';
}
if (!isDefined(currentMap[id])) {
currentMap[id] = referentMap[id];
}
}
processObsolete(defList, currentMap);
}
// Passes through all entries from the given map.
// If a corresponding entry is not found in the defList, it is removed from the map, and added into the obsolete map.
function processObsolete(defList, map) {
// Index list to map for faster search
var defMap = copyArrayToMap(defList);
Object.keys(map).forEach(function(key) {
if (!isDefined(defMap[key])) {
app.obsolete[key] = { id : key, value : map[key]};
delete map[key];
}
});
}
function length(obj, mode) {
if (!isDefined(mode) || mode == 0) {
// return direct length
return obj.length;
} else if (mode == 1) {
// return length of text property
return obj.text.length;
} else if (mode == 2) {
// return the longest length in text2 array
return Math.max(isDefinedNN(obj.text2[0]) ? obj.text2[0].length : 0, isDefinedNN(obj.text2[1]) ? obj.text2[1].length : 0);
}
}
function getAttribute(obj, attribute, isDouble) {
var d = isDouble ? "2" : "";
var v = obj[attribute+d];
if (isDefined(v))
return v;
return obj[attribute];
}
function loaded() {
app = new Vue({
el : '#app',
data : {
meta : {
referentLoaded : false,
currentLoaded : false,
},
def : {
},
referent : {
messages : {}
},
current : {
loaded: false,
},
obsolete : {},
menuDouble : false
},
methods : {
validateInput: function(valMap, id, mode) {
var d = defMap[id];
var vLen = 0;
if (!isDefined(mode))
mode = 0;
try {
// Sum for complex length
for (var i = 0; i < d.lenSum.fields.length; i++) {
vLen += length(valMap[d.lenSum.fields[i]], mode);
}
d = d.lenSum;
} catch (e) {
// Single field length
vLen = length(valMap[id], mode);
}
var maxLen = getAttribute(d, 'maxLen', mode == 2);
var minLen = getAttribute(d, 'minLen', mode == 2);
var len = getAttribute(d, 'len', mode == 2);
if (isNumber(maxLen) && vLen > maxLen
|| isNumber(minLen) && vLen < minLen
|| isNumber(len) && vLen != len
) {
return "invalid";
}
},
constraintString: function(e, d) {
var str = "";
var delim = "";
var v;
if (!isDefined(d) || d == false) {
d = "";
} else {
d = "2";
}
if (isDefinedNN(e.lenSum)) {
str = "len("+(e.lenSum.fields+"").replace(/,/g," + ")+") -> ";
e = e.lenSum;
}
v = getAttribute(e, 'len', d);
if (isNumber(v)) {
str += delim + "len=" + v;
delim = " and ";
}
v = getAttribute(e, 'minLen', d);
if (isNumber(v)) {
str += delim + "len>=" + v;
delim = " and ";
}
v = getAttribute(e, 'maxLen', d);
if (isNumber(v)) {
str += delim + "len<=" + v;
delim = " and ";
}
return str;
}
}
});
app.def = def;
copyArrayToMap(app.def.messages, defMap);
copyArrayToMap(app.def.characters, defMap);
copyArrayToMap(app.def.menuGroups, defMap);
copyArrayToMap(app.def.menuOptions, defMap);
}
window.onload=loaded;
</script>
<link href="translations.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">
<h1>TS100 Translation Editor<span v-if="meta.currentLoaded"> - {{ current.languageLocalName }} [{{current.languageCode}}]</span></h1>
<table class="header data">
<tr>
<td class="label">Referent Language</td>
<td class="value">
<input type="file" id="referent-lang-file" onchange="fileChanged(this)" accept=".json">
<span class="selected" v-if="meta.referentLoaded">{{ referent.languageLocalName }} [{{referent.languageCode}}]</span>
</td>
</tr>
<tr v-if="meta.referentLoaded">
<td class="label">Current Language</td>
<td class="value">
<input type="file" id="current-lang-file" onchange="fileChanged(this)" accept=".json">
<span class="selected" v-if="meta.currentLoaded">{{ current.languageLocalName }} [{{current.languageCode}}]</span>
</td>
</tr>
<tr v-if="meta.currentLoaded">
<td class="label">Local Language Code</td>
<td class="value"><input type="text" v-model="current.languageCode" maxlength="8" v-on:change="current.languageCode=current.languageCode.toUpperCase()" class="short"></td>
</tr>
<tr v-if="meta.currentLoaded">
<td class="label">Local Language Name</td>
<td class="value"><input type="text" v-model="current.languageLocalName" class="short"></td>
</tr>
</table>
<div v-if="def.messages && referent.messages && current.messages">
<div class="footer">
<input type="button" value="Save" onclick="save()">
<input type="button" value="View" onclick="view()">
</div>
<div v-if="Object.keys(obsolete).length > 0">
<h2>Obsolete</h2>
<table class="data">
<tr v-for="entry in obsolete">
<td class="label"><div class="stringId">{{entry.id}}</div></td>
<td class="value"><div class="ref">{{entry.value}}</div></td>
</tr>
</table>
</div>
<h2>Messages and Strings</h2>
<table class="data">
<tr v-for="message in def.messages" v-bind:class="validateInput(current.messages, message.id)">
<td class="label"><div class="stringId">{{message.id}}</div></td>
<td class="value">
<div class="constraint">{{constraintString(message)}}</div>
<div class="ref">{{referent.messages[message.id]}}</div>
<div class="note" v-if="message.note">{{message.note}}</div>
<div class="tran"><input :id="'in_'+message.id" type="text" v-model="current.messages[message.id]" v-bind:class="{unchanged : current.messages[message.id] == referent.messages[message.id], empty : current.messages[message.id]==''}"></div>
</td>
</tr>
</table>
<h2>Characters</h2>
<table class="data">
<tr v-for="char in def.characters" v-bind:class="validateInput(current.characters, char.id)">
<td class="label"><div class="stringId">{{char.id}}</div></td>
<td class="value">
<div class="constraint">{{constraintString(char)}}</div>
<div class="ref">{{referent.characters[char.id]}}</div>
<div class="tran"><input type="text" v-model="current.characters[char.id]" v-bind:class="{unchanged : current.characters[char.id] == referent.characters[char.id], empty : current.characters[char.id].length != 1}"></div>
</td>
</tr>
</table>
<h2>Menu Groups</h2>
<table class="data">
<tr v-for="menu in def.menuGroups" v-bind:class="validateInput(current.menuGroups, menu.id, 2)">
<td class="label"><div class="stringId">{{menu.id}}</div></td>
<td class="value">
<div class="label">Menu Name</div>
<div class="constraint">{{constraintString(menu)}}</div>
<div class="ref">{{referent.menuGroups[menu.id].text2}}</div>
<div class="tran" v-bind:class="{unchanged : current.menuGroups[menu.id].text2[0] == referent.menuGroups[menu.id].text2[0] && current.menuGroups[menu.id].text2[1] == referent.menuGroups[menu.id].text2[1], empty : current.menuGroups[menu.id].text2[0] == '' || current.menuGroups[menu.id].text2[1] == ''}"><input type="text" v-model="current.menuGroups[menu.id].text2[0]"><input type="text" v-model="current.menuGroups[menu.id].text2[1]"></div>
<div class="label">Description</div>
<div class="ref">{{referent.menuGroups[menu.id].desc}}</div>
<div class="tran"><input type="text" v-model="current.menuGroups[menu.id].desc" v-bind:class="{unchanged : current.menuGroups[menu.id].desc == referent.menuGroups[menu.id].desc, empty : current.menuGroups[menu.id].desc == ''}"></div>
</td>
</tr>
</table>
<h2>Menu Options</h2>
<table class="data">
<tr>
<td class="label">Menu Type</td>
<td class="value">
<select v-model="current.menuDouble" v-on:change="current.menuDouble = current.menuDouble=='true'">
<option value="false">Single-Line</option>
<option value="true">Double-Line</option>
</select>
</td>
</tr>
<tr v-for="menu in def.menuOptions" v-bind:class="validateInput(current.menuOptions, menu.id, (current.menuDouble ? 2 : 1))">
<td class="label"><div class="stringId">{{menu.id}}</div></td>
<td class="value">
<div v-bind:class="{hidden : current.menuDouble}">
<div class="label">Menu Name (Single-Line)</div>
<div class="constraint">{{constraintString(menu, current.menuDouble)}}</div>
<div class="ref">{{referent.menuOptions[menu.id].text}}</div>
<div class="tran"><input type="text" v-model="current.menuOptions[menu.id].text" v-bind:class="{unchanged : current.menuOptions[menu.id].text == referent.menuOptions[menu.id].text, empty : current.menuOptions[menu.id].text == ''}"></div>
</div>
<div v-bind:class="{hidden : !current.menuDouble}">
<div class="label">Menu Name (Double-Line)</div>
<div class="constraint">{{constraintString(menu, current.menuDouble)}}</div>
<div class="ref">{{referent.menuOptions[menu.id].text2}}</div>
<div class="tran" v-bind:class="{unchanged : current.menuOptions[menu.id].text2[0] == referent.menuOptions[menu.id].text2[0] && current.menuOptions[menu.id].text2[1] == referent.menuOptions[menu.id].text2[1], empty : current.menuOptions[menu.id].text2[0] == '' || current.menuOptions[menu.id].text2[1] == ''}"><input type="text" v-model="current.menuOptions[menu.id].text2[0]"><input type="text" v-model="current.menuOptions[menu.id].text2[1]"></div>
</div>
<div class="label">Description</div>
<div class="ref">{{referent.menuOptions[menu.id].desc}}</div>
<div class="tran"><input type="text" v-model="current.menuOptions[menu.id].desc" v-bind:class="{unchanged : current.menuOptions[menu.id].desc == referent.menuOptions[menu.id].desc, empty : current.menuOptions[menu.id].desc == ''}"></div>
</td>
</tr>
</table>
<div class="footer">
<input type="button" value="Save" onclick="save()">
<input type="button" value="View" onclick="view()">
</div>
</div>
</div>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TS100 Translation Editor</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="translations_commons.js"></script>
<script src="translations_def.js"></script>
<script>
var app;
var defMap = {};
function save(){
saveJSON(app.current, "translation_"+app.current.languageCode.toLowerCase()+".json");
}
function view(){
showJSON(app.current, "translation_"+app.current.languageCode.toLowerCase()+".json");
}
function fileChanged(e) {
var target = e;
var id = target.id;
var file = target.files[0];
if (!file) {
return;
}
var fr = new FileReader();
fr.onload = function(e) {
try {
var json = JSON.parse(e.target.result);
} catch (ex) {
console.log(ex);
alert("Invalid JSON file: " + file.name);
return;
}
if (id == "referent-lang-file") {
if (checkTranslationFile(file.name)) {
app.referent = json;
app.meta.referentLoaded = true;
}
} else if (id == "current-lang-file") {
if (checkTranslationFile(file.name)) {
app.current = json;
app.meta.currentLoaded = true;
}
}
synchronizeData();
}
fr.readAsText(file);
}
function synchronizeData() {
app.obsolete = {};
copyMissing(app.def.messages, app.referent.messages, app.current.messages);
copyMissing(app.def.characters, app.referent.characters, app.current.characters);
copyMissing(app.def.menuGroups, app.referent.menuGroups, app.current.menuGroups);
copyMissing(app.def.menuOptions, app.referent.menuOptions, app.current.menuOptions);
}
/**
* Copy all missing properties from referent to current
* for each entry in definition
*/
function copyMissing(defList, referentMap, currentMap) {
if (!isDefined(defList) || !isDefined(referentMap) || !isDefined(currentMap)) {
return;
}
var len = defList.length;
for (var i = 0; i < len; i++) {
var id = defList[i].id;
if (!isDefined(referentMap[id])) {
referentMap[id] = '';
}
if (!isDefined(currentMap[id])) {
currentMap[id] = referentMap[id];
}
}
processObsolete(defList, currentMap);
}
// Passes through all entries from the given map.
// If a corresponding entry is not found in the defList, it is removed from the map, and added into the obsolete map.
function processObsolete(defList, map) {
// Index list to map for faster search
var defMap = copyArrayToMap(defList);
Object.keys(map).forEach(function(key) {
if (!isDefined(defMap[key])) {
app.obsolete[key] = { id : key, value : map[key]};
delete map[key];
}
});
}
function length(obj, mode) {
if (!isDefined(mode) || mode == 0) {
// return direct length
return obj.length;
} else if (mode == 1) {
// return length of text property
return obj.text.length;
} else if (mode == 2) {
// return the longest length in text2 array
return Math.max(isDefinedNN(obj.text2[0]) ? obj.text2[0].length : 0, isDefinedNN(obj.text2[1]) ? obj.text2[1].length : 0);
}
}
function getAttribute(obj, attribute, isDouble) {
var d = isDouble ? "2" : "";
var v = obj[attribute+d];
if (isDefined(v))
return v;
return obj[attribute];
}
function loaded() {
app = new Vue({
el : '#app',
data : {
meta : {
referentLoaded : false,
currentLoaded : false,
},
def : {
},
referent : {
messages : {}
},
current : {
loaded: false,
},
obsolete : {},
menuDouble : false
},
methods : {
validateInput: function(valMap, id, mode) {
var d = defMap[id];
var vLen = 0;
if (!isDefined(mode))
mode = 0;
try {
// Sum for complex length
for (var i = 0; i < d.lenSum.fields.length; i++) {
vLen += length(valMap[d.lenSum.fields[i]], mode);
}
d = d.lenSum;
} catch (e) {
// Single field length
vLen = length(valMap[id], mode);
}
var maxLen = getAttribute(d, 'maxLen', mode == 2);
var minLen = getAttribute(d, 'minLen', mode == 2);
var len = getAttribute(d, 'len', mode == 2);
if (isNumber(maxLen) && vLen > maxLen
|| isNumber(minLen) && vLen < minLen
|| isNumber(len) && vLen != len
) {
return "invalid";
}
},
constraintString: function(e, d) {
var str = "";
var delim = "";
var v;
if (!isDefined(d) || d == false) {
d = "";
} else {
d = "2";
}
if (isDefinedNN(e.lenSum)) {
str = "len("+(e.lenSum.fields+"").replace(/,/g," + ")+") -> ";
e = e.lenSum;
}
v = getAttribute(e, 'len', d);
if (isNumber(v)) {
str += delim + "len=" + v;
delim = " and ";
}
v = getAttribute(e, 'minLen', d);
if (isNumber(v)) {
str += delim + "len>=" + v;
delim = " and ";
}
v = getAttribute(e, 'maxLen', d);
if (isNumber(v)) {
str += delim + "len<=" + v;
delim = " and ";
}
return str;
}
}
});
app.def = def;
copyArrayToMap(app.def.messages, defMap);
copyArrayToMap(app.def.characters, defMap);
copyArrayToMap(app.def.menuGroups, defMap);
copyArrayToMap(app.def.menuOptions, defMap);
}
window.onload=loaded;
</script>
<link href="translations.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">
<h1>TS100 Translation Editor<span v-if="meta.currentLoaded"> - {{ current.languageLocalName }} [{{current.languageCode}}]</span></h1>
<table class="header data">
<tr>
<td class="label">Referent Language</td>
<td class="value">
<input type="file" id="referent-lang-file" onchange="fileChanged(this)" accept=".json">
<span class="selected" v-if="meta.referentLoaded">{{ referent.languageLocalName }} [{{referent.languageCode}}]</span>
</td>
</tr>
<tr v-if="meta.referentLoaded">
<td class="label">Current Language</td>
<td class="value">
<input type="file" id="current-lang-file" onchange="fileChanged(this)" accept=".json">
<span class="selected" v-if="meta.currentLoaded">{{ current.languageLocalName }} [{{current.languageCode}}]</span>
</td>
</tr>
<tr v-if="meta.currentLoaded">
<td class="label">Local Language Code</td>
<td class="value"><input type="text" v-model="current.languageCode" maxlength="8" v-on:change="current.languageCode=current.languageCode.toUpperCase()" class="short"></td>
</tr>
<tr v-if="meta.currentLoaded">
<td class="label">Local Language Name</td>
<td class="value"><input type="text" v-model="current.languageLocalName" class="short"></td>
</tr>
</table>
<div v-if="def.messages && referent.messages && current.messages">
<div class="footer">
<input type="button" value="Save" onclick="save()">
<input type="button" value="View" onclick="view()">
</div>
<div v-if="Object.keys(obsolete).length > 0">
<h2>Obsolete</h2>
<table class="data">
<tr v-for="entry in obsolete">
<td class="label"><div class="stringId">{{entry.id}}</div></td>
<td class="value"><div class="ref">{{entry.value}}</div></td>
</tr>
</table>
</div>
<h2>Messages and Strings</h2>
<table class="data">
<tr v-for="message in def.messages" v-bind:class="validateInput(current.messages, message.id)">
<td class="label"><div class="stringId">{{message.id}}</div></td>
<td class="value">
<div class="constraint">{{constraintString(message)}}</div>
<div class="ref">{{referent.messages[message.id]}}</div>
<div class="note" v-if="message.note">{{message.note}}</div>
<div class="tran"><input :id="'in_'+message.id" type="text" v-model="current.messages[message.id]" v-bind:class="{unchanged : current.messages[message.id] == referent.messages[message.id], empty : current.messages[message.id]==''}"></div>
</td>
</tr>
</table>
<h2>Characters</h2>
<table class="data">
<tr v-for="char in def.characters" v-bind:class="validateInput(current.characters, char.id)">
<td class="label"><div class="stringId">{{char.id}}</div></td>
<td class="value">
<div class="constraint">{{constraintString(char)}}</div>
<div class="ref">{{referent.characters[char.id]}}</div>
<div class="tran"><input type="text" v-model="current.characters[char.id]" v-bind:class="{unchanged : current.characters[char.id] == referent.characters[char.id], empty : current.characters[char.id].length != 1}"></div>
</td>
</tr>
</table>
<h2>Menu Groups</h2>
<table class="data">
<tr v-for="menu in def.menuGroups" v-bind:class="validateInput(current.menuGroups, menu.id, 2)">
<td class="label"><div class="stringId">{{menu.id}}</div></td>
<td class="value">
<div class="label">Menu Name</div>
<div class="constraint">{{constraintString(menu)}}</div>
<div class="ref">{{referent.menuGroups[menu.id].text2}}</div>
<div class="tran" v-bind:class="{unchanged : current.menuGroups[menu.id].text2[0] == referent.menuGroups[menu.id].text2[0] && current.menuGroups[menu.id].text2[1] == referent.menuGroups[menu.id].text2[1], empty : current.menuGroups[menu.id].text2[0] == '' || current.menuGroups[menu.id].text2[1] == ''}"><input type="text" v-model="current.menuGroups[menu.id].text2[0]"><input type="text" v-model="current.menuGroups[menu.id].text2[1]"></div>
<div class="label">Description</div>
<div class="ref">{{referent.menuGroups[menu.id].desc}}</div>
<div class="tran"><input type="text" v-model="current.menuGroups[menu.id].desc" v-bind:class="{unchanged : current.menuGroups[menu.id].desc == referent.menuGroups[menu.id].desc, empty : current.menuGroups[menu.id].desc == ''}"></div>
</td>
</tr>
</table>
<h2>Menu Options</h2>
<table class="data">
<tr>
<td class="label">Menu Type</td>
<td class="value">
<select v-model="current.menuDouble" v-on:change="current.menuDouble = current.menuDouble=='true'">
<option value="false">Single-Line</option>
<option value="true">Double-Line</option>
</select>
</td>
</tr>
<tr v-for="menu in def.menuOptions" v-bind:class="validateInput(current.menuOptions, menu.id, (current.menuDouble ? 2 : 1))">
<td class="label"><div class="stringId">{{menu.id}}</div></td>
<td class="value">
<div v-bind:class="{hidden : current.menuDouble}">
<div class="label">Menu Name (Single-Line)</div>
<div class="constraint">{{constraintString(menu, current.menuDouble)}}</div>
<div class="ref">{{referent.menuOptions[menu.id].text}}</div>
<div class="tran"><input type="text" v-model="current.menuOptions[menu.id].text" v-bind:class="{unchanged : current.menuOptions[menu.id].text == referent.menuOptions[menu.id].text, empty : current.menuOptions[menu.id].text == ''}"></div>
</div>
<div v-bind:class="{hidden : !current.menuDouble}">
<div class="label">Menu Name (Double-Line)</div>
<div class="constraint">{{constraintString(menu, current.menuDouble)}}</div>
<div class="ref">{{referent.menuOptions[menu.id].text2}}</div>
<div class="tran" v-bind:class="{unchanged : current.menuOptions[menu.id].text2[0] == referent.menuOptions[menu.id].text2[0] && current.menuOptions[menu.id].text2[1] == referent.menuOptions[menu.id].text2[1], empty : current.menuOptions[menu.id].text2[0] == '' || current.menuOptions[menu.id].text2[1] == ''}"><input type="text" v-model="current.menuOptions[menu.id].text2[0]"><input type="text" v-model="current.menuOptions[menu.id].text2[1]"></div>
</div>
<div class="label">Description</div>
<div class="ref">{{referent.menuOptions[menu.id].desc}}</div>
<div class="tran"><input type="text" v-model="current.menuOptions[menu.id].desc" v-bind:class="{unchanged : current.menuOptions[menu.id].desc == referent.menuOptions[menu.id].desc, empty : current.menuOptions[menu.id].desc == ''}"></div>
</td>
</tr>
</table>
<div class="footer">
<input type="button" value="Save" onclick="save()">
<input type="button" value="View" onclick="view()">
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,317 +1,317 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TS100 Translation Parser</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="translations_commons.js"></script>
<script src="translations_def.js"></script>
<script>
var app;
var defMap = {};
var langMap = {};
var lang;
var defMsgMap;
var defCharMap;
var defGrpMap;
var defOptMap;
function save(langCode){
saveJSON(langMap[langCode], "translation_"+langCode.toLowerCase()+".json");
}
function view(langCode){
showJSON(langMap[langCode], "translation_"+langCode.toLowerCase()+".json");
}
function translationFileSelected(e) {
var target = e;
var id = target.id;
var file = target.files[0];
if (!file) {
return;
}
var fr = new FileReader();
fr.onload = function(e) {
parseTranslationFile(file.name, e.target.result);
}
fr.readAsText(file);
}
function parseTranslationFile(name, src) {
// remove multiline comments
src = src.replace(/\/\*[\s\S.]*?\*\//mg, "");
// remove single-line comments
src = src.replace(/\/\/.*/mg, "");
// remove empty lines
src = src.replace(/^\s*\n/gm, "");
var langCode = "";
var srcLines = src.split("\n");
var reMessage = /const\s+char\s*\*\s+([\w\d]+)\s*=\s*"(.*)"/;
var reSettingsDescStart = /const\s+char\s*\*\s+SettingsDescriptions\[/;
var reSettingsNamesStart = /const\s+char\s*\*\s+SettingsShortNames\[/;
var reSettingsMenuDescStart = /const\s+char\s*\*\s+SettingsMenuEntriesDescriptions\[/;
var reChar = /const\s+char\s+([\w\d]+)\s*=\s*'(\w)'/;
var reMenuMode = /SettingsShortNameType\s*=\s*SHORT_NAME_(\w+)_LINE/;
var reMenuStart = /\s*const\s+char\s*\*\s+SettingsMenuEntries\[/;
// var reString = /^\s*"(.*)"/;
var reString = /"(.*)"/;
var reSingleLine = /{\s*"(.*)"\s*}/;
var reDoubleLine = /{\s*"(.*)"\s*,\s*"(.*)"\s*}/;
var mode = '';
var entryIndex = 0;
for (var li = 0; li < srcLines.length; li++) {
// trim lines
line = srcLines[li] = srcLines[li].trim();
// if entering a new lang block
if (startsWith(line, "#ifdef LANG_")) {
mode = 'new-language';
langCode = line.substring(12);
lang = langMap[langCode];
// use existing or instantiate new
if (!isDefined(lang)) {
lang = {
languageCode: langCode,
messages: {},
characters: {},
menuDouble : false,
menuGroups: {},
menuOptions: {}
};
langMap[langCode] = lang;
app.languages[app.languages.length] = langCode;
}
entryIndex = 0;
continue;
}
// Menu type
reMenuMode.lastIndex = 0;
match = reMenuMode.exec(line);
if (match) {
lang.menuDouble = match[1] == 'DOUBLE';
entryIndex = 0;
continue;
}
// Messages
reMessage.lastIndex = 0;
match = reMessage.exec(line);
if (match) {
lang.messages[match[1]] = xunescape(match[2]);
entryIndex = 0;
continue;
}
// Chars descriptions
reChar.lastIndex = 0;
match = reChar.exec(line);
if (match) {
// found description block start
mode = 'char';
lang.characters[match[1]] = xunescape(match[2]);
entryIndex = 0;
continue;
}
// Settings descriptions
reSettingsDescStart.lastIndex = 0;
match = reSettingsDescStart.exec(line);
if (match) {
// found description block start
mode = 'settingsDesc';
entryIndex = 0;
continue;
}
reSettingsNamesStart.lastIndex = 0;
match = reSettingsNamesStart.exec(line);
if (match) {
// found description block start
mode = 'settingsNames';
entryIndex = 0;
continue;
}
reMenuStart.lastIndex = 0;
match = reMenuStart.exec(line);
if (match) {
// found description block start
mode = 'menu';
entryIndex = 0;
continue;
}
reSettingsMenuDescStart.lastIndex = 0;
match = reSettingsMenuDescStart.exec(line);
if (match) {
// found description block start
mode = 'menuDesc';
entryIndex = 0;
continue;
}
if (mode == 'menu') {
// processing menu group names
reString.lastIndex = 0;
match = reString.exec(line);
if (match) {
// found description string
var entry = getMenuGroup(entryIndex);
var m = match[1].split("\\n");
entry.text2[0] = xunescape(m[0]);
entry.text2[1] = xunescape(m[1]);
entryIndex++;
}
} else if (mode == 'menuDesc') {
// processing menu group descriptions
reString.lastIndex = 0;
match = reString.exec(line);
if (match) {
// found description string
var entry = getMenuGroup(entryIndex);
entry.desc = xunescape(match[1]);
entryIndex++;
}
} else if (mode == 'settingsDesc') {
// processing option descriptions
reString.lastIndex = 0;
match = reString.exec(line);
if (match) {
// found description string
var entry = getMenuOption(entryIndex);
entry.desc = xunescape(match[1]);
entryIndex++;
}
} else if (mode == 'settingsNames') {
reDoubleLine.lastIndex = 0;
match = reDoubleLine.exec(line);
if (match) {
var entry = getMenuOption(entryIndex);
entry.text2[0] = xunescape(match[1]);
entry.text2[1] = xunescape(match[2]);
entryIndex++;
} else {
reSingleLine.lastIndex = 0;
match = reSingleLine.exec(line);
if (match) {
var entry = getMenuOption(entryIndex);
entry.text = xunescape(match[1]);
entryIndex++;
}
}
}
}
app.done = 1;
}
function getMenuOption(entryIndex) {
var optionDef = def.menuOptions[entryIndex];
if (!isDefined(optionDef)) {
var s = "Could not find menu option with index "+entryIndex;
alert(s);
throw s;
}
var id = optionDef.id;
var entry = lang.menuOptions[id];
if (!isDefined(entry)) {
entry =
{
"text": "",
"text2": ["", ""],
"desc": ""
}
lang.menuOptions[id] = entry;
}
return entry;
}
function getMenuGroup(entryIndex) {
var optionDef = def.menuGroups[entryIndex];
if (!isDefined(optionDef)) {
var s = "Could not find menu group with index "+entryIndex;
alert(s);
throw s;
}
var id = optionDef.id;
var entry = lang.menuGroups[id];
if (!isDefined(entry)) {
entry =
{
"text2": ["", ""],
"desc": ""
}
lang.menuGroups[id] = entry;
}
return entry;
}
function markSaved(lang) {
document.getElementById("row_"+lang).classList.add("saved");
}
function loaded() {
app = new Vue({
el : '#app',
data : {
languages: [],
done : false,
def : {
}
},
methods : {
vSave : function(lang) {
save(lang);
markSaved(lang);
},
vView : function(lang) {
view(lang);
markSaved(lang);
}
}
});
app.def = def;
defMsgMap = copyArrayToMap(app.def.messages);
defCharMap = copyArrayToMap(app.def.characters);
defGrpMap = copyArrayToMap(app.def.menuGroups);
defOptMap = copyArrayToMap(app.def.menuOptions);
}
window.onload=loaded;
</script>
<link href="translations.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">
<h1>TS100 Translation Parser</h1>
<table class="header data">
<tr>
<td class="label">Translation.cpp</td>
<td class="value">
<input type="file" id="translation-cpp-file" onchange="translationFileSelected(this)" accept=".cpp">
</td>
</tr>
</table>
<div class="data" v-if="done">
<div class="value" v-for="lang in languages" :id="'row_'+lang">
<input type="button" :value="'Save '+lang" v-on:click="vSave(lang)">
<input type="button" :value="'View '+lang" v-on:click="vView(lang)">
</div>
</div>
</div>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TS100 Translation Parser</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="translations_commons.js"></script>
<script src="translations_def.js"></script>
<script>
var app;
var defMap = {};
var langMap = {};
var lang;
var defMsgMap;
var defCharMap;
var defGrpMap;
var defOptMap;
function save(langCode){
saveJSON(langMap[langCode], "translation_"+langCode.toLowerCase()+".json");
}
function view(langCode){
showJSON(langMap[langCode], "translation_"+langCode.toLowerCase()+".json");
}
function translationFileSelected(e) {
var target = e;
var id = target.id;
var file = target.files[0];
if (!file) {
return;
}
var fr = new FileReader();
fr.onload = function(e) {
parseTranslationFile(file.name, e.target.result);
}
fr.readAsText(file);
}
function parseTranslationFile(name, src) {
// remove multiline comments
src = src.replace(/\/\*[\s\S.]*?\*\//mg, "");
// remove single-line comments
src = src.replace(/\/\/.*/mg, "");
// remove empty lines
src = src.replace(/^\s*\n/gm, "");
var langCode = "";
var srcLines = src.split("\n");
var reMessage = /const\s+char\s*\*\s+([\w\d]+)\s*=\s*"(.*)"/;
var reSettingsDescStart = /const\s+char\s*\*\s+SettingsDescriptions\[/;
var reSettingsNamesStart = /const\s+char\s*\*\s+SettingsShortNames\[/;
var reSettingsMenuDescStart = /const\s+char\s*\*\s+SettingsMenuEntriesDescriptions\[/;
var reChar = /const\s+char\s+([\w\d]+)\s*=\s*'(\w)'/;
var reMenuMode = /SettingsShortNameType\s*=\s*SHORT_NAME_(\w+)_LINE/;
var reMenuStart = /\s*const\s+char\s*\*\s+SettingsMenuEntries\[/;
// var reString = /^\s*"(.*)"/;
var reString = /"(.*)"/;
var reSingleLine = /{\s*"(.*)"\s*}/;
var reDoubleLine = /{\s*"(.*)"\s*,\s*"(.*)"\s*}/;
var mode = '';
var entryIndex = 0;
for (var li = 0; li < srcLines.length; li++) {
// trim lines
line = srcLines[li] = srcLines[li].trim();
// if entering a new lang block
if (startsWith(line, "#ifdef LANG_")) {
mode = 'new-language';
langCode = line.substring(12);
lang = langMap[langCode];
// use existing or instantiate new
if (!isDefined(lang)) {
lang = {
languageCode: langCode,
messages: {},
characters: {},
menuDouble : false,
menuGroups: {},
menuOptions: {}
};
langMap[langCode] = lang;
app.languages[app.languages.length] = langCode;
}
entryIndex = 0;
continue;
}
// Menu type
reMenuMode.lastIndex = 0;
match = reMenuMode.exec(line);
if (match) {
lang.menuDouble = match[1] == 'DOUBLE';
entryIndex = 0;
continue;
}
// Messages
reMessage.lastIndex = 0;
match = reMessage.exec(line);
if (match) {
lang.messages[match[1]] = xunescape(match[2]);
entryIndex = 0;
continue;
}
// Chars descriptions
reChar.lastIndex = 0;
match = reChar.exec(line);
if (match) {
// found description block start
mode = 'char';
lang.characters[match[1]] = xunescape(match[2]);
entryIndex = 0;
continue;
}
// Settings descriptions
reSettingsDescStart.lastIndex = 0;
match = reSettingsDescStart.exec(line);
if (match) {
// found description block start
mode = 'settingsDesc';
entryIndex = 0;
continue;
}
reSettingsNamesStart.lastIndex = 0;
match = reSettingsNamesStart.exec(line);
if (match) {
// found description block start
mode = 'settingsNames';
entryIndex = 0;
continue;
}
reMenuStart.lastIndex = 0;
match = reMenuStart.exec(line);
if (match) {
// found description block start
mode = 'menu';
entryIndex = 0;
continue;
}
reSettingsMenuDescStart.lastIndex = 0;
match = reSettingsMenuDescStart.exec(line);
if (match) {
// found description block start
mode = 'menuDesc';
entryIndex = 0;
continue;
}
if (mode == 'menu') {
// processing menu group names
reString.lastIndex = 0;
match = reString.exec(line);
if (match) {
// found description string
var entry = getMenuGroup(entryIndex);
var m = match[1].split("\\n");
entry.text2[0] = xunescape(m[0]);
entry.text2[1] = xunescape(m[1]);
entryIndex++;
}
} else if (mode == 'menuDesc') {
// processing menu group descriptions
reString.lastIndex = 0;
match = reString.exec(line);
if (match) {
// found description string
var entry = getMenuGroup(entryIndex);
entry.desc = xunescape(match[1]);
entryIndex++;
}
} else if (mode == 'settingsDesc') {
// processing option descriptions
reString.lastIndex = 0;
match = reString.exec(line);
if (match) {
// found description string
var entry = getMenuOption(entryIndex);
entry.desc = xunescape(match[1]);
entryIndex++;
}
} else if (mode == 'settingsNames') {
reDoubleLine.lastIndex = 0;
match = reDoubleLine.exec(line);
if (match) {
var entry = getMenuOption(entryIndex);
entry.text2[0] = xunescape(match[1]);
entry.text2[1] = xunescape(match[2]);
entryIndex++;
} else {
reSingleLine.lastIndex = 0;
match = reSingleLine.exec(line);
if (match) {
var entry = getMenuOption(entryIndex);
entry.text = xunescape(match[1]);
entryIndex++;
}
}
}
}
app.done = 1;
}
function getMenuOption(entryIndex) {
var optionDef = def.menuOptions[entryIndex];
if (!isDefined(optionDef)) {
var s = "Could not find menu option with index "+entryIndex;
alert(s);
throw s;
}
var id = optionDef.id;
var entry = lang.menuOptions[id];
if (!isDefined(entry)) {
entry =
{
"text": "",
"text2": ["", ""],
"desc": ""
}
lang.menuOptions[id] = entry;
}
return entry;
}
function getMenuGroup(entryIndex) {
var optionDef = def.menuGroups[entryIndex];
if (!isDefined(optionDef)) {
var s = "Could not find menu group with index "+entryIndex;
alert(s);
throw s;
}
var id = optionDef.id;
var entry = lang.menuGroups[id];
if (!isDefined(entry)) {
entry =
{
"text2": ["", ""],
"desc": ""
}
lang.menuGroups[id] = entry;
}
return entry;
}
function markSaved(lang) {
document.getElementById("row_"+lang).classList.add("saved");
}
function loaded() {
app = new Vue({
el : '#app',
data : {
languages: [],
done : false,
def : {
}
},
methods : {
vSave : function(lang) {
save(lang);
markSaved(lang);
},
vView : function(lang) {
view(lang);
markSaved(lang);
}
}
});
app.def = def;
defMsgMap = copyArrayToMap(app.def.messages);
defCharMap = copyArrayToMap(app.def.characters);
defGrpMap = copyArrayToMap(app.def.menuGroups);
defOptMap = copyArrayToMap(app.def.menuOptions);
}
window.onload=loaded;
</script>
<link href="translations.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">
<h1>TS100 Translation Parser</h1>
<table class="header data">
<tr>
<td class="label">Translation.cpp</td>
<td class="value">
<input type="file" id="translation-cpp-file" onchange="translationFileSelected(this)" accept=".cpp">
</td>
</tr>
</table>
<div class="data" v-if="done">
<div class="value" v-for="lang in languages" :id="'row_'+lang">
<input type="button" :value="'Save '+lang" v-on:click="vSave(lang)">
<input type="button" :value="'View '+lang" v-on:click="vView(lang)">
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,110 +1,110 @@
* {
font-family: sans-serif;
}
h1 {
color: #66A;
}
h1 span {
color: #000;
}
table.data, div.data {
border: 1px solid #888;
width: 100%;
}
div.value {
margin: 2px;
}
.header input {
width: 50% !important;
}
input.short {
width: 150px !important;
font-family: monospace;
}
.header .selected {
display: block;
font-family: monospace;
}
.stringId {
font-family: monospace;
font-weight: bold;
}
.label {
background-color: #ddf;
padding: 0.5em;
width: 20%;
color: #66A;
}
.value {
background-color: #eef;
}
.value .label {
width: 99%;
font-weight: bold;
}
td input {
width: 99%;
}
input.unchanged, input.empty, .unchanged input, .empty input {
background-color: #ffc;
}
input.invalid, .invalid input {
background-color: #f99;
}
.ref, .tran input {
font-family: monospace;
}
.ref::before, .ref::after {
color: #99F;
font-family: sans-serif;
content: "\"";
}
.note {
color : #66A;
font-style: italic;
}
div.constraint {
float: right;
display: inline-block;
font-family: monospace;
color: #66A;
}
.invalid .constraint {
color: #f00;
}
.value {
font-size: smaller;
}
.hidden {
display: none;
}
.footer {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.saved {
background-color: #ddd;
* {
font-family: sans-serif;
}
h1 {
color: #66A;
}
h1 span {
color: #000;
}
table.data, div.data {
border: 1px solid #888;
width: 100%;
}
div.value {
margin: 2px;
}
.header input {
width: 50% !important;
}
input.short {
width: 150px !important;
font-family: monospace;
}
.header .selected {
display: block;
font-family: monospace;
}
.stringId {
font-family: monospace;
font-weight: bold;
}
.label {
background-color: #ddf;
padding: 0.5em;
width: 20%;
color: #66A;
}
.value {
background-color: #eef;
}
.value .label {
width: 99%;
font-weight: bold;
}
td input {
width: 99%;
}
input.unchanged, input.empty, .unchanged input, .empty input {
background-color: #ffc;
}
input.invalid, .invalid input {
background-color: #f99;
}
.ref, .tran input {
font-family: monospace;
}
.ref::before, .ref::after {
color: #99F;
font-family: sans-serif;
content: "\"";
}
.note {
color : #66A;
font-style: italic;
}
div.constraint {
float: right;
display: inline-block;
font-family: monospace;
color: #66A;
}
.invalid .constraint {
color: #f00;
}
.value {
font-size: smaller;
}
.hidden {
display: none;
}
.footer {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.saved {
background-color: #ddd;
}

View File

@@ -1,68 +1,68 @@
function saveToFile(txt, filename){
var a = document.createElement('a');
a.setAttribute("style", "display: none");
document.body.appendChild(a);
a.setAttribute('href', 'data:application/json;charset=utf-8,'+encodeURIComponent(txt));
a.setAttribute('download', filename);
a.click();
document.body.removeChild(a);
}
function saveJSON(obj, filename){
var txt = JSON.stringify(obj,"", "\t");
saveToFile(txt, filename);
}
function showJSON(obj, filename) {
var txt = JSON.stringify(obj,"", "\t");
var a = window.open("", "_blank").document;
a.write("<PLAINTEXT>");
a.write(txt);
a.title = filename;
}
function startsWith(str, prefix) {
return str.substring(0, prefix.length) == prefix;
}
function endsWith(str, suffix) {
return str.substring(str.length-suffix.length) == suffix;
}
function isDefined(obj) {
return typeof obj !== 'undefined';
}
function isNumber(obj) {
return isDefined(obj) && obj != null;
}
function isDefinedNN(obj) {
return isDefined(obj) && obj != null;
}
function padLeft(str, chr, maxLen) {
str = str.toString();
return str.length < maxLen ? padLeft(chr + str, chr, maxLen) : str;
}
// sourceArray contains a list of objects that have a property "id". This methods makes a map using the "id" as a key, and the owning object as a value.
function copyArrayToMap(sourceArray, map) {
if (!isDefined(map)) {
map = {};
}
var len = sourceArray.length;
for (var i = 0; i<len; i++) {
var v = sourceArray[i];
map[v.id] = v;
}
return map;
}
function checkTranslationFile(fileName) {
return startsWith(fileName, "translation_") && endsWith(fileName, ".json") || confirm("Are you sure that you want to use "+fileName+" instead of a translation_*.json file?");
}
function xunescape(str) {
return str.replace(/\\/g, "");
}
function saveToFile(txt, filename){
var a = document.createElement('a');
a.setAttribute("style", "display: none");
document.body.appendChild(a);
a.setAttribute('href', 'data:application/json;charset=utf-8,'+encodeURIComponent(txt));
a.setAttribute('download', filename);
a.click();
document.body.removeChild(a);
}
function saveJSON(obj, filename){
var txt = JSON.stringify(obj,"", "\t");
saveToFile(txt, filename);
}
function showJSON(obj, filename) {
var txt = JSON.stringify(obj,"", "\t");
var a = window.open("", "_blank").document;
a.write("<PLAINTEXT>");
a.write(txt);
a.title = filename;
}
function startsWith(str, prefix) {
return str.substring(0, prefix.length) == prefix;
}
function endsWith(str, suffix) {
return str.substring(str.length-suffix.length) == suffix;
}
function isDefined(obj) {
return typeof obj !== 'undefined';
}
function isNumber(obj) {
return isDefined(obj) && obj != null;
}
function isDefinedNN(obj) {
return isDefined(obj) && obj != null;
}
function padLeft(str, chr, maxLen) {
str = str.toString();
return str.length < maxLen ? padLeft(chr + str, chr, maxLen) : str;
}
// sourceArray contains a list of objects that have a property "id". This methods makes a map using the "id" as a key, and the owning object as a value.
function copyArrayToMap(sourceArray, map) {
if (!isDefined(map)) {
map = {};
}
var len = sourceArray.length;
for (var i = 0; i<len; i++) {
var v = sourceArray[i];
map[v.id] = v;
}
return map;
}
function checkTranslationFile(fileName) {
return startsWith(fileName, "translation_") && endsWith(fileName, ".json") || confirm("Are you sure that you want to use "+fileName+" instead of a translation_*.json file?");
}
function xunescape(str) {
return str.replace(/\\/g, "");
}

View File

@@ -1,205 +1,205 @@
var def =
{
"messages": [
{
"id": "SettingsCalibrationWarning"
},
{
"id": "SettingsResetWarning"
},
{
"id": "UVLOWarningString",
"maxLen": 8
},
{
"id": "UndervoltageString",
"maxLen": 16
},
{
"id": "InputVoltageString",
"maxLen": 11,
"note": "Preferably end with a space"
},
{
"id": "WarningTipTempString",
"maxLen": 12,
"note": "Preferably end with a space"
},
{
"id": "BadTipString",
"maxLen": 8
},
{
"id": "SleepingSimpleString",
"maxLen": 4
},
{
"id": "SleepingAdvancedString",
"maxLen": 16
},
{
"id": "WarningSimpleString",
"maxLen": 4
},
{
"id": "WarningAdvancedString",
"maxLen": 16
},
{
"id": "SleepingTipAdvancedString",
"maxLen": 6
},
{
"id": "IdleTipString",
"lenSum":
{
"fields": ["IdleTipString", "IdleSetString"],
"maxLen": 10
}
},
{
"id": "IdleSetString",
"lenSum":
{
"fields": ["IdleTipString", "IdleSetString"],
"maxLen": 10
},
"note": "Preferably start with a space"
},
{
"id": "TipDisconnectedString",
"maxLen": 16
},
{
"id" :"SolderingAdvancedPowerPrompt",
"maxLen": null
}
],
"characters": [
{
"id": "SettingRightChar",
"len": 1
},
{
"id": "SettingLeftChar",
"len": 1
},
{
"id": "SettingAutoChar",
"len": 1
},
{
"id": "SettingFastChar",
"len": 1
},
{
"id": "SettingSlowChar",
"len": 1
}
],
"menuGroups": [
{
"id": "SolderingMenu",
"maxLen": 11
},
{
"id": "PowerSavingMenu",
"maxLen": 11
},
{
"id": "UIMenu",
"maxLen": 11
},
{
"id": "AdvancedMenu",
"maxLen": 11
}
],
"menuOptions": [
{
"id": "PowerSource",
"maxLen": 5,
"maxLen2": 11
},
{
"id": "SleepTemperature",
"maxLen": 4,
"maxLen2": 9
},
{
"id": "SleepTimeout",
"maxLen": 4,
"maxLen2": 9
},
{
"id": "ShutdownTimeout",
"maxLen": 5,
"maxLen2": 11
},
{
"id": "MotionSensitivity",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "TemperatureUnit",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "AdvancedIdle",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "DisplayRotation",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "BoostEnabled",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "BoostTemperature",
"maxLen": 4,
"maxLen2": 9
},
{
"id": "AutoStart",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "CooldownBlink",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "TemperatureCalibration",
"maxLen": 8,
"maxLen2": 16
},
{
"id": "SettingsReset",
"maxLen": 8,
"maxLen2": 16
},
{
"id": "VoltageCalibration",
"maxLen": 8,
"maxLen2": 16
},
{
"id": "AdvancedSoldering",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "ScrollingSpeed",
"maxLen": 6,
"maxLen2": 11
}
]
var def =
{
"messages": [
{
"id": "SettingsCalibrationWarning"
},
{
"id": "SettingsResetWarning"
},
{
"id": "UVLOWarningString",
"maxLen": 8
},
{
"id": "UndervoltageString",
"maxLen": 16
},
{
"id": "InputVoltageString",
"maxLen": 11,
"note": "Preferably end with a space"
},
{
"id": "WarningTipTempString",
"maxLen": 12,
"note": "Preferably end with a space"
},
{
"id": "BadTipString",
"maxLen": 8
},
{
"id": "SleepingSimpleString",
"maxLen": 4
},
{
"id": "SleepingAdvancedString",
"maxLen": 16
},
{
"id": "WarningSimpleString",
"maxLen": 4
},
{
"id": "WarningAdvancedString",
"maxLen": 16
},
{
"id": "SleepingTipAdvancedString",
"maxLen": 6
},
{
"id": "IdleTipString",
"lenSum":
{
"fields": ["IdleTipString", "IdleSetString"],
"maxLen": 10
}
},
{
"id": "IdleSetString",
"lenSum":
{
"fields": ["IdleTipString", "IdleSetString"],
"maxLen": 10
},
"note": "Preferably start with a space"
},
{
"id": "TipDisconnectedString",
"maxLen": 16
},
{
"id" :"SolderingAdvancedPowerPrompt",
"maxLen": null
}
],
"characters": [
{
"id": "SettingRightChar",
"len": 1
},
{
"id": "SettingLeftChar",
"len": 1
},
{
"id": "SettingAutoChar",
"len": 1
},
{
"id": "SettingFastChar",
"len": 1
},
{
"id": "SettingSlowChar",
"len": 1
}
],
"menuGroups": [
{
"id": "SolderingMenu",
"maxLen": 11
},
{
"id": "PowerSavingMenu",
"maxLen": 11
},
{
"id": "UIMenu",
"maxLen": 11
},
{
"id": "AdvancedMenu",
"maxLen": 11
}
],
"menuOptions": [
{
"id": "PowerSource",
"maxLen": 5,
"maxLen2": 11
},
{
"id": "SleepTemperature",
"maxLen": 4,
"maxLen2": 9
},
{
"id": "SleepTimeout",
"maxLen": 4,
"maxLen2": 9
},
{
"id": "ShutdownTimeout",
"maxLen": 5,
"maxLen2": 11
},
{
"id": "MotionSensitivity",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "TemperatureUnit",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "AdvancedIdle",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "DisplayRotation",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "BoostEnabled",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "BoostTemperature",
"maxLen": 4,
"maxLen2": 9
},
{
"id": "AutoStart",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "CooldownBlink",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "TemperatureCalibration",
"maxLen": 8,
"maxLen2": 16
},
{
"id": "SettingsReset",
"maxLen": 8,
"maxLen2": 16
},
{
"id": "VoltageCalibration",
"maxLen": 8,
"maxLen2": 16
},
{
"id": "AdvancedSoldering",
"maxLen": 6,
"maxLen2": 13
},
{
"id": "ScrollingSpeed",
"maxLen": 6,
"maxLen2": 11
}
]
}

View File

@@ -1085,7 +1085,7 @@ __weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
* @arg TIM_CHANNEL_4: TIM Channel 4 selected
* @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 */
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
* @retval HAL status
*/
HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_StatusTypeDef __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
{
/* Check the parameters */
assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));

View File

@@ -11,7 +11,7 @@
#define SETTINGS_H_
#include <stdint.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
@@ -38,6 +38,8 @@ typedef struct {
uint8_t PID_I; //PID I Term
uint8_t PID_D; //PID D Term
uint8_t version; //Used to track if a reset is needed on firmware upgrade
uint8_t customTipGain; // Tip gain value if custom tuned, or 0 if using a tipType param
uint8_t tipType;
uint32_t padding; //This is here for in case we are not an even divisor so that nothing gets cut off
} systemSettingsType;

View File

@@ -15,6 +15,7 @@ extern "C" {
#include "stm32f1xx_hal.h"
extern ADC_HandleTypeDef hadc1;
extern ADC_HandleTypeDef hadc2;
extern DMA_HandleTypeDef hdma_adc1;
extern DMA_HandleTypeDef hdma_i2c1_rx;

View File

@@ -17,8 +17,8 @@ enum ShortNameType {
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
*/
extern const enum ShortNameType SettingsShortNameType;
extern const char* SettingsShortNames[17][2];
extern const char* SettingsDescriptions[17];
extern const char* SettingsShortNames[20][2];
extern const char* SettingsDescriptions[20];
extern const char* SettingsMenuEntries[4];
extern const char* SettingsMenuEntriesDescriptions[4];

View File

@@ -14,11 +14,21 @@ extern "C" {
#endif
enum Orientation {
ORIENTATION_LEFT_HAND = 0,
ORIENTATION_RIGHT_HAND = 1,
ORIENTATION_FLAT = 3
ORIENTATION_LEFT_HAND = 0, ORIENTATION_RIGHT_HAND = 1, ORIENTATION_FLAT = 3
};
/*
* Keep in a uint8_t range for the ID's
*/
enum TipType {
TS_B2 = 0,
TS_D24 = 1,
TS_BC2 = 2,
TS_C1 = 3,
Tip_MiniWare=4,
HAKKO_BC2=4,
Tip_Hakko=5,
Tip_Custom=5,
};
#define KEY_B_Pin GPIO_PIN_6
#define KEY_B_GPIO_Port GPIOA
#define TMP36_INPUT_Pin GPIO_PIN_7
@@ -54,6 +64,7 @@ uint16_t ftoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToF(uint16_t raw);
void setCalibrationOffset(int16_t offSet);
void setTipType(enum TipType tipType, uint8_t manualCalGain);
#ifdef __cplusplus
}
#endif

View File

@@ -4,7 +4,7 @@
#include <MMA8652FC.hpp>
#include "Setup.h"
#include "OLED.hpp"
extern uint16_t currentlyActiveTemperatureTarget;
extern OLED lcd;
extern MMA8652FC accel;
extern uint8_t PCBVersion;
@@ -25,6 +25,8 @@ enum ButtonState {
ButtonState getButtonState();
void waitForButtonPressOrTimeout(uint32_t timeout);
void waitForButtonPress();
void GUIDelay();
#ifdef __cplusplus
extern "C" {
#endif
@@ -36,7 +38,8 @@ void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c);
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName );
void vApplicationStackOverflowHook( xTaskHandle *pxTask,
signed portCHAR *pcTaskName);
#ifdef __cplusplus
}

View File

@@ -7,7 +7,7 @@
#include "FRToSI2C.hpp"
void FRToSI2C::CpltCallback() {
void __attribute__ ((long_call, section (".data.ramfuncs"))) FRToSI2C::CpltCallback() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
i2c->State = HAL_I2C_STATE_READY;//Force state reset
if (I2CSemaphore) {

View File

@@ -42,17 +42,8 @@ uint8_t OLED_Setup_Array[] = { /**/
};
//Setup based on the SSD1307 and modified for the SSD1306
const uint8_t REFRESH_COMMANDS[17] = {
0x80, 0xAF,
0x80, 0x21,
0x80, 0x20,
0x80, 0x7F,
0x80, 0xC0,
0x80, 0x22,
0x80, 0x00,
0x80, 0x01,
0x40
};
const uint8_t REFRESH_COMMANDS[17] = { 0x80, 0xAF, 0x80, 0x21, 0x80, 0x20, 0x80,
0x7F, 0x80, 0xC0, 0x80, 0x22, 0x80, 0x00, 0x80, 0x01, 0x40 };
OLED::OLED(FRToSI2C* i2cHandle) {
i2c = i2cHandle;
@@ -70,11 +61,12 @@ OLED::OLED(FRToSI2C* i2cHandle) {
void OLED::initialize() {
memcpy(&screenBuffer[0], &REFRESH_COMMANDS[0], sizeof(REFRESH_COMMANDS));
HAL_Delay(5);
HAL_Delay(50);
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
HAL_Delay(10);
HAL_Delay(50);
//Send the setup settings
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
sizeof(OLED_Setup_Array));
displayOnOff(true);
}
@@ -145,19 +137,20 @@ void OLED::setRotation(bool leftHanded) {
//send command struct again with changes
if (leftHanded) {
OLED_Setup_Array[11] = 0xC8; //c1?
OLED_Setup_Array[19] = 0xA1;
OLED_Setup_Array[11] = 0xC8; //c1?
OLED_Setup_Array[19] = 0xA1;
} else {
OLED_Setup_Array[11] = 0xC0;
OLED_Setup_Array[19] = 0xA0;
}
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
inLeftHandedMode = leftHanded;
OLED_Setup_Array[11] = 0xC0;
OLED_Setup_Array[19] = 0xA0;
}
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
sizeof(OLED_Setup_Array));
inLeftHandedMode = leftHanded;
screenBuffer[5] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
screenBuffer[7] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
}
}
//print a string to the current cursor location
void OLED::print(const char* str) {
@@ -190,9 +183,13 @@ void OLED::setFont(uint8_t fontNumber) {
//maximum places is 5
void OLED::printNumber(uint16_t number, uint8_t places) {
char buffer[6] = { 0 };
if (places == 5) {
char buffer[7] = { 0 };
if (places >= 5) {
buffer[5] = '0' + number % 10;
number /= 10;
}
if (places > 4) {
buffer[4] = '0' + number % 10;
number /= 10;
}
@@ -291,7 +288,7 @@ void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
}
void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
bool clear) {
bool clear) {
//Draw this in 3 sections
//This is basically a N wide version of vertical line

View File

@@ -22,7 +22,8 @@ void saveSettings() {
pEraseInit.PageAddress = FLASH_ADDR;
uint32_t failingAddress = 0;
HAL_IWDG_Refresh(&hiwdg);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
__HAL_FLASH_CLEAR_FLAG(
FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
HAL_FLASH_Unlock();
HAL_Delay(10);
HAL_IWDG_Refresh(&hiwdg);
@@ -35,7 +36,8 @@ void saveSettings() {
for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
HAL_IWDG_Refresh(&hiwdg);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2), data[i]);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, FLASH_ADDR + (i * 2),
data[i]);
}
HAL_FLASH_Lock();
@@ -71,29 +73,30 @@ uint8_t lookupVoltageLevel(uint8_t level) {
return (level * 33) + (33 * 2);
}
void resetSettings() {
memset((void*)&systemSettings,0,sizeof(systemSettingsType));
systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
systemSettings.SleepTime = 6; //How many seconds/minutes we wait until going to sleep - default 1 min
memset((void*) &systemSettings, 0, sizeof(systemSettingsType));
systemSettings.SleepTemp = 150; //Temperature the iron sleeps at - default 150.0 C
systemSettings.SleepTime = 6; //How many seconds/minutes we wait until going to sleep - default 1 min
systemSettings.SolderingTemp = 320; //Default soldering temp is 320.0 C
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
systemSettings.version = SETTINGSVERSION;//Store the version number to allow for easier upgrades
systemSettings.detailedSoldering = 0; // Detailed soldering screen
systemSettings.detailedIDLE=0; // Detailed idle screen (off for first time users)
systemSettings.detailedIDLE = 0;// Detailed idle screen (off for first time users)
systemSettings.OrientationMode = 2; //Default to automatic
systemSettings.sensitivity = 7; //Default high sensitivity
systemSettings.voltageDiv = 117; //Default divider from schematic
systemSettings.ShutdownTime = 10; //How many minutes until the unit turns itself off
systemSettings.boostModeEnabled = 1; //Default to safe, with no boost mode
systemSettings.ShutdownTime = 10;//How many minutes until the unit turns itself off
systemSettings.boostModeEnabled = 1;//Default to safe, with no boost mode
systemSettings.BoostTemp = 420; //default to 400C
systemSettings.autoStartMode = 0; //Auto start off for safety
systemSettings.coolingTempBlink = 0; //Blink the temperature on the cooling screen when its > 50C
systemSettings.CalibrationOffset = 10; //This appears to be quite close for both of my tips, in both of my handles
systemSettings.coolingTempBlink = 0;//Blink the temperature on the cooling screen when its > 50C
systemSettings.temperatureInF = 0; //default to 0
systemSettings.descriptionScrollSpeed=0;//default to slow
systemSettings.PID_P =42;
systemSettings.PID_I =50;
systemSettings.PID_D =15;
systemSettings.descriptionScrollSpeed = 0; //default to slow
systemSettings.PID_P = 42;
systemSettings.PID_I = 50;
systemSettings.PID_D = 15;
systemSettings.CalibrationOffset = 2780; // the adc offset
systemSettings.customTipGain = 0; // The tip type is either default or a custom gain
systemSettings.tipType = TS_B2;
saveSettings();
}

View File

@@ -6,6 +6,7 @@
*/
#include "Setup.h"
ADC_HandleTypeDef hadc1;
ADC_HandleTypeDef hadc2;
DMA_HandleTypeDef hdma_adc1;
I2C_HandleTypeDef hi2c1;
@@ -27,6 +28,7 @@ static void MX_TIM3_Init(void);
static void MX_TIM2_Init(void);
static void MX_DMA_Init(void);
static void MX_GPIO_Init(void);
static void MX_ADC2_Init(void);
void Setup_HAL() {
SystemClock_Config();
@@ -34,12 +36,16 @@ void Setup_HAL() {
MX_DMA_Init();
MX_I2C1_Init();
MX_ADC1_Init();
MX_ADC2_Init();
MX_TIM3_Init();
MX_TIM2_Init();
MX_IWDG_Init();
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
HAL_ADC_Start(&hadc2);
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*) ADCReadings, 64); //start DMA of normal readings
HAL_ADCEx_InjectedStart(&hadc1); //enable injected readings
HAL_ADCEx_InjectedStart(&hadc2); //enable injected readings
}
//channel 0 -> temperature sensor, 1-> VIN
@@ -99,6 +105,7 @@ void SystemClock_Config(void) {
/* ADC1 init function */
static void MX_ADC1_Init(void) {
ADC_MultiModeTypeDef multimode;
ADC_ChannelConfTypeDef sConfig;
ADC_InjectionConfTypeDef sConfigInjected;
@@ -113,6 +120,11 @@ static void MX_ADC1_Init(void) {
hadc1.Init.NbrOfConversion = 2;
HAL_ADC_Init(&hadc1);
/**Configure the ADC multi-mode
*/
multimode.Mode = ADC_DUALMODE_REGSIMULT_INJECSIMULT;
HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode);
/**Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_7;
@@ -159,6 +171,59 @@ static void MX_ADC1_Init(void) {
;
}
/* ADC2 init function */
static void MX_ADC2_Init(void) {
ADC_ChannelConfTypeDef sConfig;
ADC_InjectionConfTypeDef sConfigInjected;
/**Common config
*/
hadc2.Instance = ADC2;
hadc2.Init.ScanConvMode = ADC_SCAN_ENABLE;
hadc2.Init.ContinuousConvMode = ENABLE;
hadc2.Init.DiscontinuousConvMode = DISABLE;
hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc2.Init.NbrOfConversion = 2;
HAL_ADC_Init(&hadc2);
/**Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_8;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
HAL_ADC_ConfigChannel(&hadc2, &sConfig);
sConfig.Channel = ADC_CHANNEL_8;
sConfig.Rank = ADC_REGULAR_RANK_2;
sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
HAL_ADC_ConfigChannel(&hadc2, &sConfig);
/**Configure Injected Channel
*/
sConfigInjected.InjectedChannel = ADC_CHANNEL_8;
sConfigInjected.InjectedRank = ADC_INJECTED_RANK_1;
sConfigInjected.InjectedNbrOfConversion = 4;
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
sConfigInjected.AutoInjectedConv = DISABLE;
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
sConfigInjected.InjectedOffset = 0;
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
sConfigInjected.InjectedRank = ADC_INJECTED_RANK_2;
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
sConfigInjected.InjectedRank = ADC_INJECTED_RANK_3;
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
sConfigInjected.InjectedRank = ADC_INJECTED_RANK_4;
HAL_ADCEx_InjectedConfigChannel(&hadc2, &sConfigInjected);
// Run ADC internal calibration
while (HAL_ADCEx_Calibration_Start(&hadc2) != HAL_OK)
;
}
/* I2C1 init function */
static void MX_I2C1_Init(void) {
@@ -370,6 +435,7 @@ static void MX_GPIO_Init(void) {
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(OLED_RESET_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_RESET);
/* Configure GPIO pins : INT_Orientation_Pin INT_Movement_Pin */
/* Not used anymore*/

View File

@@ -8,54 +8,11 @@
#ifndef LANG
#define LANG_EN
#endif
// TEMPLATES for short names - choose one and use it as base for your
// translation:
//const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
//const char* SettingsShortNames[17][2] = {
// /* (<= 5) Power source (DC or batt) */ {"PWRSC"},
// /* (<= 4) Sleep temperature */ {"STMP"},
// /* (<= 4) Sleep timeout */ {"STME"},
// /* (<= 5) Shutdown timeout */ {"SHTME"},
// /* (<= 6) Motion sensitivity level */ {"MSENSE"},
// /* (<= 6) Temperature in F and C */ {"TMPUNT"},
// /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"},
// /* (<= 6) Display rotation mode */ {"DSPROT"},
// /* (<= 6) Boost enabled */ {"BOOST"},
// /* (<= 4) Boost temperature */ {"BTMP"},
// /* (<= 6) Automatic start mode */ {"ASTART"},
// /* (<= 6) Cooldown blink */ {"CLBLNK"},
// /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"},
// /* (<= 8) Settings reset command */ {"RESET?"},
// /* (<= 8) Calibrate input voltage */ {"CAL VIN?"},
// /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"},
// /* (<= 6) Message Scroll Speed */ {"DESCSP"},
//};
//const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
//const char* SettingsShortNames[17][2] = {
// /* (<= 11) Power source (DC or batt) */ {"Power", "source"},
// /* (<= 9) Sleep temperature */ {"Sleep", "temp"},
// /* (<= 9) Sleep timeout */ {"Sleep", "timeout"},
// /* (<= 11) Shutdown timeout */ {"Shutdown", "timeout"},
// /* (<= 13) Motion sensitivity level */ {"Motion", "sensitivity"},
// /* (<= 13) Temperature in F and C */ {"Temperature", "units"},
// /* (<= 13) Advanced idle display mode enabled */ {"Detailed", "idle screen"},
// /* (<= 13) Display rotation mode */ {"Display", "orientation"},
// /* (<= 13) Boost enabled */ {"Boost mode", "enabled"},
// /* (<= 9) Boost temperature */ {"Boost", "temp"},
// /* (<= 13) Automatic start mode */ {"Auto", "start"},
// /* (<= 13) Cooldown blink */ {"Cooldown", "blink"},
// /* (<= 16) Temperature calibration enter menu */ {"Calibrate", "temperature?"},
// /* (<= 16) Settings reset command */ {"Factory", "Reset?"},
// /* (<= 16) Calibrate input voltage */ {"Calibrate", "input voltage?"},
// /* (<= 13) Advanced soldering screen enabled */ {"Detailed", "solder screen"},
// /* (<= 11) Display Help Text Scroll Speed */ {"Description","Scroll Speed"},
//};
// TEMPLATE: Please use the English translations
#ifdef LANG_EN
const char* SettingsDescriptions[17] = {
const char* SettingsDescriptions[20] = {
// These are all the help text for all the settings.
// No requirements on spacing or length.
/* Power source (DC or batt) */"Power source. Sets cutoff voltage. <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",
/* Advanced soldering screen enabled */"Display detailed information while soldering",
/* Description Scroll Speed */"Speed this text scrolls past at",
/* Tip Model */"Tip Model selection ",
/* Simple Calibration Mode */"Simple Calibration using Hot water",
/* Advanced Calibration Mode */"Advanced calibration using thermocouple on the tip"
#ifdef PIDSETTINGS
#ifdef PIDSETTINGS
"PID P term. Inverse values! This acts as a divisor. So Larger numbers == typically smaller in other systems",
"PID I term. Inverse values! This acts as a divisor. So Larger numbers == typically smaller in other systems",
@@ -112,7 +73,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Power", "source"},
/* (<= 9) Sleep temperature */{"Sleep", "temp"},
/* (<= 9) Sleep timeout */{"Sleep", "timeout"},
@@ -130,6 +91,9 @@ const char* SettingsShortNames[17][2] = {
/* (<= 16) Calibrate input voltage */{"Calibrate", "input voltage?"},
/* (<= 13) Advanced soldering screen enabled */{"Detailed", "solder screen"},
/* (<= 11) Display Help Text Scroll Speed */{"Description","Scroll Speed"},
/* (<= 08) The Tip model being selected */{"Tip","Model"},
/* (<= 16) Simple Calibration */{"Simple","Calibration"},
/* (<= 16) Advanced Calibration */{"Advanced","Calibration"},
#ifdef PIDSETTINGS
{ "PID","P"},
@@ -139,6 +103,7 @@ const char* SettingsShortNames[17][2] = {
};
// SettingsMenuEntries lengths <= 13 per line (\n starts second line)
const char* SettingsMenuEntries[4] = {
/* Soldering Menu */"Soldering\nSettings",
@@ -203,7 +168,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Източник", "захранване"},
/* (<= 9) Sleep temperature */{"Темп.", "сън"},
/* (<= 9) Sleep timeout */{"Време", "сън"},
@@ -292,7 +257,7 @@ const char SettingFastChar = '+';
const char SettingSlowChar = '-';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Источник","питания"}, //8,7
/* (<= 9) Sleep temperature */{"Темпер.","сна"}, //7,3
/* (<= 9) Sleep timeout */{"Таймаут","сна"}, //7,3
@@ -457,7 +422,7 @@ const char SettingFastChar = 'N';//'F';
const char SettingSlowChar = 'H';//'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Virtalähde", "DC"},
/* (<= 9) Sleep temperature */{"Lepotilan", "lämpötila"},
/* (<= 9) Sleep timeout */{"Lepotilan", "viive"},
@@ -544,7 +509,7 @@ const char SettingFastChar = 'V';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Sorgente", "alimentaz"},
/* (<= 9) Sleep temperature */{"Temp", "standby"},
/* (<= 9) Sleep timeout */{"Timer", "standby"},
@@ -628,7 +593,7 @@ const char SettingFastChar = 'R';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Source", "d'alim"},
/* (<= 9) Sleep temperature */{"Temp.", "veille"},
/* (<= 9) Sleep timeout */{"Délai", "veille"},
@@ -718,7 +683,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Spannungs-", "quelle"},
/* (<= 9) Sleep temperature */{"Ruhetemp-", "eratur"},
/* (<= 9) Sleep timeout */{"Ruhever-", "zögerung"},
@@ -799,7 +764,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -880,7 +845,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -961,7 +926,7 @@ const char SettingFastChar = 'B';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Izvor", "napajanja"},
/* (<= 9) Sleep temperature */{"Temp", "spavanja"},
/* (<= 9) Sleep timeout */{"Vrijeme", "spavanja"},
@@ -1040,7 +1005,7 @@ const char SettingFastChar = 'R';
const char SettingSlowChar = 'P';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Zdroj", "napájení"},
/* (<= 9) Sleep temperature */{"Teplota v", "r. spánku"},
/* (<= 9) Sleep timeout */{"Čas do", "r. spánku"},
@@ -1125,7 +1090,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -1206,7 +1171,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -1287,7 +1252,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"PWRSC"},
/* (<= 4) Sleep temperature */{"STMP"},
/* (<= 4) Sleep timeout */{"STME"},
@@ -1467,7 +1432,7 @@ const char SettingFastChar = 'T';
const char SettingSlowChar = 'N';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Maitinimo", "šaltinis"},
/* (<= 9) Sleep temperature */{"Miego", "temperat."},
/* (<= 9) Sleep timeout */{"Miego", "laikas"},
@@ -1549,7 +1514,7 @@ const char SettingFastChar = '+';
const char SettingSlowChar = '-';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Джерело","живлення"}, //7,8
/* (<= 9) Sleep temperature */{"Темпер.","сну"}, //7,3
/* (<= 9) Sleep timeout */{"Таймаут","сну"}, //7,3
@@ -1633,7 +1598,7 @@ const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Spannings-", "bron"},
/* (<= 9) Sleep temperature */{"Slaap", "temp"},
/* (<= 9) Sleep timeout */{"Slaap", "time-out"},
@@ -1719,7 +1684,7 @@ const char SettingFastChar = 'S';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 11) Power source (DC or batt) */{"Ström-", "källa"},
/* (<= 9) Sleep temperature */{"Vilo-", "temp"},
/* (<= 9) Sleep timeout */{"Vilo-", "timeout"},
@@ -1806,7 +1771,7 @@ const char SettingFastChar = 'B';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] =
const char* SettingsShortNames[20][2] =
{
/* (<= 11) Power source (DC or batt) */{ "Izvor", "napajanja" },
/* (<= 9) Sleep temperature */{ "Temp", "spavanja" },
@@ -1884,7 +1849,7 @@ const char SettingAutoChar = 'A';
const char SettingFastChar = 'H';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
const char* SettingsShortNames[20][2] = {
/* (<= 5) Power source (DC or batt) */{"Kilde"},
/* (<= 4) Sleep temperature */{"DTmp"},
/* (<= 4) Sleep timeout */{"DTid"},

View File

@@ -52,11 +52,19 @@ static void settings_setCoolingBlinkEnabled(void);
static void settings_displayCoolingBlinkEnabled(void);
static void settings_setResetSettings(void);
static void settings_displayResetSettings(void);
static void settings_setTipModel(void);
static void settings_displayTipModel(void);
static void settings_setCalibrate(void);
static void settings_displayCalibrate(void);
static void settings_setCalibrateVIN(void);
static void settings_displayCalibrateVIN(void);
//Calibration Menu
static void calibration_displaySimpleCal(void); // Hot water cal
static void calibration_enterSimpleCal(void);
static void calibration_displayAdvancedCal(void); // two point cal
static void calibration_enterAdvancedCal(void);
//Menu functions
static void settings_displaySolderingMenu(void);
static void settings_enterSolderingMenu(void);
@@ -185,6 +193,8 @@ const menuitem advancedMenu[] = {
settings_displayAdvancedSolderingScreens } }, /* Advanced soldering screen*/
{ (const char*) SettingsDescriptions[13], { settings_setResetSettings }, {
settings_displayResetSettings } }, /*Resets settings*/
{ (const char*) SettingsDescriptions[17], { settings_setTipModel }, {
settings_displayTipModel } }, /*Select tip Model */
{ (const char*) SettingsDescriptions[12], { settings_setCalibrate }, {
settings_displayCalibrate } }, /*Calibrate tip*/
{ (const char*) SettingsDescriptions[14], { settings_setCalibrateVIN }, {
@@ -201,6 +211,13 @@ const menuitem advancedMenu[] = {
{ NULL, { NULL }, { NULL } } // end of menu marker. DO NOT REMOVE
};
const menuitem calibrationMenu[] { { (const char*) SettingsDescriptions[6], {
calibration_enterSimpleCal }, { calibration_displaySimpleCal } },
/* Simple Cal*/
{ (const char*) SettingsDescriptions[6], { calibration_enterAdvancedCal }, {
calibration_displayAdvancedCal } }, /* Advanced Cal */
{ NULL, { NULL }, { NULL } } };
static void printShortDescriptionSingleLine(uint32_t shortDescIndex) {
lcd.setFont(0);
lcd.setCharCursor(0, 0);
@@ -569,30 +586,214 @@ static void settings_displayResetSettings(void) {
printShortDescription(13, 7);
}
static void settings_setCalibrate(void) {
if (userConfirmation(SettingsCalibrationWarning)) {
//User confirmed
//So we now perform the actual calculation
static void settings_setTipModel(void) {
systemSettings.tipType++;
systemSettings.tipType %= (Tip_Custom + 1); //Wrap after custom
}
static void settings_displayTipModel(void) {
printShortDescription(17, 4);
//Print in small text the tip model
lcd.setFont(1);
//set the cursor
//Print the mfg
lcd.setCursor(40, 0);
if (systemSettings.tipType < Tip_MiniWare) {
lcd.print("TS100");
} else if (systemSettings.tipType < Tip_Hakko) {
lcd.print("HAKKO");
} else if (systemSettings.tipType == Tip_Custom) {
lcd.print("User");
}
lcd.setCursor(40, 8);
switch ((enum TipType) systemSettings.tipType) {
case TS_B2:
lcd.print(" B2 ");
break;
case TS_D24:
lcd.print(" D24 ");
break;
case TS_BC2:
lcd.print(" BC2 ");
break;
case TS_C1:
lcd.print(" C1 ");
break;
case HAKKO_BC2:
lcd.print(" BC2 ");
break;
case Tip_Custom:
lcd.print("Tuned");
break;
default:
lcd.print("????");
break;
}
}
static void calibration_displaySimpleCal(void) {
printShortDescription(18, 5);
}
static void dotDelay() {
for (uint8_t i = 0; i < 20; i++) {
getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
lcd.clearScreen();
lcd.setCursor(0, 0);
lcd.print(".....");
for (uint8_t x = 0; x < i / 4; x++)
lcd.print(".");
lcd.refresh();
osDelay(50);
}
}
static void setTipOffset() {
setCalibrationOffset(0); //turn off the current offset
dotDelay();
setCalibrationOffset(0); //turn off the current offset
for (uint8_t i = 0; i < 20; i++) {
getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
osDelay(20);
//If the thermocouple at the end of the tip, and the handle are at equalibrium, then the output should be zero, as there is no temperature differential.
int32_t offset = 0;
for (uint8_t i = 0; i < 15; i++) {
offset += getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable.
lcd.clearScreen();
lcd.setCursor(0, 0);
for (uint8_t x = 0; x < i / 4; x++)
lcd.print(".");
lcd.refresh();
osDelay(200);
}
systemSettings.CalibrationOffset = offset / 15;
setCalibrationOffset(systemSettings.CalibrationOffset); //store the error
osDelay(100);
}
static void calibration_enterSimpleCal(void) {
//User has entered into the simple cal routine
if (userConfirmation(SettingsCalibrationWarning)) {
//User has confirmed their handle is at ambient
//So take the offset measurement
setTipOffset();
//Next we want the user to put the tip into 100C water so we can calculate their tip's gain
//Gain is the m term from rise/run plot of raw readings vs (tip-handle)
//Thus we want to calculate ([TipRawHot-TipRawCold])/(ActualHot-HandleHot)-(ActualCold-HandleCold)
//Thus we first need to store -> TiprawCold,HandleCold,ActualCold==HandleCold -> RawTipCold
uint32_t RawTipCold = getTipRawTemp(0) * 10;
lcd.clearScreen();
lcd.setCursor(0, 0);
lcd.setFont(1);
lcd.print("Please Insert Tip\nInto Boiling Water");
lcd.refresh();
osDelay(200);
waitForButtonPress();
dotDelay(); //cycle the filter a bit
//Now take the three hot measurements
//Assume water is boiling at 100C
uint32_t RawTipHot = getTipRawTemp(0) * 10;
uint32_t HandleTempHot = getHandleTemperature() / 10;
uint32_t gain = (RawTipHot - RawTipCold) / (100 - HandleTempHot);
//Show this to the user
lcd.clearScreen();
lcd.setCursor(0, 0);
lcd.print("Your G: ");
lcd.printNumber(gain, 6);
lcd.print("\n~= 120-140");
lcd.refresh();
osDelay(2000);
waitForButtonPress();
lcd.clearScreen();
lcd.setCursor(0, 0);
lcd.print("H: ");
lcd.printNumber(RawTipHot, 8);
lcd.setCursor(0, 8);
lcd.print("C: ");
lcd.printNumber(RawTipCold, 8);
lcd.refresh();
osDelay(2000);
waitForButtonPress();
}
}
static void calibration_displayAdvancedCal(void) {
printShortDescription(19, 5);
}
static void calibration_enterAdvancedCal(void) {
//Advanced cal
if (userConfirmation(SettingsCalibrationWarning)) {
//User has confirmed their handle is at ambient
//So take the offset measurement
setTipOffset();
//The tip now has a known ADC offset
//Head up until it is at 350C
//Then let the user adjust the gain value until it converges
systemSettings.customTipGain = 120;
bool exit = false;
while (exit == false) {
//Set tip to 350C
currentlyActiveTemperatureTarget = ctoTipMeasurement(350);
//Check if user has pressed button to change the gain
ButtonState buttons = getButtonState();
switch (buttons) {
case BUTTON_NONE:
break;
case BUTTON_BOTH:
case BUTTON_B_LONG:
case BUTTON_F_LONG:
exit = true;
break;
case BUTTON_F_SHORT:
systemSettings.customTipGain++;
break;
case BUTTON_B_SHORT: {
systemSettings.customTipGain--;
}
break;
default:
break;
}
if (systemSettings.customTipGain > 200)
systemSettings.customTipGain = 200;
else if (systemSettings.customTipGain <= 100)
systemSettings.customTipGain = 100;
lcd.setCursor(0, 0);
lcd.clearScreen();
lcd.setFont(0);
if (lcd.getRotation())
lcd.drawChar('-');
else
lcd.drawChar('+');
lcd.drawChar(' ');
lcd.printNumber(systemSettings.customTipGain, 4);
lcd.drawChar(' ');
if (lcd.getRotation())
lcd.drawChar('+');
else
lcd.drawChar('-');
lcd.refresh();
GUIDelay();
}
osDelay(100);
uint16_t rawTempC = tipMeasurementToC(getTipRawTemp(0));
//We now measure the current reported tip temperature
uint16_t handleTempC = getHandleTemperature() / 10;
//We now have an error between these that we want to store as the offset
rawTempC = rawTempC - handleTempC;
systemSettings.CalibrationOffset = rawTempC;
setCalibrationOffset(rawTempC); //store the error
osDelay(100);
}
}
//Provide the user the option to tune their own tip if custom is selected
//If not only do single point tuning as per usual
static void settings_setCalibrate(void) {
if (systemSettings.tipType == Tip_Custom) {
//Two types of calibration
//1. Basic, idle temp + hot water (100C)
//2. Advanced, 100C + 350C, we keep PID tracking to a temperature target
return gui_Menu(calibrationMenu);
}
//Else
// Ask user if handle is at the tip temperature
// Any error between handle and the tip will be a direct offset in the control loop
else if (userConfirmation(SettingsCalibrationWarning)) {
//User confirmed
//So we now perform the actual calculation
setTipOffset();
}
}

View File

@@ -9,6 +9,14 @@
#include "hardware.h"
volatile uint16_t PWMSafetyTimer = 0;
volatile int16_t CalibrationTempOffset = 0;
uint16_t tipGainCalValue = 0;
uint16_t lookupTipDefaultCalValue(enum TipType tipID);
void setTipType(enum TipType tipType, uint8_t manualCalGain) {
if (manualCalGain)
tipGainCalValue = manualCalGain;
else
tipGainCalValue = lookupTipDefaultCalValue(tipType);
}
void setCalibrationOffset(int16_t offSet) {
CalibrationTempOffset = offSet;
}
@@ -29,48 +37,95 @@ uint16_t getHandleTemperature() {
}
uint16_t tipMeasurementToC(uint16_t raw) {
return ((raw - 532) / 33) + (getHandleTemperature() / 10)
- CalibrationTempOffset;
//Surprisingly that appears to be a fairly good linear best fit
//((Raw Tip-RawOffset) * calibrationgain) / 1000 = tip delta in CX10
// tip delta in CX10 + handleTemp in CX10 = tip absolute temp in CX10
//Div answer by 10 to get final result
uint32_t tipDelta = ((raw - CalibrationTempOffset) * tipGainCalValue)
/ 1000;
tipDelta += getHandleTemperature();
return tipDelta / 10;
}
uint16_t ctoTipMeasurement(uint16_t temp) {
//We need to compensate for cold junction temp
return ((temp - (getHandleTemperature() / 10) + CalibrationTempOffset) * 33)
+ 532;
//[ (temp-handle/10) * 10000 ]/calibrationgain = tip raw delta
// tip raw delta + tip offset = tip ADC reading
int32_t TipRaw = ((temp - (getHandleTemperature() / 10)) * 10000)
/ tipGainCalValue;
TipRaw += CalibrationTempOffset;
return TipRaw;
}
uint16_t tipMeasurementToF(uint16_t raw) {
return ((((raw - 532) / 33) + (getHandleTemperature() / 10)
- CalibrationTempOffset) * 9) / 5 + 32;
//Convert result from C to F
return (tipMeasurementToC(raw) * 9) / 5 + 32;
}
uint16_t ftoTipMeasurement(uint16_t temp) {
return (((((temp - 32) * 5) / 9) - (getHandleTemperature() / 10)
+ CalibrationTempOffset) * 33) + 532;
//Convert the temp back to C from F
return ctoTipMeasurement(((temp - 32) * 5) / 9);
}
uint16_t getTipInstantTemperature() {
uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipInstantTemperature() {
uint16_t sum;
sum = HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_2);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_4);
return sum;
sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_1);
sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_2);
sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_3);
sum += HAL_ADCEx_InjectedGetValue(&hadc2, ADC_INJECTED_RANK_4);
return sum; // 8x over sample
}
uint16_t getTipRawTemp(uint8_t instant) {
/*
* Loopup table for the tip calibration values for
* the gain of the tip's
* This can be found by line of best fit of TipRaw on X, and TipTemp-handle on Y.
* Then take the m term * 10000
* */
uint16_t lookupTipDefaultCalValue(enum TipType tipID) {
switch (tipID) {
case TS_D24:
return 141;
break;
case TS_BC2:
return (133 + 129) / 2;
break;
case TS_C1:
return 133;
break;
case TS_B2:
return 133;
default:
return 132; // make this the average of all
break;
}
}
uint16_t __attribute__ ((long_call, section (".data.ramfuncs"))) getTipRawTemp(
uint8_t instant) {
static int64_t filterFP = 0;
const uint8_t filterBeta = 5; //higher values smooth out more, but reduce responsiveness
static uint16_t lastSample = 0;
const uint8_t filterBeta = 7; //higher values smooth out more, but reduce responsiveness
if (instant == 1) {
uint16_t itemp = getTipInstantTemperature();
filterFP = (filterFP << filterBeta) - filterFP;
filterFP += (itemp << 9);
filterFP = filterFP >> filterBeta;
uint16_t temp = itemp;
itemp += lastSample;
itemp /= 2;
lastSample = temp;
return itemp;
} else if (instant == 2) {
filterFP = (getTipInstantTemperature() << 9);
filterFP = (getTipInstantTemperature() << 8);
return filterFP >> 9;
} else {
return filterFP >> 9;
@@ -101,24 +156,28 @@ uint16_t getInputVoltageX10(uint8_t divisor) {
preFillneeded = 1;
return sum / divisor;
}
volatile uint32_t pendingPWM = 0;
uint8_t getTipPWM() {
return htim2.Instance->CCR4;
return pendingPWM;
}
void setTipPWM(uint8_t pulse) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) setTipPWM(uint8_t pulse) {
PWMSafetyTimer = 2; //This is decremented in the handler for PWM so that the tip pwm is disabled if the PID task is not scheduled often enough.
if (pulse > 100)
pulse = 100;
htim2.Instance->CCR4 = pulse;
pendingPWM = pulse;
}
//Thse are called by the HAL after the corresponding events from the system timers.
//These are called by the HAL after the corresponding events from the system timers.
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PeriodElapsedCallback(
TIM_HandleTypeDef *htim) {
//Period has elapsed
if (htim->Instance == TIM2) {
//we want to turn on the output again
PWMSafetyTimer--; //We decrement this safety value so that lockups in the scheduler will not cause the PWM to become locked in an active driving state.
//While we could assume this could never happen, its a small price for increased safety
htim2.Instance->CCR4 = pendingPWM;
if (htim2.Instance->CCR4 && PWMSafetyTimer) {
htim3.Instance->CCR1 = 50;
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
@@ -127,21 +186,20 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
htim3.Instance->CCR1 = 0;
}
} else if (htim->Instance == TIM1) {
// STM uses this for internal functions as a counter for timeouts
HAL_IncTick();
}
}
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_TIM_PWM_PulseFinishedCallback(
TIM_HandleTypeDef *htim) {
if (htim->Instance == TIM2) {
//This was a pulse event
//This was a when the PWM for the output has timed out
if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_1);
htim3.Instance->CCR1 = 0;
} /*else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_13, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_14, GPIO_PIN_RESET);
}*/
}
}
}

View File

@@ -68,6 +68,7 @@ int main(void) {
HAL_IWDG_Refresh(&hiwdg);
restoreSettings(); // load the settings from flash
setCalibrationOffset(systemSettings.CalibrationOffset);
setTipType((enum TipType)systemSettings.tipType, systemSettings.customTipGain); //apply tip type selection
HAL_IWDG_Refresh(&hiwdg);
/* Create the thread(s) */
@@ -97,6 +98,9 @@ void printVoltage() {
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
}
void GUIDelay() {
//Called in all UI looping tasks,
//This limits the re-draw rate to the LCD and also lets the DMA run
//As the gui task can very easily fill this bus with transactions, which will prevent the movement detection from running
osDelay(50);
}
void gui_drawTipTemp(bool symbol) {
@@ -187,7 +191,7 @@ ButtonState getButtonState() {
return BUTTON_NONE;
}
static void waitForButtonPress() {
void waitForButtonPress() {
// we are just lazy and sleep until user confirms button press
// This also eats the button press event!
ButtonState buttons = getButtonState();
@@ -314,15 +318,11 @@ static void gui_solderingTempAdjust() {
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp > 850)
systemSettings.SolderingTemp = 850;
} else {
if (systemSettings.SolderingTemp > 450)
systemSettings.SolderingTemp = 450;
}
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp < 120)
systemSettings.SolderingTemp = 120;
} else {
if (systemSettings.SolderingTemp > 450)
systemSettings.SolderingTemp = 450;
if (systemSettings.SolderingTemp < 50)
systemSettings.SolderingTemp = 50;
}
@@ -343,9 +343,9 @@ static void gui_solderingTempAdjust() {
lcd.drawSymbol(1);
lcd.drawChar(' ');
if (lcd.getRotation())
lcd.drawChar('+');
else
lcd.drawChar('-');
lcd.drawChar('+');
else
lcd.drawChar('-');
lcd.refresh();
GUIDelay();
}
@@ -500,7 +500,7 @@ static void gui_solderingMode() {
lcd.setCursor(0, 0);
lcd.clearScreen();
lcd.setFont(0);
if (tipTemp > 16300) {
if (tipTemp > 32752) {
lcd.print(BadTipString);
lcd.refresh();
currentlyActiveTemperatureTarget = 0;
@@ -508,10 +508,11 @@ static void gui_solderingMode() {
return;
} else {
if (systemSettings.detailedSoldering) {
lcd.setFont(1);
lcd.print(SolderingAdvancedPowerPrompt); //Power:
lcd.printNumber(getTipPWM(), 3);
lcd.print("%");
lcd.setFont(1);/*
lcd.print(SolderingAdvancedPowerPrompt); //Power:
lcd.printNumber(getTipPWM(), 3);
lcd.print("%");*/
lcd.printNumber(getTipRawTemp(0), 6);
if (systemSettings.sensitivity && systemSettings.SleepTime) {
lcd.print(" ");
@@ -596,7 +597,7 @@ static void gui_solderingMode() {
static const char *HEADERS[] = {
__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
"Ctip: ", "Vin :" };
"Ctip: ", "Vin :", "THan: " };
void showVersion(void) {
uint8_t screen = 0;
@@ -629,7 +630,7 @@ void showVersion(void) {
lcd.printNumber(lastMovementTime / 100, 5);
break;
case 7:
lcd.printNumber(getTipRawTemp(0), 5);
lcd.printNumber(getTipRawTemp(0), 6);
break;
case 8:
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
@@ -637,6 +638,8 @@ void showVersion(void) {
case 9:
printVoltage();
break;
case 10:
lcd.printNumber(getHandleTemperature(), 3);
default:
break;
}
@@ -647,14 +650,14 @@ void showVersion(void) {
return;
else if (b == BUTTON_F_SHORT) {
screen++;
screen = screen % 10;
screen = screen % 11;
}
GUIDelay();
}
}
/* StartGUITask function */
void startGUITask(void const *argument) {
void startGUITask(void const *argument __unused) {
i2cDev.FRToSInit();
uint8_t tempWarningState = 0;
bool buttonLockout = false;
@@ -814,7 +817,7 @@ void startGUITask(void const *argument) {
}
/* StartPIDTask function */
void startPIDTask(void const *argument) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) startPIDTask(void const *argument __unused) {
/*
* We take the current tip temperature & evaluate the next step for the tip
* control PWM
@@ -843,8 +846,8 @@ void startPIDTask(void const *argument) {
uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading
if (currentlyActiveTemperatureTarget) {
// Compute the PID loop in here
// Because our values here are quite large for all measurements (0-16k ~=
// 33 counts per C)
// Because our values here are quite large for all measurements (0-32k ~=
// 66 counts per C)
// P I & D are divisors, so inverse logic applies (beware)
// Cap the max set point to 450C
@@ -854,9 +857,12 @@ void startPIDTask(void const *argument) {
int32_t rawTempError = currentlyActiveTemperatureTarget
- rawTemp;
int32_t ierror = (rawTempError
/ ((int32_t) systemSettings.PID_I));
integralCount += ierror;
if (integralCount > (itermMax / 2))
integralCount = itermMax / 2; // prevent too much lead
else if (integralCount < -itermMax)
@@ -878,9 +884,11 @@ void startPIDTask(void const *argument) {
output = 0;
}
/*if (currentlyActiveTemperatureTarget < rawTemp) {
output = 0;
}*/
if (currentlyActiveTemperatureTarget < rawTemp) {
output = 0;
integralCount = 0;
derivativeLastValue = 0;
}
setTipPWM(output);
derivativeLastValue = rawTemp; // store for next loop
@@ -891,11 +899,17 @@ void startPIDTask(void const *argument) {
}
HAL_IWDG_Refresh(&hiwdg);
} else {
if (currentlyActiveTemperatureTarget == 0) {
setTipPWM(0); // disable the output driver if the output is set to be off
integralCount = 0;
derivativeLastValue = 0;
}
}
}
}
#define MOVFilter 8
void startMOVTask(void const *argument) {
void startMOVTask(void const *argument __unused) {
osDelay(250); // wait for accelerometer to stabilize
lcd.setRotation(systemSettings.OrientationMode & 1);
lastMovementTime = 0;
@@ -1011,41 +1025,48 @@ bool showBootLogoIfavailable() {
return true;
}
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc) {
/*
* Catch the IRQ that says that the conversion is done on the temperature readings coming in
* Once these have come in we can unblock the PID so that it runs again
*/
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_ADCEx_InjectedConvCpltCallback(
ADC_HandleTypeDef* hadc) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if (pidTaskNotification) {
/* Notify the task that the transmission is complete. */
vTaskNotifyGiveFromISR(pidTaskNotification, &xHigherPriorityTaskWoken);
/* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch
should be performed to ensure the interrupt returns directly to the highest
priority task. The macro used for this purpose is dependent on the port in
use and may be called portEND_SWITCHING_ISR(). */
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
if (hadc == &hadc1) {
if (pidTaskNotification) {
vTaskNotifyGiveFromISR(pidTaskNotification,
&xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
}
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterRxCpltCallback(
I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MasterTxCpltCallback(
I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MemTxCpltCallback(
I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_ErrorCallback(
I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_AbortCpltCallback(
I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c) {
void __attribute__ ((long_call, section (".data.ramfuncs"))) HAL_I2C_MemRxCpltCallback(
I2C_HandleTypeDef *hi2c __unused) {
i2cDev.CpltCallback();
}
void vApplicationStackOverflowHook( xTaskHandle *pxTask,
signed portCHAR *pcTaskName) {
void vApplicationStackOverflowHook( xTaskHandle *pxTask __unused,
signed portCHAR *pcTaskName __unused) {
//We dont have a good way to handle a stack overflow at this point in time
NVIC_SystemReset();

View File

@@ -30,7 +30,8 @@ void HAL_MspInit(void) {
*/
//__HAL_AFIO_REMAP_SWJ_NOJTAG()
//;
__HAL_AFIO_REMAP_SWJ_DISABLE(); /*Disable swd for debug io use*/
__HAL_AFIO_REMAP_SWJ_DISABLE()
; /*Disable swd for debug io use*/
}
@@ -70,6 +71,21 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) {
/* ADC1 interrupt Init */
HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
} else {
__HAL_RCC_ADC2_CLK_ENABLE()
;
/**ADC2 GPIO Configuration
PB0 ------> ADC2_IN8
PB1 ------> ADC2_IN9
*/
GPIO_InitStruct.Pin = TIP_TEMP_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* ADC2 interrupt Init */
HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
}
}

View File

@@ -35,15 +35,15 @@
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
</option>
<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="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\Middlewares\Third_Party\FreeRTOS\Source\portable&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\HAL_Driver\Inc\Legacy&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\HAL_Driver\Inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\CMSIS\core&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Users\Ralim.DESKTOP-R877O7F\Documents\GitHub\ts100\workspace\TS100\CMSIS\device&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM3&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\Middlewares\Third_Party\FreeRTOS\Source\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\Middlewares\Third_Party\FreeRTOS\Source\portable&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\HAL_Driver\Inc\Legacy&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\HAL_Driver\Inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\CMSIS\core&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/../TS100\CMSIS\device&quot;"/>
</option>
<inputType id="com.atollic.truestudio.as.input.640267647" name="Input" superClass="com.atollic.truestudio.as.input"/>
</tool>

View File

@@ -4,7 +4,7 @@
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<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 &quot;${INPUTS}&quot;" 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 &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>