mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Merge pull request #745 from Ralim/Testing-Thermo
Improving thermal performance & squashing related bugs & Improve minor CI tweaks
This commit is contained in:
103
.github/workflows/pr.yml
vendored
103
.github/workflows/pr.yml
vendored
@@ -1,103 +0,0 @@
|
||||
name: CI PR
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build_TS80:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
|
||||
- name: build TS80
|
||||
run: cd workspace/TS100 && ./build.sh -m TS80
|
||||
|
||||
- name: Archive TS80 artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: TS80
|
||||
path: |
|
||||
workspace/TS100/Hexfile/TS80_*.hex
|
||||
workspace/TS100/Hexfile/TS80_*.bin
|
||||
if-no-files-found: error
|
||||
build_TS80P:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
|
||||
- name: build TS80P
|
||||
run: cd workspace/TS100 && ./build.sh -m TS80P
|
||||
|
||||
- name: Archive TS80P artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: TS80P
|
||||
path: |
|
||||
workspace/TS100/Hexfile/TS80P_*.hex
|
||||
workspace/TS100/Hexfile/TS80P_*.bin
|
||||
if-no-files-found: error
|
||||
build_TS100:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
|
||||
- name: build TS100
|
||||
run: cd workspace/TS100 && ./build.sh -m TS100
|
||||
|
||||
- name: Archive TS100 artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: TS100
|
||||
path: |
|
||||
workspace/TS100/Hexfile/TS100_*.hex
|
||||
workspace/TS100/Hexfile/TS100_*.bin
|
||||
if-no-files-found: error
|
||||
|
||||
build_Pinecil:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
|
||||
- name: build Pinecil
|
||||
run: cd workspace/TS100 && ./build.sh -m Pinecil
|
||||
|
||||
- name: Archive Pinecil artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Pinecil
|
||||
path: |
|
||||
workspace/TS100/Hexfile/Pinecil_*.hex
|
||||
workspace/TS100/Hexfile/Pinecil_*.bin
|
||||
if-no-files-found: error
|
||||
|
||||
56
.github/workflows/push.yml
vendored
56
.github/workflows/push.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: CI PR
|
||||
name: CI Build all
|
||||
|
||||
on: [push]
|
||||
on: [push,pull_request]
|
||||
|
||||
jobs:
|
||||
build_TS80:
|
||||
@@ -10,7 +10,18 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
|
||||
|
||||
- name: Cached compiler source files
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-compilers
|
||||
with:
|
||||
# we deliberately persist a cache folder forwards
|
||||
path: /build/cache
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
@@ -33,7 +44,18 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
|
||||
|
||||
- name: Cached compiler source files
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-compilers
|
||||
with:
|
||||
# we deliberately persist a cache folder forwards
|
||||
path: /build/cache
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
@@ -56,7 +78,18 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
|
||||
|
||||
- name: Cached compiler source files
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-compilers
|
||||
with:
|
||||
# we deliberately persist a cache folder forwards
|
||||
path: /build/cache
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
@@ -80,7 +113,18 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: chmod
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh
|
||||
run: chmod +x setup.sh && chmod +x workspace/TS100/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build
|
||||
|
||||
- name: Cached compiler source files
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-compilers
|
||||
with:
|
||||
# we deliberately persist a cache folder forwards
|
||||
path: /build/cache
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: setup
|
||||
run: ./setup.sh
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -190,4 +190,5 @@ fabric.properties
|
||||
.idea/httpRequests
|
||||
|
||||
CoreCompileInputs.cache
|
||||
.vscode/settings.json
|
||||
.vscode/settings.json
|
||||
workspace/TS100/TS100/
|
||||
|
||||
76
Documentation/Debug Menu.md
Normal file
76
Documentation/Debug Menu.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Debugging Menu
|
||||
|
||||
In this firmware there is extra debugging information hidden under and extra menu.
|
||||
This is accessed by holding the rear (B) button on the iron while its on the home screen.
|
||||
|
||||
This menu is meant to be simple, so it has no fancy GUI animations.
|
||||
|
||||
To move through the menu use the front (A) button.
|
||||
To exit, use the rear (B) button again.
|
||||
|
||||
## Menu items
|
||||
|
||||
Items are shown in the menu on a single line, so they use short codes
|
||||
|
||||
### HW G
|
||||
|
||||
This indicates the High Water mark for the stack for the GUI thread. The smaller this number is, the less headroom we have in the stack.
|
||||
As this is a Highwater mater, you should only trust this once you have walked through all GUI options to "hit" the worst one.
|
||||
|
||||
### HW M
|
||||
|
||||
This indicates the High Water mark for the stack for the movement detection thread. The smaller this number is, the less headroom we have in the stack.
|
||||
|
||||
### HW P
|
||||
|
||||
This indicates the High Water mark for the stack for the PID thread. The smaller this number is, the less headroom we have in the stack.
|
||||
|
||||
### Time
|
||||
|
||||
This just shows how many seconds the unit has been powered for.
|
||||
|
||||
### Move
|
||||
|
||||
This is the last timestamp of movement. When the iron is moved this should update to match the Time field (one before in the menu).
|
||||
This can be used for checking performance of the movement dection code.
|
||||
|
||||
### RTip
|
||||
|
||||
This is the raw tip reading in uV. This can be used when assessing the calibration routines for example.
|
||||
|
||||
### CTip
|
||||
|
||||
This is the tip temperature in deg C. This can be used with RTip for assessing temperature processing performance.
|
||||
|
||||
### CHan
|
||||
|
||||
This is the handle temperature in C. This is used for cold junction compensation of the tip temp.
|
||||
|
||||
### Vin
|
||||
|
||||
The input voltage reading.
|
||||
|
||||
### PCB
|
||||
|
||||
This is slightly miss-named, but preserving the name for now.
|
||||
This indicates the PCB "version" number, which comes from the TS100 changing the model of accelerometer without warning.
|
||||
This indicates the accelerometer that is fitted inside the unit.
|
||||
|
||||
- 0 = MMA8652
|
||||
- 1 = LIS2DH12
|
||||
- 2 = BMA223
|
||||
- 99 = None detected (running in fallback without movement detection)
|
||||
|
||||
### PWR
|
||||
|
||||
This indicates the current power source for the iron.
|
||||
This may change during power up as the sources are negotiated in turn.
|
||||
|
||||
- 0 = DC input (dumb)
|
||||
- 1 = QC input (We used QC2/3 negotiation for current supply)
|
||||
- 2 = PD input (We used the PD subsystem to negotiate for the current supply)
|
||||
|
||||
### Max
|
||||
|
||||
This indicates the max temp in C that the system estimates it can measure the tip reliably to.
|
||||
This is dependant on a few factors including the handle temperature so it can move around during use.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Upgrading your iron
|
||||
# Flashing / Upgrading your iron
|
||||
|
||||
## Miniware irons (TS100, TS80, TS80P)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,19 +54,20 @@ def readTranslations(jsonDir):
|
||||
langCode = fileName[12:-5].upper()
|
||||
# ...and the one specified in the JSON file...
|
||||
try:
|
||||
langCodeFromJson = lang['languageCode']
|
||||
langCodeFromJson = lang["languageCode"]
|
||||
except KeyError:
|
||||
langCodeFromJson = "(missing)"
|
||||
|
||||
try:
|
||||
TempUnitF_FromJson = lang['tempUnitFahrenheit']
|
||||
TempUnitF_FromJson = lang["tempUnitFahrenheit"]
|
||||
except KeyError:
|
||||
TempUnitF_FromJson = True # Default to true.
|
||||
|
||||
TempUnitF_FromJson = True # Default to true.
|
||||
|
||||
# ...cause they should be the same!
|
||||
if langCode != langCodeFromJson:
|
||||
raise ValueError("Invalid languageCode " + langCodeFromJson +
|
||||
" in file " + fileName)
|
||||
raise ValueError(
|
||||
"Invalid languageCode " + langCodeFromJson + " in file " + fileName
|
||||
)
|
||||
|
||||
langDict[langCode] = lang
|
||||
UnitDict[langCode] = TempUnitF_FromJson
|
||||
@@ -82,7 +83,9 @@ def writeStart(f):
|
||||
#ifndef LANG
|
||||
#define LANG_EN
|
||||
#endif
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def writeStartUnit(f):
|
||||
@@ -100,86 +103,91 @@ def writeStartUnit(f):
|
||||
|
||||
#ifndef _UNIT_H
|
||||
#define _UNIT_H\n
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def escapeC(s):
|
||||
return s.replace("\"", "\\\"")
|
||||
return s.replace('"', '\\"')
|
||||
|
||||
|
||||
def getConstants():
|
||||
# Extra constants that are used in the firmware that are shared across all languages
|
||||
consants = []
|
||||
consants.append(('SymbolPlus', '+'))
|
||||
consants.append(('SymbolMinus', '-'))
|
||||
consants.append(('SymbolSpace', ' '))
|
||||
consants.append(('SymbolDot', '.'))
|
||||
consants.append(('SymbolDegC', 'C'))
|
||||
consants.append(('SymbolDegF', 'F'))
|
||||
consants.append(('SymbolMinutes', 'M'))
|
||||
consants.append(('SymbolSeconds', 'S'))
|
||||
consants.append(('SymbolWatts', 'W'))
|
||||
consants.append(('SymbolVolts', 'V'))
|
||||
consants.append(('SymbolDC', 'DC'))
|
||||
consants.append(('SymbolCellCount', 'S'))
|
||||
consants.append(('SymbolVersionNumber', buildVersion))
|
||||
consants.append(("SymbolPlus", "+"))
|
||||
consants.append(("SymbolMinus", "-"))
|
||||
consants.append(("SymbolSpace", " "))
|
||||
consants.append(("SymbolDot", "."))
|
||||
consants.append(("SymbolDegC", "C"))
|
||||
consants.append(("SymbolDegF", "F"))
|
||||
consants.append(("SymbolMinutes", "M"))
|
||||
consants.append(("SymbolSeconds", "S"))
|
||||
consants.append(("SymbolWatts", "W"))
|
||||
consants.append(("SymbolVolts", "V"))
|
||||
consants.append(("SymbolDC", "DC"))
|
||||
consants.append(("SymbolCellCount", "S"))
|
||||
consants.append(("SymbolVersionNumber", buildVersion))
|
||||
return consants
|
||||
|
||||
|
||||
|
||||
def getDebugMenu():
|
||||
constants = []
|
||||
constants.append(datetime.today().strftime('%d-%m-%y'))
|
||||
constants.append("HW G ")
|
||||
constants.append("HW M ")
|
||||
constants.append("HW P ")
|
||||
constants.append("Time ")
|
||||
constants.append("Move ")
|
||||
constants.append("RTip ")
|
||||
constants.append("CTip ")
|
||||
constants.append("CHan ")
|
||||
constants.append("Vin ")
|
||||
constants.append(datetime.today().strftime("%d-%m-%y"))
|
||||
constants.append("HW G ") # High Water marker for GUI task
|
||||
constants.append("HW M ") # High Water marker for MOV task
|
||||
constants.append("HW P ") # High Water marker for PID task
|
||||
constants.append("Time ") # Uptime (aka timestamp)
|
||||
constants.append("Move ") # Time of last significant movement
|
||||
constants.append("RTip ") # Tip reading in uV
|
||||
constants.append("CTip ") # Tip temp in C
|
||||
constants.append("CHan ") # Handle temp in C
|
||||
constants.append("Vin ") # Input voltage
|
||||
constants.append("PCB ") # PCB Version AKA IMU version
|
||||
constants.append("PWR ") # Power Negotiation State
|
||||
constants.append("Max ") # Max deg C limit
|
||||
|
||||
return constants
|
||||
|
||||
|
||||
def getLetterCounts(defs, lang):
|
||||
textList = []
|
||||
# iterate over all strings
|
||||
obj = lang['menuOptions']
|
||||
for mod in defs['menuOptions']:
|
||||
eid = mod['id']
|
||||
textList.append(obj[eid]['desc'])
|
||||
obj = lang["menuOptions"]
|
||||
for mod in defs["menuOptions"]:
|
||||
eid = mod["id"]
|
||||
textList.append(obj[eid]["desc"])
|
||||
|
||||
obj = lang['messages']
|
||||
for mod in defs['messages']:
|
||||
eid = mod['id']
|
||||
obj = lang["messages"]
|
||||
for mod in defs["messages"]:
|
||||
eid = mod["id"]
|
||||
if eid not in obj:
|
||||
textList.append(mod['default'])
|
||||
textList.append(mod["default"])
|
||||
else:
|
||||
textList.append(obj[eid])
|
||||
|
||||
obj = lang['characters']
|
||||
obj = lang["characters"]
|
||||
|
||||
for mod in defs['characters']:
|
||||
eid = mod['id']
|
||||
for mod in defs["characters"]:
|
||||
eid = mod["id"]
|
||||
textList.append(obj[eid])
|
||||
|
||||
obj = lang['menuOptions']
|
||||
for mod in defs['menuOptions']:
|
||||
eid = mod['id']
|
||||
textList.append(obj[eid]['text2'][0])
|
||||
textList.append(obj[eid]['text2'][1])
|
||||
obj = lang["menuOptions"]
|
||||
for mod in defs["menuOptions"]:
|
||||
eid = mod["id"]
|
||||
textList.append(obj[eid]["text2"][0])
|
||||
textList.append(obj[eid]["text2"][1])
|
||||
|
||||
obj = lang['menuGroups']
|
||||
for mod in defs['menuGroups']:
|
||||
eid = mod['id']
|
||||
textList.append(obj[eid]['text2'][0])
|
||||
textList.append(obj[eid]['text2'][1])
|
||||
obj = lang["menuGroups"]
|
||||
for mod in defs["menuGroups"]:
|
||||
eid = mod["id"]
|
||||
textList.append(obj[eid]["text2"][0])
|
||||
textList.append(obj[eid]["text2"][1])
|
||||
|
||||
obj = lang['menuGroups']
|
||||
for mod in defs['menuGroups']:
|
||||
eid = mod['id']
|
||||
textList.append(obj[eid]['desc'])
|
||||
obj = lang["menuGroups"]
|
||||
for mod in defs["menuGroups"]:
|
||||
eid = mod["id"]
|
||||
textList.append(obj[eid]["desc"])
|
||||
constants = getConstants()
|
||||
for x in constants:
|
||||
textList.append(x[1])
|
||||
@@ -189,15 +197,15 @@ def getLetterCounts(defs, lang):
|
||||
|
||||
symbolCounts = {}
|
||||
for line in textList:
|
||||
line = line.replace('\n', '').replace('\r', '')
|
||||
line = line.replace('\\n', '').replace('\\r', '')
|
||||
line = line.replace("\n", "").replace("\r", "")
|
||||
line = line.replace("\\n", "").replace("\\r", "")
|
||||
if len(line):
|
||||
# print(line)
|
||||
for letter in line:
|
||||
symbolCounts[letter] = symbolCounts.get(letter, 0) + 1
|
||||
symbolCounts = sorted(
|
||||
symbolCounts.items(),
|
||||
key=lambda kv: (kv[1], kv[0])) # swap to Big -> little sort order
|
||||
symbolCounts.items(), key=lambda kv: (kv[1], kv[0])
|
||||
) # swap to Big -> little sort order
|
||||
symbolCounts = list(map(lambda x: x[0], symbolCounts))
|
||||
symbolCounts.reverse()
|
||||
return symbolCounts
|
||||
@@ -207,17 +215,17 @@ def getFontMapAndTable(textList):
|
||||
# the text list is sorted
|
||||
# allocate out these in their order as number codes
|
||||
symbolMap = {}
|
||||
symbolMap['\n'] = '\\x01' # Force insert the newline char
|
||||
symbolMap["\n"] = "\\x01" # Force insert the newline char
|
||||
index = 2 # start at 2, as 0= null terminator,1 = new line
|
||||
forcedFirstSymbols = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||
forcedFirstSymbols = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
# enforce numbers are first
|
||||
for sym in forcedFirstSymbols:
|
||||
symbolMap[sym] = "\\x%0.2X" % index
|
||||
index = index + 1
|
||||
if len(textList) > (253 - len(forcedFirstSymbols)):
|
||||
print('Error, too many used symbols for this version')
|
||||
print("Error, too many used symbols for this version")
|
||||
exit(1)
|
||||
print('Generating fonts for {} symbols'.format(len(textList)))
|
||||
print("Generating fonts for {} symbols".format(len(textList)))
|
||||
|
||||
for sym in textList:
|
||||
if sym not in symbolMap:
|
||||
@@ -230,39 +238,38 @@ def getFontMapAndTable(textList):
|
||||
fontSmallTable = fontTables.getSmallFontMap()
|
||||
for sym in forcedFirstSymbols:
|
||||
if sym not in fontTable:
|
||||
print('Missing Large font element for {}'.format(sym))
|
||||
print("Missing Large font element for {}".format(sym))
|
||||
exit(1)
|
||||
fontLine = fontTable[sym]
|
||||
fontTableStrings.append(
|
||||
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
|
||||
fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym))
|
||||
if sym not in fontSmallTable:
|
||||
print('Missing Small font element for {}'.format(sym))
|
||||
print("Missing Small font element for {}".format(sym))
|
||||
exit(1)
|
||||
fontLine = fontSmallTable[sym]
|
||||
fontSmallTableStrings.append(
|
||||
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
|
||||
fontLine + "//{} -> {}".format(symbolMap[sym], sym)
|
||||
)
|
||||
|
||||
for sym in textList:
|
||||
if sym not in fontTable:
|
||||
print('Missing Large font element for {}'.format(sym))
|
||||
print("Missing Large font element for {}".format(sym))
|
||||
exit(1)
|
||||
if sym not in forcedFirstSymbols:
|
||||
fontLine = fontTable[sym]
|
||||
fontTableStrings.append(
|
||||
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
|
||||
fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym))
|
||||
if sym not in fontSmallTable:
|
||||
print('Missing Small font element for {}'.format(sym))
|
||||
print("Missing Small font element for {}".format(sym))
|
||||
exit(1)
|
||||
fontLine = fontSmallTable[sym]
|
||||
fontSmallTableStrings.append(
|
||||
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
|
||||
fontLine + "//{} -> {}".format(symbolMap[sym], sym)
|
||||
)
|
||||
outputTable = "const uint8_t USER_FONT_12[] = {" + to_unicode("\n")
|
||||
for line in fontTableStrings:
|
||||
# join font table int one large string
|
||||
outputTable = outputTable + line + to_unicode("\n")
|
||||
outputTable = outputTable + "};" + to_unicode("\n")
|
||||
outputTable = outputTable + "const uint8_t USER_FONT_6x8[] = {" + to_unicode(
|
||||
"\n")
|
||||
outputTable = outputTable + "const uint8_t USER_FONT_6x8[] = {" + to_unicode("\n")
|
||||
for line in fontSmallTableStrings:
|
||||
# join font table int one large string
|
||||
outputTable = outputTable + line + to_unicode("\n")
|
||||
@@ -273,9 +280,9 @@ def getFontMapAndTable(textList):
|
||||
def convStr(symbolConversionTable, text):
|
||||
# convert all of the symbols from the string into escapes for their content
|
||||
outputString = ""
|
||||
for c in text.replace('\\r', '').replace('\\n', '\n'):
|
||||
for c in text.replace("\\r", "").replace("\\n", "\n"):
|
||||
if c not in symbolConversionTable:
|
||||
print('Missing font definition for {}'.format(c))
|
||||
print("Missing font definition for {}".format(c))
|
||||
else:
|
||||
outputString = outputString + symbolConversionTable[c]
|
||||
return outputString
|
||||
@@ -292,60 +299,86 @@ def writeLanguage(languageCode, defs, f):
|
||||
f.write(to_unicode("\n#ifdef LANG_" + languageCode + "\n"))
|
||||
f.write(fontTableText)
|
||||
try:
|
||||
langName = lang['languageLocalName']
|
||||
langName = lang["languageLocalName"]
|
||||
except KeyError:
|
||||
langName = languageCode
|
||||
|
||||
f.write(to_unicode("// ---- " + langName + " ----\n\n"))
|
||||
|
||||
# ----- Writing SettingsDescriptions
|
||||
obj = lang['menuOptions']
|
||||
obj = lang["menuOptions"]
|
||||
f.write(to_unicode("const char* SettingsDescriptions[] = {\n"))
|
||||
|
||||
maxLen = 25
|
||||
index =0
|
||||
for mod in defs['menuOptions']:
|
||||
eid = mod['id']
|
||||
if 'feature' in mod:
|
||||
f.write(to_unicode("#ifdef " + mod['feature'] + "\n"))
|
||||
f.write(to_unicode(" /* ["+"{:02d}".format(index)+"] " + eid.ljust(maxLen)[:maxLen] + " */ "))
|
||||
index = 0
|
||||
for mod in defs["menuOptions"]:
|
||||
eid = mod["id"]
|
||||
if "feature" in mod:
|
||||
f.write(to_unicode("#ifdef " + mod["feature"] + "\n"))
|
||||
f.write(
|
||||
to_unicode("\"" +
|
||||
convStr(symbolConversionTable, (obj[eid]['desc'])) +
|
||||
"\"," + "//{} \n".format(obj[eid]['desc'])))
|
||||
if 'feature' in mod:
|
||||
to_unicode(
|
||||
" /* ["
|
||||
+ "{:02d}".format(index)
|
||||
+ "] "
|
||||
+ eid.ljust(maxLen)[:maxLen]
|
||||
+ " */ "
|
||||
)
|
||||
)
|
||||
f.write(
|
||||
to_unicode(
|
||||
'"'
|
||||
+ convStr(symbolConversionTable, (obj[eid]["desc"]))
|
||||
+ '",'
|
||||
+ "//{} \n".format(obj[eid]["desc"])
|
||||
)
|
||||
)
|
||||
if "feature" in mod:
|
||||
f.write(to_unicode("#endif\n"))
|
||||
index=index+1
|
||||
index = index + 1
|
||||
|
||||
f.write(to_unicode("};\n\n"))
|
||||
|
||||
# ----- Writing Message strings
|
||||
|
||||
obj = lang['messages']
|
||||
obj = lang["messages"]
|
||||
|
||||
for mod in defs['messages']:
|
||||
eid = mod['id']
|
||||
for mod in defs["messages"]:
|
||||
eid = mod["id"]
|
||||
sourceText = ""
|
||||
if 'default' in mod:
|
||||
sourceText = (mod['default'])
|
||||
if "default" in mod:
|
||||
sourceText = mod["default"]
|
||||
if eid in obj:
|
||||
sourceText = (obj[eid])
|
||||
sourceText = obj[eid]
|
||||
translatedText = convStr(symbolConversionTable, sourceText)
|
||||
f.write(
|
||||
to_unicode("const char* " + eid + " = \"" +
|
||||
translatedText + "\";" + "//{} \n".format(sourceText.replace('\n', '_'))))
|
||||
to_unicode(
|
||||
"const char* "
|
||||
+ eid
|
||||
+ ' = "'
|
||||
+ translatedText
|
||||
+ '";'
|
||||
+ "//{} \n".format(sourceText.replace("\n", "_"))
|
||||
)
|
||||
)
|
||||
|
||||
f.write(to_unicode("\n"))
|
||||
|
||||
# ----- Writing Characters
|
||||
|
||||
obj = lang['characters']
|
||||
obj = lang["characters"]
|
||||
|
||||
for mod in defs['characters']:
|
||||
eid = mod['id']
|
||||
for mod in defs["characters"]:
|
||||
eid = mod["id"]
|
||||
f.write(
|
||||
to_unicode("const char* " + eid + " = \"" +
|
||||
convStr(symbolConversionTable, obj[eid]) + "\";" + "//{} \n".format(obj[eid])))
|
||||
to_unicode(
|
||||
"const char* "
|
||||
+ eid
|
||||
+ ' = "'
|
||||
+ convStr(symbolConversionTable, obj[eid])
|
||||
+ '";'
|
||||
+ "//{} \n".format(obj[eid])
|
||||
)
|
||||
)
|
||||
|
||||
f.write(to_unicode("\n"))
|
||||
|
||||
@@ -353,8 +386,15 @@ def writeLanguage(languageCode, defs, f):
|
||||
constants = getConstants()
|
||||
for x in constants:
|
||||
f.write(
|
||||
to_unicode("const char* " + x[0] + " = \"" +
|
||||
convStr(symbolConversionTable, x[1]) + "\";" + "//{} \n".format(x[1])))
|
||||
to_unicode(
|
||||
"const char* "
|
||||
+ x[0]
|
||||
+ ' = "'
|
||||
+ convStr(symbolConversionTable, x[1])
|
||||
+ '";'
|
||||
+ "//{} \n".format(x[1])
|
||||
)
|
||||
)
|
||||
|
||||
f.write(to_unicode("\n"))
|
||||
|
||||
@@ -362,66 +402,91 @@ def writeLanguage(languageCode, defs, f):
|
||||
f.write(to_unicode("const char* DebugMenu[] = {\n"))
|
||||
|
||||
for c in getDebugMenu():
|
||||
f.write(to_unicode("\t \"" + convStr(symbolConversionTable,
|
||||
c) + "\"," + "//{} \n".format(c)))
|
||||
f.write(
|
||||
to_unicode(
|
||||
'\t "' + convStr(symbolConversionTable, c) + '",' + "//{} \n".format(c)
|
||||
)
|
||||
)
|
||||
f.write(to_unicode("};\n\n"))
|
||||
|
||||
# ----- Writing SettingsDescriptions
|
||||
obj = lang['menuOptions']
|
||||
obj = lang["menuOptions"]
|
||||
f.write(to_unicode("const char* SettingsShortNames[][2] = {\n"))
|
||||
|
||||
maxLen = 25
|
||||
index = 0
|
||||
for mod in defs['menuOptions']:
|
||||
eid = mod['id']
|
||||
if 'feature' in mod:
|
||||
f.write(to_unicode("#ifdef " + mod['feature'] + "\n"))
|
||||
f.write(to_unicode(" /* ["+"{:02d}".format(index)+"] " + eid.ljust(maxLen)[:maxLen] + " */ "))
|
||||
for mod in defs["menuOptions"]:
|
||||
eid = mod["id"]
|
||||
if "feature" in mod:
|
||||
f.write(to_unicode("#ifdef " + mod["feature"] + "\n"))
|
||||
f.write(
|
||||
to_unicode(
|
||||
"{ \"" +
|
||||
convStr(symbolConversionTable, (obj[eid]['text2'][0])) +
|
||||
"\", \"" +
|
||||
convStr(symbolConversionTable, (obj[eid]['text2'][1])) +
|
||||
"\" }," + "//{} \n".format(obj[eid]['text2'])))
|
||||
|
||||
if 'feature' in mod:
|
||||
" /* ["
|
||||
+ "{:02d}".format(index)
|
||||
+ "] "
|
||||
+ eid.ljust(maxLen)[:maxLen]
|
||||
+ " */ "
|
||||
)
|
||||
)
|
||||
f.write(
|
||||
to_unicode(
|
||||
'{ "'
|
||||
+ convStr(symbolConversionTable, (obj[eid]["text2"][0]))
|
||||
+ '", "'
|
||||
+ convStr(symbolConversionTable, (obj[eid]["text2"][1]))
|
||||
+ '" },'
|
||||
+ "//{} \n".format(obj[eid]["text2"])
|
||||
)
|
||||
)
|
||||
|
||||
if "feature" in mod:
|
||||
f.write(to_unicode("#endif\n"))
|
||||
index = index + 1
|
||||
index = index + 1
|
||||
|
||||
f.write(to_unicode("};\n\n"))
|
||||
|
||||
# ----- Writing Menu Groups
|
||||
obj = lang['menuGroups']
|
||||
f.write(
|
||||
to_unicode("const char* SettingsMenuEntries[" + str(len(obj)) +
|
||||
"] = {\n"))
|
||||
obj = lang["menuGroups"]
|
||||
f.write(to_unicode("const char* SettingsMenuEntries[" + str(len(obj)) + "] = {\n"))
|
||||
|
||||
maxLen = 25
|
||||
for mod in defs['menuGroups']:
|
||||
eid = mod['id']
|
||||
for mod in defs["menuGroups"]:
|
||||
eid = mod["id"]
|
||||
f.write(to_unicode(" /* " + eid.ljust(maxLen)[:maxLen] + " */ "))
|
||||
f.write(
|
||||
to_unicode("\"" +
|
||||
convStr(symbolConversionTable, (obj[eid]['text2'][0]) +
|
||||
"\\n" + obj[eid]['text2'][1]) + "\"," + "//{} \n".format(obj[eid]['text2'])))
|
||||
to_unicode(
|
||||
'"'
|
||||
+ convStr(
|
||||
symbolConversionTable,
|
||||
(obj[eid]["text2"][0]) + "\\n" + obj[eid]["text2"][1],
|
||||
)
|
||||
+ '",'
|
||||
+ "//{} \n".format(obj[eid]["text2"])
|
||||
)
|
||||
)
|
||||
|
||||
f.write(to_unicode("};\n\n"))
|
||||
|
||||
# ----- Writing Menu Groups Descriptions
|
||||
obj = lang['menuGroups']
|
||||
obj = lang["menuGroups"]
|
||||
f.write(
|
||||
to_unicode("const char* SettingsMenuEntriesDescriptions[" +
|
||||
str(len(obj)) + "] = {\n"))
|
||||
to_unicode(
|
||||
"const char* SettingsMenuEntriesDescriptions[" + str(len(obj)) + "] = {\n"
|
||||
)
|
||||
)
|
||||
|
||||
maxLen = 25
|
||||
for mod in defs['menuGroups']:
|
||||
eid = mod['id']
|
||||
for mod in defs["menuGroups"]:
|
||||
eid = mod["id"]
|
||||
f.write(to_unicode(" /* " + eid.ljust(maxLen)[:maxLen] + " */ "))
|
||||
f.write(
|
||||
to_unicode("\"" +
|
||||
convStr(symbolConversionTable, (obj[eid]['desc'])) +
|
||||
"\"," + "//{} \n".format(obj[eid]['desc'])))
|
||||
to_unicode(
|
||||
'"'
|
||||
+ convStr(symbolConversionTable, (obj[eid]["desc"]))
|
||||
+ '",'
|
||||
+ "//{} \n".format(obj[eid]["desc"])
|
||||
)
|
||||
)
|
||||
|
||||
f.write(to_unicode("};\n\n"))
|
||||
|
||||
@@ -434,36 +499,49 @@ def writeUnit(languageCode, defs, f, UnitCodes):
|
||||
lang = langDict[languageCode]
|
||||
unit = UnitDict[UnitCodes]
|
||||
try:
|
||||
langName = lang['languageLocalName']
|
||||
langName = lang["languageLocalName"]
|
||||
except KeyError:
|
||||
langName = languageCode
|
||||
f.write(to_unicode(" #ifdef LANG_" + languageCode + "\n"))
|
||||
if unit:
|
||||
if unit:
|
||||
f.write(to_unicode(" #define ENABLED_FAHRENHEIT_SUPPORT" + "\n"))
|
||||
else: f.write(to_unicode(" //#define ENABLED_FAHRENHEIT_SUPPORT" + "\n"))
|
||||
else:
|
||||
f.write(to_unicode(" //#define ENABLED_FAHRENHEIT_SUPPORT" + "\n"))
|
||||
# ----- Block end
|
||||
f.write(to_unicode(" #endif /* ---- " + langName + " ---- */\n"))
|
||||
|
||||
|
||||
def readVersion():
|
||||
with open(os.path.relpath(jsonDir +
|
||||
"/../workspace/TS100/version.h"),"r") as version_file:
|
||||
try:
|
||||
with open(
|
||||
os.path.relpath(jsonDir + "/../workspace/TS100/version.h"), "r"
|
||||
) as version_file:
|
||||
try:
|
||||
for line in version_file:
|
||||
if re.findall(r'^.*(?<=(#define)).*(?<=(BUILD_VERSION))', line):
|
||||
line = re.findall(r'\"(.+?)\"',line)
|
||||
if line:
|
||||
if re.findall(r"^.*(?<=(#define)).*(?<=(BUILD_VERSION))", line):
|
||||
line = re.findall(r"\"(.+?)\"", line)
|
||||
if line:
|
||||
version = line[0]
|
||||
try: version += "."+ subprocess.check_output(
|
||||
["git","rev-parse", "--short=7", "HEAD"]).strip().decode('ascii').upper()
|
||||
# --short=7: the shorted hash with 7 digits. Increase/decrease if needed!
|
||||
except OSError: version += " git"
|
||||
finally:
|
||||
if version_file:
|
||||
version_file.close();
|
||||
try:
|
||||
version += (
|
||||
"."
|
||||
+ subprocess.check_output(
|
||||
["git", "rev-parse", "--short=7", "HEAD"]
|
||||
)
|
||||
.strip()
|
||||
.decode("ascii")
|
||||
.upper()
|
||||
)
|
||||
# --short=7: the shorted hash with 7 digits. Increase/decrease if needed!
|
||||
except OSError:
|
||||
version += " git"
|
||||
finally:
|
||||
if version_file:
|
||||
version_file.close()
|
||||
return version
|
||||
|
||||
|
||||
def read_opts():
|
||||
""" Reading input parameters
|
||||
"""Reading input parameters
|
||||
First parameter = json directory
|
||||
Second parameter = translation directory
|
||||
Third paramter = unit directory
|
||||
@@ -478,12 +556,12 @@ def read_opts():
|
||||
else:
|
||||
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Src")
|
||||
outFileTranslationCPP = os.path.join(outDir, TRANSLATION_CPP)
|
||||
|
||||
|
||||
if len(sys.argv) > 3:
|
||||
outFileUnitH = sys.argv[3]
|
||||
else:
|
||||
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Inc")
|
||||
outFileUnitH = os.path.join(outDir,UNIT_H)
|
||||
outFileUnitH = os.path.join(outDir, UNIT_H)
|
||||
|
||||
if len(sys.argv) > 4:
|
||||
raise Exception("Too many parameters!")
|
||||
@@ -493,7 +571,7 @@ def read_opts():
|
||||
|
||||
def orderOutput(langDict):
|
||||
# These languages go first
|
||||
mandatoryOrder = ['EN']
|
||||
mandatoryOrder = ["EN"]
|
||||
|
||||
# Then add all others in alphabetical order
|
||||
sortedKeys = sorted(langDict.keys())
|
||||
@@ -508,17 +586,18 @@ def orderOutput(langDict):
|
||||
|
||||
def writeTarget(outFileTranslationCPP, outFileUnitH, defs, langCodes, UnitCodes):
|
||||
# Start writing the file
|
||||
with io.open(outFileTranslationCPP, 'w', encoding='utf-8', newline="\n") as f:
|
||||
with io.open(outFileTranslationCPP, "w", encoding="utf-8", newline="\n") as f:
|
||||
writeStart(f)
|
||||
for langCode in langCodes:
|
||||
writeLanguage(langCode, defs, f)
|
||||
|
||||
with io.open(outFileUnitH, 'w', encoding='utf-8', newline="\n") as f:
|
||||
with io.open(outFileUnitH, "w", encoding="utf-8", newline="\n") as f:
|
||||
writeStartUnit(f)
|
||||
for langCode, UnitCode in zip(langCodes, UnitCodes):
|
||||
writeUnit(langCode, defs, f, UnitCode)
|
||||
f.write(to_unicode("\n#endif /* _UNIT_H */\n"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
jsonDir, outFileTranslationCPP, outFileUnitH = read_opts()
|
||||
@@ -526,8 +605,11 @@ if __name__ == "__main__":
|
||||
print("usage: make_translation.py {json dir} {cpp dir}")
|
||||
sys.exit(1)
|
||||
|
||||
try: buildVersion = readVersion()
|
||||
except: print("error: could not get/extract build version"); sys.exit(1)
|
||||
try:
|
||||
buildVersion = readVersion()
|
||||
except:
|
||||
print("error: could not get/extract build version")
|
||||
sys.exit(1)
|
||||
|
||||
print("Build version: " + buildVersion)
|
||||
print("Making " + outFileTranslationCPP + " from " + jsonDir)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
2b9eeccc33470f9d3cda26983b9d2dc6 gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
|
||||
@@ -0,0 +1 @@
|
||||
add5b6a9b12987d0e72f55a4d2cd0f3b nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SECRETS="$DIR/encrypted/*.encrypted"
|
||||
KEY="$DIR/../../codeship.aes"
|
||||
|
||||
mkdir -p $DIR/unencrypted
|
||||
|
||||
for f in $SECRETS
|
||||
do
|
||||
out="${f/.encrypted/.secret}"
|
||||
out="${out/encrypted/unencrypted}"
|
||||
echo $out
|
||||
jet decrypt $f $out --key-path $KEY
|
||||
done
|
||||
|
||||
echo "Done"
|
||||
@@ -1,2 +0,0 @@
|
||||
codeship:v2
|
||||
DUgOERb8iPVn95/DKIw9M7sgNjJlIlsaeE4PFV58tmmBu2sD1ooR7Y0L23bimC9a
|
||||
32
setup.sh
32
setup.sh
@@ -1,15 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
# Setup shell file to setup the environment on an ubuntu machine
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y make bzip2 git python3 wget
|
||||
sudo mkdir /build
|
||||
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 wget
|
||||
sudo mkdir -p /build
|
||||
cd /build
|
||||
|
||||
sudo wget -qO- https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 | sudo tar -xj
|
||||
sudo wget -qO- https://github.com/Ralim/nuclei-compiler/releases/download/2020.08/nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2 | sudo tar -xj
|
||||
#Download source files to cache folder
|
||||
# Remember if these are updated, you need to update the md5 file respectively
|
||||
# Github checks out under $GITHUB_WORKSPACE
|
||||
MDPATH=${GITHUB_WORKSPACE:-/build/source/}
|
||||
sudo mkdir -p /build/cache
|
||||
cd /build/cache/
|
||||
if md5sum -c $MDPATH/ci/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2.md5; then
|
||||
echo "Good MD5 ARM"
|
||||
else
|
||||
echo "ARM MD5 Mismatch, downloading fresh"
|
||||
sudo wget -q https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -O gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
|
||||
fi
|
||||
|
||||
# Add compiler to the path
|
||||
if md5sum -c $MDPATH/ci/nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2.md5; then
|
||||
echo "Good MD5 RISCV"
|
||||
else
|
||||
echo "RISCV MD5 Mismatch, downloading fresh"
|
||||
sudo wget -q https://github.com/Ralim/nuclei-compiler/releases/download/2020.08/nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2 -O nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2
|
||||
fi
|
||||
|
||||
echo "Extracting compilers"
|
||||
sudo tar -xj -f gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -C /build/
|
||||
sudo tar -xj -f nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2 -C /build/
|
||||
|
||||
echo "Link into PATH"
|
||||
|
||||
sudo ln -s /build/gcc-arm-none-eabi-9-2020-q2-update/bin/* /usr/local/bin
|
||||
sudo ln -s /build/gcc/bin/* /usr/local/bin
|
||||
|
||||
@@ -13,8 +13,8 @@ volatile uint16_t PWMSafetyTimer = 0;
|
||||
volatile uint8_t pendingPWM = 0;
|
||||
|
||||
const uint16_t powerPWM = 255;
|
||||
static const uint8_t holdoffTicks = 13; // delay of 7 ms
|
||||
static const uint8_t tempMeasureTicks = 17;
|
||||
static const uint8_t holdoffTicks = 14; // delay of 8 ms
|
||||
static const uint8_t tempMeasureTicks = 14;
|
||||
|
||||
uint16_t totalPWM; //htim2.Init.Period, the full PWM cycle
|
||||
|
||||
@@ -60,37 +60,37 @@ static const uint16_t NTCHandleLookup[] = {
|
||||
22264, 27, //
|
||||
21933, 28, //
|
||||
21599, 29, //
|
||||
// 21261, 30, //
|
||||
// 20921, 31, //
|
||||
// 20579, 32, //
|
||||
// 20234, 33, //
|
||||
// 19888, 34, //
|
||||
// 19541, 35, //
|
||||
// 19192, 36, //
|
||||
// 18843, 37, //
|
||||
// 18493, 38, //
|
||||
// 18143, 39, //
|
||||
// 17793, 40, //
|
||||
// 17444, 41, //
|
||||
// 17096, 42, //
|
||||
// 16750, 43, //
|
||||
// 16404, 44, //
|
||||
// 16061, 45, //
|
||||
// 15719, 46, //
|
||||
// 15380, 47, //
|
||||
// 15044, 48, //
|
||||
// 14710, 49, //
|
||||
// 14380, 50, //
|
||||
// 14053, 51, //
|
||||
// 13729, 52, //
|
||||
// 13410, 53, //
|
||||
// 13094, 54, //
|
||||
// 12782, 55, //
|
||||
// 12475, 56, //
|
||||
// 12172, 57, //
|
||||
// 11874, 58, //
|
||||
// 11580, 59, //
|
||||
// 11292, 60, //
|
||||
21261, 30, //
|
||||
20921, 31, //
|
||||
20579, 32, //
|
||||
20234, 33, //
|
||||
19888, 34, //
|
||||
19541, 35, //
|
||||
19192, 36, //
|
||||
18843, 37, //
|
||||
18493, 38, //
|
||||
18143, 39, //
|
||||
17793, 40, //
|
||||
17444, 41, //
|
||||
17096, 42, //
|
||||
16750, 43, //
|
||||
16404, 44, //
|
||||
16061, 45, //
|
||||
// 15719, 46, //
|
||||
// 15380, 47, //
|
||||
// 15044, 48, //
|
||||
// 14710, 49, //
|
||||
// 14380, 50, //
|
||||
// 14053, 51, //
|
||||
// 13729, 52, //
|
||||
// 13410, 53, //
|
||||
// 13094, 54, //
|
||||
// 12782, 55, //
|
||||
// 12475, 56, //
|
||||
// 12172, 57, //
|
||||
// 11874, 58, //
|
||||
// 11580, 59, //
|
||||
// 11292, 60, //
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -100,13 +100,12 @@ uint16_t getHandleTemperature() {
|
||||
//NTCG104EF104FT1X from TDK
|
||||
//For now not doing interpolation
|
||||
int32_t result = getADC(0);
|
||||
for (uint32_t i = 0; i < (sizeof(NTCHandleLookup) / (2 * sizeof(uint16_t)));
|
||||
i++) {
|
||||
for (uint32_t i = 0; i < (sizeof(NTCHandleLookup) / (2 * sizeof(uint16_t))); i++) {
|
||||
if (result > NTCHandleLookup[(i * 2) + 0]) {
|
||||
return NTCHandleLookup[(i * 2) + 1] * 10;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return 45 * 10;
|
||||
#endif
|
||||
#ifdef TEMP_TMP36
|
||||
// We return the current handle temperature in X10 C
|
||||
@@ -119,9 +118,9 @@ uint16_t getHandleTemperature() {
|
||||
int32_t result = getADC(0);
|
||||
result -= 4965; // remove 0.5V offset
|
||||
// 10mV per C
|
||||
// 99.29 counts per Deg C above 0C
|
||||
// 99.29 counts per Deg C above 0C. Tends to read a tad over across all of my sample units
|
||||
result *= 100;
|
||||
result /= 993;
|
||||
result /= 994;
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
@@ -201,7 +200,7 @@ void setTipPWM(uint8_t pulse) {
|
||||
|
||||
static void switchToFastPWM(void) {
|
||||
fastPWM = true;
|
||||
totalPWM = powerPWM + tempMeasureTicks * 2;
|
||||
totalPWM = powerPWM + tempMeasureTicks * 2 + holdoffTicks;
|
||||
htim2.Instance->ARR = totalPWM;
|
||||
// ~3.5 Hz rate
|
||||
htim2.Instance->CCR1 = powerPWM + holdoffTicks * 2;
|
||||
@@ -211,7 +210,7 @@ static void switchToFastPWM(void) {
|
||||
|
||||
static void switchToSlowPWM(void) {
|
||||
fastPWM = false;
|
||||
totalPWM = powerPWM + tempMeasureTicks;
|
||||
totalPWM = powerPWM + tempMeasureTicks + holdoffTicks;
|
||||
htim2.Instance->ARR = totalPWM;
|
||||
// ~1.84 Hz rate
|
||||
htim2.Instance->CCR1 = powerPWM + holdoffTicks;
|
||||
@@ -335,12 +334,10 @@ void unstick_I2C() {
|
||||
}
|
||||
|
||||
uint8_t getButtonA() {
|
||||
return HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ?
|
||||
1 : 0;
|
||||
return HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? 1 : 0;
|
||||
}
|
||||
uint8_t getButtonB() {
|
||||
return HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ?
|
||||
1 : 0;
|
||||
return HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ? 1 : 0;
|
||||
}
|
||||
|
||||
void BSPInit(void) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_7
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_7
|
||||
#define TIP_TEMP_Pin GPIO_PIN_0
|
||||
#define TIP_TEMP_GPIO_Port GPIOB
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8
|
||||
@@ -48,6 +49,7 @@
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_4
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
|
||||
#define TIP_TEMP_Pin GPIO_PIN_3
|
||||
#define TIP_TEMP_GPIO_Port GPIOA
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
|
||||
@@ -87,6 +89,7 @@
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_4
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
|
||||
#define TIP_TEMP_Pin GPIO_PIN_3
|
||||
#define TIP_TEMP_GPIO_Port GPIOA
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
|
||||
|
||||
@@ -17,8 +17,9 @@ DMA_HandleTypeDef hdma_i2c1_tx;
|
||||
IWDG_HandleTypeDef hiwdg;
|
||||
TIM_HandleTypeDef htim2;
|
||||
TIM_HandleTypeDef htim3;
|
||||
|
||||
uint16_t ADCReadings[64]; // room for 32 lots of the pair of readings
|
||||
#define ADC_CHANNELS 2
|
||||
#define ADC_SAMPLES 16
|
||||
uint32_t ADCReadings[ADC_SAMPLES * ADC_CHANNELS]; // room for 32 lots of the pair of readings
|
||||
|
||||
// Functions
|
||||
static void SystemClock_Config(void);
|
||||
@@ -30,7 +31,6 @@ static void MX_TIM2_Init(void);
|
||||
static void MX_DMA_Init(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_ADC2_Init(void);
|
||||
#define SWD_ENABLE
|
||||
void Setup_HAL() {
|
||||
SystemClock_Config();
|
||||
|
||||
@@ -49,7 +49,7 @@ void Setup_HAL() {
|
||||
MX_TIM2_Init();
|
||||
MX_IWDG_Init();
|
||||
HAL_ADC_Start(&hadc2);
|
||||
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*) ADCReadings, 64); // start DMA of normal readings
|
||||
HAL_ADCEx_MultiModeStart_DMA(&hadc1, ADCReadings, (ADC_SAMPLES * ADC_CHANNELS)); // start DMA of normal readings
|
||||
HAL_ADCEx_InjectedStart(&hadc1); // enable injected readings
|
||||
HAL_ADCEx_InjectedStart(&hadc2); // enable injected readings
|
||||
}
|
||||
@@ -57,8 +57,12 @@ void Setup_HAL() {
|
||||
// channel 0 -> temperature sensor, 1-> VIN
|
||||
uint16_t getADC(uint8_t channel) {
|
||||
uint32_t sum = 0;
|
||||
for (uint8_t i = 0; i < 32; i++)
|
||||
sum += ADCReadings[channel + (i * 2)];
|
||||
for (uint8_t i = 0; i < ADC_SAMPLES; i++) {
|
||||
uint16_t adc1Sample = ADCReadings[channel + (i * ADC_CHANNELS)];
|
||||
uint16_t adc2Sample = ADCReadings[channel + (i * ADC_CHANNELS)] >> 16;
|
||||
|
||||
sum += (adc1Sample + adc2Sample);
|
||||
}
|
||||
return sum >> 2;
|
||||
}
|
||||
|
||||
@@ -125,7 +129,7 @@ static void MX_ADC1_Init(void) {
|
||||
hadc1.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc1.Init.NbrOfConversion = 2;
|
||||
hadc1.Init.NbrOfConversion = ADC_CHANNELS;
|
||||
HAL_ADC_Init(&hadc1);
|
||||
|
||||
/**Configure the ADC multi-mode
|
||||
@@ -136,14 +140,14 @@ static void MX_ADC1_Init(void) {
|
||||
/**Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = TMP36_ADC1_CHANNEL;
|
||||
sConfig.Rank = 1;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_71CYCLES_5;
|
||||
HAL_ADC_ConfigChannel(&hadc1, &sConfig);
|
||||
|
||||
/**Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = VIN_ADC1_CHANNEL;
|
||||
sConfig.Rank = 2;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_2;
|
||||
HAL_ADC_ConfigChannel(&hadc1, &sConfig);
|
||||
|
||||
/**Configure Injected Channel
|
||||
@@ -157,15 +161,15 @@ static void MX_ADC1_Init(void) {
|
||||
sConfigInjected.InjectedChannel = TIP_TEMP_ADC1_CHANNEL;
|
||||
sConfigInjected.InjectedRank = 1;
|
||||
sConfigInjected.InjectedNbrOfConversion = 4;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
|
||||
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
|
||||
sConfigInjected.AutoInjectedConv = DISABLE;
|
||||
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
|
||||
sConfigInjected.InjectedOffset = 0;
|
||||
|
||||
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
|
||||
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
|
||||
|
||||
sConfigInjected.InjectedRank = 2;
|
||||
HAL_ADCEx_InjectedConfigChannel(&hadc1, &sConfigInjected);
|
||||
sConfigInjected.InjectedRank = 3;
|
||||
@@ -191,15 +195,16 @@ static void MX_ADC2_Init(void) {
|
||||
hadc2.Init.DiscontinuousConvMode = DISABLE;
|
||||
hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
hadc2.Init.NbrOfConversion = 2;
|
||||
hadc2.Init.NbrOfConversion = ADC_CHANNELS;
|
||||
HAL_ADC_Init(&hadc2);
|
||||
|
||||
/**Configure Regular Channel
|
||||
*/
|
||||
sConfig.Channel = TIP_TEMP_ADC2_CHANNEL;
|
||||
sConfig.Channel = TMP36_ADC2_CHANNEL;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_71CYCLES_5;
|
||||
HAL_ADC_ConfigChannel(&hadc2, &sConfig);
|
||||
|
||||
sConfig.Channel = VIN_ADC2_CHANNEL;
|
||||
sConfig.Rank = ADC_REGULAR_RANK_2;
|
||||
HAL_ADC_ConfigChannel(&hadc2, &sConfig);
|
||||
@@ -209,7 +214,7 @@ static void MX_ADC2_Init(void) {
|
||||
sConfigInjected.InjectedChannel = TIP_TEMP_ADC2_CHANNEL;
|
||||
sConfigInjected.InjectedRank = ADC_INJECTED_RANK_1;
|
||||
sConfigInjected.InjectedNbrOfConversion = 4;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_7CYCLES_5;
|
||||
sConfigInjected.InjectedSamplingTime = ADC_SAMPLETIME_1CYCLE_5;
|
||||
sConfigInjected.ExternalTrigInjecConv = ADC_EXTERNALTRIGINJECCONV_T2_CC1;
|
||||
sConfigInjected.AutoInjectedConv = DISABLE;
|
||||
sConfigInjected.InjectedDiscontinuousConvMode = DISABLE;
|
||||
@@ -279,7 +284,7 @@ static void MX_TIM3_Init(void) {
|
||||
HAL_TIMEx_MasterConfigSynchronization(&htim3, &sMasterConfig);
|
||||
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 80; //80% duty cycle, that is AC coupled through the cap
|
||||
sConfigOC.Pulse = 50; //50% duty cycle, that is AC coupled through the cap
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
|
||||
HAL_TIM_PWM_ConfigChannel(&htim3, &sConfigOC, PWM_Out_CHANNEL);
|
||||
@@ -339,7 +344,7 @@ static void MX_TIM2_Init(void) {
|
||||
HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig);
|
||||
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
// dummy value, will be reconfigured by BSPInit()
|
||||
// dummy value, will be reconfigured by BSPInit() in the BSP.cpp
|
||||
sConfigOC.Pulse = 255 + 13 * 2; // 13 -> Delay of 7 ms
|
||||
//255 is the largest time period of the drive signal, and then offset ADC sample to be a bit delayed after this
|
||||
/*
|
||||
|
||||
@@ -41,10 +41,10 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) {
|
||||
hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_adc1.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||
hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
|
||||
hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
|
||||
hdma_adc1.Init.Mode = DMA_CIRCULAR;
|
||||
hdma_adc1.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||
hdma_adc1.Init.Priority = DMA_PRIORITY_MEDIUM;
|
||||
HAL_DMA_Init(&hdma_adc1);
|
||||
|
||||
__HAL_LINKDMA(hadc, DMA_Handle, hdma_adc1);
|
||||
@@ -62,7 +62,13 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) {
|
||||
*/
|
||||
GPIO_InitStruct.Pin = TIP_TEMP_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(TIP_TEMP_GPIO_Port, &GPIO_InitStruct);
|
||||
GPIO_InitStruct.Pin = TMP36_INPUT_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(TMP36_INPUT_GPIO_Port, &GPIO_InitStruct);
|
||||
GPIO_InitStruct.Pin = VIN_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(VIN_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* ADC2 interrupt Init */
|
||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 15, 0);
|
||||
|
||||
@@ -39,7 +39,7 @@ bool BMA223::initalize() {
|
||||
|
||||
}
|
||||
|
||||
void BMA223::getAxisReadings(int16_t& x, int16_t& y, int16_t& z) {
|
||||
void BMA223::getAxisReadings(int16_t &x, int16_t &y, int16_t &z) {
|
||||
//The BMA is odd in that its output data width is only 8 bits
|
||||
//And yet there are MSB and LSB registers _sigh_.
|
||||
uint8_t sensorData[6] = { 0, 0, 0, 0, 0, 0 };
|
||||
@@ -48,9 +48,9 @@ void BMA223::getAxisReadings(int16_t& x, int16_t& y, int16_t& z) {
|
||||
x = y = z = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
x = sensorData[1] << 5;
|
||||
y = sensorData[3] << 5;
|
||||
z = sensorData[5] << 5;
|
||||
//Shift 6 to make its range ~= the other accelerometers
|
||||
x = sensorData[1] << 6;
|
||||
y = sensorData[3] << 6;
|
||||
z = sensorData[5] << 6;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "BSP.h"
|
||||
#include "power.hpp"
|
||||
#include "../../configuration.h"
|
||||
|
||||
#include "main.hpp"
|
||||
/*
|
||||
* The hardware is laid out as a non-inverting op-amp
|
||||
* There is a pullup of 39k(TS100) from the +ve input to 3.9V (1M pulup on TS100)
|
||||
@@ -39,12 +39,15 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC) {
|
||||
|
||||
uint32_t valueuV = rawInputmVX10 * 100; // shift into uV
|
||||
//Now to divide this down by the gain
|
||||
valueuV = (valueuV) / OP_AMP_GAIN_STAGE;
|
||||
//Remove uV tipOffset
|
||||
if (valueuV >= systemSettings.CalibrationOffset)
|
||||
valueuV -= systemSettings.CalibrationOffset;
|
||||
else
|
||||
valueuV = 0;
|
||||
valueuV /= OP_AMP_GAIN_STAGE;
|
||||
|
||||
if (systemSettings.CalibrationOffset) {
|
||||
//Remove uV tipOffset
|
||||
if (valueuV >= systemSettings.CalibrationOffset)
|
||||
valueuV -= systemSettings.CalibrationOffset;
|
||||
else
|
||||
valueuV = 0;
|
||||
}
|
||||
|
||||
return valueuV;
|
||||
}
|
||||
@@ -64,22 +67,137 @@ uint32_t TipThermoModel::convertTipRawADCToDegF(uint16_t rawADC) {
|
||||
// [x1, y1] = point 1
|
||||
// [x2, y2] = point 2
|
||||
// x = input value
|
||||
// output is x's extrapolated y value
|
||||
// output is x's interpolated y value
|
||||
int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x) {
|
||||
return y1 + (((((x - x1) * 1000) / (x2 - x1)) * (y2 - y1))) / 1000;
|
||||
}
|
||||
#ifdef TEMP_uV_LOOKUP_HAKKO
|
||||
const uint16_t uVtoDegC[] = { //
|
||||
//
|
||||
0, 0, //
|
||||
266, 10, //
|
||||
522, 20, //
|
||||
770, 30, //
|
||||
1010, 40, //
|
||||
1244, 50, //
|
||||
1473, 60, //
|
||||
1697, 70, //
|
||||
1917, 80, //
|
||||
2135, 90, //
|
||||
2351, 100, //
|
||||
2566, 110, //
|
||||
2780, 120, //
|
||||
2994, 130, //
|
||||
3209, 140, //
|
||||
3426, 150, //
|
||||
3644, 160, //
|
||||
3865, 170, //
|
||||
4088, 180, //
|
||||
4314, 190, //
|
||||
4544, 200, //
|
||||
4777, 210, //
|
||||
5014, 220, //
|
||||
5255, 230, //
|
||||
5500, 240, //
|
||||
5750, 250, //
|
||||
6003, 260, //
|
||||
6261, 270, //
|
||||
6523, 280, //
|
||||
6789, 290, //
|
||||
7059, 300, //
|
||||
7332, 310, //
|
||||
7609, 320, //
|
||||
7889, 330, //
|
||||
8171, 340, //
|
||||
8456, 350, //
|
||||
8742, 360, //
|
||||
9030, 370, //
|
||||
9319, 380, //
|
||||
9607, 390, //
|
||||
9896, 400, //
|
||||
10183, 410, //
|
||||
10468, 420, //
|
||||
10750, 430, //
|
||||
11029, 440, //
|
||||
11304, 450, //
|
||||
11573, 460, //
|
||||
11835, 470, //
|
||||
12091, 480, //
|
||||
12337, 490, //
|
||||
12575, 500, //
|
||||
|
||||
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
|
||||
//based on new measurements, tip is quite linear
|
||||
//
|
||||
tipuVDelta *= 10;
|
||||
tipuVDelta /= systemSettings.TipGain;
|
||||
|
||||
#if defined( MODEL_TS80)+defined( MODEL_TS80P)>0
|
||||
tipuVDelta /= OP_AMP_GAIN_STAGE_TS100 / OP_AMP_GAIN_STAGE_TS80;
|
||||
};
|
||||
#endif
|
||||
|
||||
return tipuVDelta;
|
||||
#ifdef TEMP_uV_LOOKUP_TS80
|
||||
|
||||
const uint16_t uVtoDegC[] = { //
|
||||
//
|
||||
530 , 0, //
|
||||
1282 , 10, //
|
||||
2034 , 20, //
|
||||
2786 , 30, //
|
||||
3538 , 40, //
|
||||
4290 , 50, //
|
||||
5043 , 60, //
|
||||
5795 , 70, //
|
||||
6547 , 80, //
|
||||
7299 , 90, //
|
||||
8051 , 100, //
|
||||
8803 , 110, //
|
||||
9555 , 120, //
|
||||
10308 , 130, //
|
||||
11060 , 140, //
|
||||
11812 , 150, //
|
||||
12564 , 160, //
|
||||
13316 , 170, //
|
||||
14068 , 180, //
|
||||
14820 , 190, //
|
||||
15573 , 200, //
|
||||
16325 , 210, //
|
||||
17077 , 220, //
|
||||
17829 , 230, //
|
||||
18581 , 240, //
|
||||
19333 , 250, //
|
||||
20085 , 260, //
|
||||
20838 , 270, //
|
||||
21590 , 280, //
|
||||
22342 , 290, //
|
||||
23094 , 300, //
|
||||
23846 , 310, //
|
||||
24598 , 320, //
|
||||
25350 , 330, //
|
||||
26103 , 340, //
|
||||
26855 , 350, //
|
||||
27607 , 360, //
|
||||
28359 , 370, //
|
||||
29111 , 380, //
|
||||
29863 , 390, //
|
||||
30615 , 400, //
|
||||
31368 , 410, //
|
||||
32120 , 420, //
|
||||
32872 , 430, //
|
||||
33624 , 440, //
|
||||
34376 , 450, //
|
||||
35128 , 460, //
|
||||
35880 , 470, //
|
||||
36632 , 480, //
|
||||
37385 , 490, //
|
||||
38137 , 500, //
|
||||
};
|
||||
#endif
|
||||
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
|
||||
if (tipuVDelta) {
|
||||
int noItems = sizeof(uVtoDegC) / (2 * sizeof(uint16_t));
|
||||
for (int i = 1; i < (noItems - 1); i++) {
|
||||
//If current tip temp is less than current lookup, then this current lookup is the higher point to interpolate
|
||||
if (tipuVDelta < uVtoDegC[i * 2]) {
|
||||
return LinearInterpolate(uVtoDegC[(i - 1) * 2], uVtoDegC[((i - 1) * 2) + 1], uVtoDegC[i * 2], uVtoDegC[(i * 2) + 1], tipuVDelta);
|
||||
}
|
||||
}
|
||||
return LinearInterpolate(uVtoDegC[(noItems - 2) * 2], uVtoDegC[((noItems - 2) * 2) + 1], uVtoDegC[(noItems - 1) * 2], uVtoDegC[((noItems - 1) * 2) + 1], tipuVDelta);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
@@ -89,13 +207,14 @@ uint32_t TipThermoModel::convertuVToDegF(uint32_t tipuVDelta) {
|
||||
|
||||
uint32_t TipThermoModel::convertCtoF(uint32_t degC) {
|
||||
//(Y °C × 9/5) + 32 =Y°F
|
||||
return 32 + ((degC * 9) / 5);
|
||||
return (32 + ((degC * 9) / 5));
|
||||
}
|
||||
|
||||
uint32_t TipThermoModel::convertFtoC(uint32_t degF) {
|
||||
//(Y°F − 32) × 5/9 = Y°C
|
||||
if (degF < 32)
|
||||
return 0;
|
||||
if (degF < 32) {
|
||||
return 0;
|
||||
}
|
||||
return ((degF - 32) * 5) / 9;
|
||||
}
|
||||
#endif
|
||||
@@ -113,10 +232,8 @@ uint32_t TipThermoModel::getTipInC(bool sampleNow) {
|
||||
}
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
uint32_t TipThermoModel::getTipInF(bool sampleNow) {
|
||||
uint32_t currentTipTempInF = TipThermoModel::convertTipRawADCToDegF(
|
||||
getTipRawTemp(sampleNow));
|
||||
currentTipTempInF += convertCtoF(getHandleTemperature() / 10); //Add handle offset
|
||||
currentTipTempInF += x10WattHistory.average() / 45; // 25 * 9 / 5, see getTipInC
|
||||
uint32_t currentTipTempInF = getTipInC(sampleNow);
|
||||
currentTipTempInF = convertCtoF(currentTipTempInF);
|
||||
return currentTipTempInF;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,6 @@ typedef struct {
|
||||
|
||||
uint8_t powerLimit; // Maximum power iron allowed to output
|
||||
|
||||
uint16_t TipGain; // uV/C * 10, it can be used to convert tip thermocouple voltage to temperateture TipV/TipGain = TipTemp
|
||||
|
||||
uint8_t ReverseButtonTempChangeEnabled; // Change the plus and minus button assigment
|
||||
uint16_t TempChangeLongStep; // Change the plus and minus button assigment
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
#include "stdint.h"
|
||||
extern const uint8_t USER_FONT_12[];
|
||||
extern const uint8_t USER_FONT_6x8[];
|
||||
/*
|
||||
* When SettingsShortNameType is SHORT_NAME_SINGLE_LINE
|
||||
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
|
||||
*/
|
||||
|
||||
extern const char *SettingsShortNames[29][2];
|
||||
extern const char *SettingsDescriptions[29];
|
||||
extern const char *SettingsMenuEntries[4];
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
#pragma once
|
||||
/**
|
||||
* Configuration.h
|
||||
* Define here your default pre settings for TS80 or TS100
|
||||
*
|
||||
*/
|
||||
|
||||
//===========================================================================
|
||||
//============================= Default Settings ============================
|
||||
//===========================================================================
|
||||
/**
|
||||
* Default soldering temp is 320.0 C
|
||||
* Temperature the iron sleeps at - default 150.0 C
|
||||
*/
|
||||
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
|
||||
#define SLEEP_TEMP 150 // Default sleep temperature
|
||||
#define BOOST_TEMP 420 // Default boost temp.
|
||||
#define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable
|
||||
|
||||
/**
|
||||
* Blink the temperature on the cooling screen when its > 50C
|
||||
*/
|
||||
#define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable
|
||||
|
||||
/**
|
||||
* How many seconds/minutes we wait until going to sleep/shutdown.
|
||||
* Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds!
|
||||
*/
|
||||
#define SLEEP_TIME 5 // x10 Seconds
|
||||
#define SHUTDOWN_TIME 10 // Minutes
|
||||
|
||||
/**
|
||||
* Auto start off for safety.
|
||||
* Pissible values are:
|
||||
* 0 - none
|
||||
* 1 - Soldering Temperature
|
||||
* 2 - Sleep Temperature
|
||||
* 3 - Sleep Off Temperature
|
||||
*/
|
||||
#define AUTO_START_MODE 0 // Default to none
|
||||
|
||||
/**
|
||||
* OLED Orientation
|
||||
*
|
||||
*/
|
||||
#define ORIENTATION_MODE 0 // 0: Right 1:Left 2:Automatic - Default right
|
||||
#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperatur change
|
||||
|
||||
/**
|
||||
* Temp change settings
|
||||
*/
|
||||
#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1
|
||||
#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10
|
||||
#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value
|
||||
#define TEMP_CHANGE_LONG_STEP_MAX 100 // Temp change long step MAX value
|
||||
|
||||
/* Power pulse for keeping power banks awake*/
|
||||
#define POWER_PULSE_INCREMENT 1
|
||||
#define POWER_PULSE_MAX 50 // x10 max watts
|
||||
#ifdef MODEL_TS100
|
||||
#define POWER_PULSE_DEFAULT 0
|
||||
#else
|
||||
#define POWER_PULSE_DEFAULT 5
|
||||
#endif
|
||||
|
||||
/**
|
||||
* OLED Orientation Sensitivity on Automatic mode!
|
||||
* Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive>
|
||||
*/
|
||||
#define SENSITIVITY 7 // Default 7
|
||||
|
||||
/**
|
||||
* Detailed soldering screen
|
||||
* Detailed idle screen (off for first time users)
|
||||
*/
|
||||
#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0
|
||||
#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0
|
||||
|
||||
#define CUT_OUT_SETTING 0 // default to no cut-off voltage (or 18W for TS80)
|
||||
#define TEMPERATURE_INF 0 // default to 0
|
||||
#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow
|
||||
#define POWER_LIMIT_ENABLE 0 // 0: Disable 1: Enable - Default disabled power limit
|
||||
|
||||
#define TIP_GAIN 210 // 21 uV/C * 10, uV per deg C constant of the tip, Tip uV * 10 / coeff = tip temp
|
||||
|
||||
#define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1
|
||||
#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2
|
||||
|
||||
#define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100))
|
||||
|
||||
#define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6
|
||||
#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3
|
||||
|
||||
#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80))
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
#define VOLTAGE_DIV 467 // 467 - Default divider from schematic
|
||||
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
|
||||
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 30 // 30 watts default limit
|
||||
#define MAX_POWER_LIMIT 65 //
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80
|
||||
#define VOLTAGE_DIV 780 // Default divider from schematic
|
||||
#define PID_POWER_LIMIT 24 // Sets the max pwm power limit
|
||||
#define CALIBRATION_OFFSET 900 // the adc offset in uV
|
||||
#define POWER_LIMIT 24 // 24 watts default power limit
|
||||
#define MAX_POWER_LIMIT 30 //
|
||||
#define POWER_LIMIT_STEPS 2
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_Pinecil
|
||||
#define VOLTAGE_DIV 467 // 467 - Default divider from schematic
|
||||
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
|
||||
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 30 // 30 watts default limit
|
||||
#define MAX_POWER_LIMIT 65 //
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100
|
||||
#endif
|
||||
@@ -77,7 +77,6 @@ void resetSettings() {
|
||||
systemSettings.TempChangeShortStep = TEMP_CHANGE_SHORT_STEP; //
|
||||
systemSettings.TempChangeLongStep = TEMP_CHANGE_LONG_STEP; //
|
||||
systemSettings.KeepAwakePulse = POWER_PULSE_DEFAULT;
|
||||
systemSettings.TipGain = TIP_GAIN;
|
||||
systemSettings.hallEffectSensitivity = 1;
|
||||
saveSettings(); // Save defaults
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ static bool settings_setResetSettings(void);
|
||||
static void settings_displayResetSettings(void);
|
||||
static bool settings_setCalibrate(void);
|
||||
static void settings_displayCalibrate(void);
|
||||
static bool settings_setTipGain(void);
|
||||
static void settings_displayTipGain(void);
|
||||
//static bool settings_setTipGain(void);
|
||||
//static void settings_displayTipGain(void);
|
||||
static bool settings_setCalibrateVIN(void);
|
||||
static void settings_displayCalibrateVIN(void);
|
||||
static void settings_displayReverseButtonTempChangeEnabled(void);
|
||||
@@ -212,7 +212,7 @@ const menuitem advancedMenu[] = {
|
||||
{ (const char *) SettingsDescriptions[11], settings_setCalibrate, settings_displayCalibrate }, /*Calibrate tip*/
|
||||
{ (const char *) SettingsDescriptions[13], settings_setCalibrateVIN, settings_displayCalibrateVIN }, /*Voltage input cal*/
|
||||
{ (const char *) SettingsDescriptions[24], settings_setPowerPulse, settings_displayPowerPulse }, /*Power Pulse adjustment */
|
||||
{ (const char *) SettingsDescriptions[25], settings_setTipGain, settings_displayTipGain }, /*TipGain*/
|
||||
//{ (const char *) SettingsDescriptions[25], settings_setTipGain, settings_displayTipGain }, /*TipGain*/
|
||||
{ NULL, NULL, NULL } // end of menu marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
@@ -778,53 +778,53 @@ static bool settings_setCalibrateVIN(void) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool settings_setTipGain(void) {
|
||||
OLED::setFont(0);
|
||||
OLED::clearScreen();
|
||||
|
||||
for (;;) {
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::printNumber(systemSettings.TipGain / 10, 2);
|
||||
OLED::print(SymbolDot);
|
||||
OLED::printNumber(systemSettings.TipGain % 10, 1);
|
||||
|
||||
ButtonState buttons = getButtonState();
|
||||
switch (buttons) {
|
||||
case BUTTON_F_SHORT:
|
||||
systemSettings.TipGain -= 1;
|
||||
break;
|
||||
|
||||
case BUTTON_B_SHORT:
|
||||
systemSettings.TipGain += 1;
|
||||
break;
|
||||
|
||||
case BUTTON_BOTH:
|
||||
case BUTTON_F_LONG:
|
||||
case BUTTON_B_LONG:
|
||||
saveSettings();
|
||||
return false;
|
||||
case BUTTON_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
OLED::refresh();
|
||||
osDelay(40);
|
||||
|
||||
// Cap to sensible values
|
||||
if (systemSettings.TipGain < 150) {
|
||||
systemSettings.TipGain = 150;
|
||||
} else if (systemSettings.TipGain > 300) {
|
||||
systemSettings.TipGain = 300;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void settings_displayTipGain(void) {
|
||||
printShortDescription(25, 5);
|
||||
}
|
||||
//
|
||||
//static bool settings_setTipGain(void) {
|
||||
// OLED::setFont(0);
|
||||
// OLED::clearScreen();
|
||||
//
|
||||
// for (;;) {
|
||||
// OLED::setCursor(0, 0);
|
||||
// OLED::printNumber(systemSettings.TipGain / 10, 2);
|
||||
// OLED::print(SymbolDot);
|
||||
// OLED::printNumber(systemSettings.TipGain % 10, 1);
|
||||
//
|
||||
// ButtonState buttons = getButtonState();
|
||||
// switch (buttons) {
|
||||
// case BUTTON_F_SHORT:
|
||||
// systemSettings.TipGain -= 1;
|
||||
// break;
|
||||
//
|
||||
// case BUTTON_B_SHORT:
|
||||
// systemSettings.TipGain += 1;
|
||||
// break;
|
||||
//
|
||||
// case BUTTON_BOTH:
|
||||
// case BUTTON_F_LONG:
|
||||
// case BUTTON_B_LONG:
|
||||
// saveSettings();
|
||||
// return false;
|
||||
// case BUTTON_NONE:
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// OLED::refresh();
|
||||
// osDelay(40);
|
||||
//
|
||||
// // Cap to sensible values
|
||||
// if (systemSettings.TipGain < 150) {
|
||||
// systemSettings.TipGain = 150;
|
||||
// } else if (systemSettings.TipGain > 300) {
|
||||
// systemSettings.TipGain = 300;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
//
|
||||
//static void settings_displayTipGain(void) {
|
||||
// printShortDescription(25, 5);
|
||||
//}
|
||||
|
||||
static bool settings_setReverseButtonTempChangeEnabled(void) {
|
||||
systemSettings.ReverseButtonTempChangeEnabled = !systemSettings.ReverseButtonTempChangeEnabled;
|
||||
|
||||
@@ -23,6 +23,9 @@ extern "C" {
|
||||
#include <gui.hpp>
|
||||
#include <history.hpp>
|
||||
#include <power.hpp>
|
||||
#ifdef POW_PD
|
||||
#include "policy_engine.h"
|
||||
#endif
|
||||
// File local variables
|
||||
extern uint32_t currentTempTargetDegC;
|
||||
extern TickType_t lastMovementTime;
|
||||
@@ -66,24 +69,24 @@ void gui_drawTipTemp(bool symbol) {
|
||||
Temp = TipThermoModel::getTipInC();
|
||||
}
|
||||
|
||||
OLED::printNumber(Temp, 3); // Draw the tip temp out finally
|
||||
OLED::printNumber(Temp, 3); // Draw the tip temp out
|
||||
if (symbol) {
|
||||
if (OLED::getFont() == 0) {
|
||||
// Big font, can draw nice symbols
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::drawSymbol(0);
|
||||
OLED::drawSymbol(0);
|
||||
else
|
||||
#endif
|
||||
OLED::drawSymbol(1);
|
||||
OLED::drawSymbol(1);
|
||||
} else {
|
||||
// Otherwise fall back to chars
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::print(SymbolDegF);
|
||||
OLED::print(SymbolDegF);
|
||||
else
|
||||
#endif
|
||||
OLED::print(SymbolDegC);
|
||||
OLED::print(SymbolDegC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,9 +237,9 @@ static void gui_solderingTempAdjust() {
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF) {
|
||||
if (systemSettings.SolderingTemp > 850)
|
||||
systemSettings.SolderingTemp = 850;
|
||||
systemSettings.SolderingTemp = 850;
|
||||
if (systemSettings.SolderingTemp < 60)
|
||||
systemSettings.SolderingTemp = 60;
|
||||
systemSettings.SolderingTemp = 60;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -263,7 +266,7 @@ static void gui_solderingTempAdjust() {
|
||||
OLED::printNumber(systemSettings.SolderingTemp, 3);
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::drawSymbol(0);
|
||||
OLED::drawSymbol(0);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -313,11 +316,7 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
||||
#endif
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF) {
|
||||
currentTempTargetDegC =
|
||||
stayOff
|
||||
? 0
|
||||
: TipThermoModel::convertFtoC(min(systemSettings.SleepTemp,
|
||||
systemSettings.SolderingTemp));
|
||||
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -327,7 +326,7 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
||||
uint16_t tipTemp;
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
tipTemp = TipThermoModel::getTipInF();
|
||||
tipTemp = TipThermoModel::getTipInF();
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -344,7 +343,7 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
||||
OLED::printNumber(tipTemp, 3);
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::print(SymbolDegF);
|
||||
OLED::print(SymbolDegF);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -360,7 +359,7 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
||||
OLED::printNumber(tipTemp, 3);
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::drawSymbol(0);
|
||||
OLED::drawSymbol(0);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -474,7 +473,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
OLED::print (UnlockingKeysString);
|
||||
OLED::print(UnlockingKeysString);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(1000);
|
||||
break;
|
||||
@@ -494,7 +493,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
OLED::print (WarningKeysLockedString);
|
||||
OLED::print(WarningKeysLockedString);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(500);
|
||||
break;
|
||||
@@ -535,7 +534,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
OLED::print (LockingKeysString);
|
||||
OLED::print(LockingKeysString);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(1000);
|
||||
}
|
||||
@@ -608,8 +607,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (boostModeOn) {
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
currentTempTargetDegC =
|
||||
TipThermoModel::convertFtoC(systemSettings.BoostTemp);
|
||||
currentTempTargetDegC = TipThermoModel::convertFtoC(systemSettings.BoostTemp);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -618,8 +616,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
} else {
|
||||
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||
if (systemSettings.temperatureInF)
|
||||
currentTempTargetDegC =
|
||||
TipThermoModel::convertFtoC(systemSettings.SolderingTemp);
|
||||
currentTempTargetDegC = TipThermoModel::convertFtoC(systemSettings.SolderingTemp);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -703,6 +700,35 @@ void showDebugMenu(void) {
|
||||
// Print PCB ID number
|
||||
OLED::printNumber(PCBVersion, 2);
|
||||
break;
|
||||
case 11:
|
||||
// Power negotiation status
|
||||
if (getIsPoweredByDCIN()) {
|
||||
OLED::printNumber(0, 1);
|
||||
} else {
|
||||
//We are not powered via DC, so want to display the appropriate state for PD or QC
|
||||
bool poweredbyPD = false;
|
||||
#ifdef POW_PD
|
||||
if (usb_pd_detect()){
|
||||
//We are PD capable
|
||||
if (PolicyEngine::pdHasNegotiated()) {
|
||||
//We are powered via PD
|
||||
poweredbyPD=true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (poweredbyPD) {
|
||||
|
||||
OLED::printNumber(2, 1);
|
||||
} else {
|
||||
|
||||
OLED::printNumber(1, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
//Max deg C limit
|
||||
OLED::printNumber(TipThermoModel::getTipMaxInC(), 3);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -713,7 +739,7 @@ void showDebugMenu(void) {
|
||||
return;
|
||||
else if (b == BUTTON_F_SHORT) {
|
||||
screen++;
|
||||
screen = screen % 11;
|
||||
screen = screen % 13;
|
||||
}
|
||||
GUIDelay();
|
||||
}
|
||||
@@ -726,6 +752,7 @@ void startGUITask(void const *argument __unused) {
|
||||
uint8_t tempWarningState = 0;
|
||||
bool buttonLockout = false;
|
||||
bool tempOnDisplay = false;
|
||||
bool tipDisconnectedDisplay = false;
|
||||
{
|
||||
// Generate the flipped screen into ram for later use
|
||||
// flipped is generated by flipping each row
|
||||
@@ -822,19 +849,20 @@ void startGUITask(void const *argument __unused) {
|
||||
// the tip temperature is below 50 degrees C *and* motion sleep
|
||||
// detection is enabled *and* there has been no activity (movement or
|
||||
// button presses) in a while.
|
||||
// This is zero cost really as state is only changed on display updates
|
||||
OLED::setDisplayState(OLED::DisplayState::ON);
|
||||
|
||||
if ((tipTemp < 50) && systemSettings.sensitivity && (((xTaskGetTickCount() - lastMovementTime) >
|
||||
MOVEMENT_INACTIVITY_TIME) && ((xTaskGetTickCount() - lastButtonTime) > BUTTON_INACTIVITY_TIME))) {
|
||||
OLED::setDisplayState(OLED::DisplayState::OFF);
|
||||
}
|
||||
|
||||
uint16_t tipDisconnectedThres = TipThermoModel::getTipMaxInC() - 5;
|
||||
// Clear the lcd buffer
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
if (systemSettings.detailedIDLE) {
|
||||
OLED::setFont(1);
|
||||
if (tipTemp > 470) {
|
||||
if (tipTemp > tipDisconnectedThres) {
|
||||
OLED::print(TipDisconnectedString);
|
||||
} else {
|
||||
OLED::print(IdleTipString);
|
||||
@@ -863,11 +891,16 @@ void startGUITask(void const *argument __unused) {
|
||||
OLED::setCursor(84, 0);
|
||||
gui_drawBatteryIcon();
|
||||
}
|
||||
tipDisconnectedDisplay = false;
|
||||
if (tipTemp > 55)
|
||||
tempOnDisplay = true;
|
||||
else if (tipTemp < 45)
|
||||
tempOnDisplay = false;
|
||||
if (tempOnDisplay) {
|
||||
if (tipTemp > tipDisconnectedThres) {
|
||||
tempOnDisplay = false;
|
||||
tipDisconnectedDisplay = true;
|
||||
}
|
||||
if (tempOnDisplay || tipDisconnectedDisplay) {
|
||||
// draw temp over the start soldering button
|
||||
// Location changes on screen rotation
|
||||
#ifdef OLED_FLIP
|
||||
@@ -883,11 +916,15 @@ void startGUITask(void const *argument __unused) {
|
||||
OLED::fillArea(0, 0, 41, 16, 0); // clear the area
|
||||
OLED::setCursor(0, 0);
|
||||
}
|
||||
// draw in the temp
|
||||
if (!(systemSettings.coolingTempBlink && (xTaskGetTickCount() % 25 < 16)))
|
||||
gui_drawTipTemp(false); // draw in the temp
|
||||
//If we have a tip connected draw the temp, if not we leave it blank
|
||||
if (!tipDisconnectedDisplay) {
|
||||
// draw in the temp
|
||||
if (!(systemSettings.coolingTempBlink && (xTaskGetTickCount() % 250 < 160)))
|
||||
gui_drawTipTemp(false); // draw in the temp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OLED::refresh();
|
||||
GUIDelay();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
#define TEMPERATURE_INF 0 // default to 0
|
||||
#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow
|
||||
|
||||
#define TIP_GAIN 210 // 21 uV/C * 10, uV per deg C constant of the tip, Tip uV * 10 / coeff = tip temp
|
||||
|
||||
#define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1
|
||||
#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2
|
||||
@@ -103,6 +102,7 @@
|
||||
|
||||
#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80))
|
||||
|
||||
|
||||
//Deriving the Voltage div:
|
||||
// Vin_max = (3.3*(r1+r2))/(r2)
|
||||
//vdiv = (32768*4)/(vin_max*10)
|
||||
@@ -115,6 +115,7 @@
|
||||
#define MAX_POWER_LIMIT 65 //
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100
|
||||
#define TEMP_uV_LOOKUP_HAKKO
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_Pinecil
|
||||
@@ -125,6 +126,7 @@
|
||||
#define MAX_POWER_LIMIT 65 //
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100
|
||||
#define TEMP_uV_LOOKUP_HAKKO
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80
|
||||
@@ -135,20 +137,22 @@
|
||||
#define MAX_POWER_LIMIT 30 //
|
||||
#define POWER_LIMIT_STEPS 2
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80
|
||||
#define TEMP_uV_LOOKUP_TS80
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80P
|
||||
#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors
|
||||
#define PID_POWER_LIMIT 35 // Sets the max pwm power limit
|
||||
#define CALIBRATION_OFFSET 900 // the adc offset in uV
|
||||
#define CALIBRATION_OFFSET 1500 // the adc offset in uV
|
||||
#define POWER_LIMIT 30 // 30 watts default power limit
|
||||
#define MAX_POWER_LIMIT 35 //
|
||||
#define POWER_LIMIT_STEPS 2
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80
|
||||
#define TEMP_uV_LOOKUP_TS80
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
const int32_t tipMass = 45; // X10 watts to raise 1 deg C in 1 second
|
||||
const int32_t tipMass = 65; // X10 watts to raise 1 deg C in 1 second
|
||||
const uint8_t tipResistance = 75; //x10 ohms, 7.5 typical for ts100 tips
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user