1
0
forked from me/IronOS

Expand debug menu

This commit is contained in:
Ben V. Brown
2020-12-29 13:16:49 +11:00
parent 7ea6d4afbd
commit 357f073e1d
4 changed files with 387 additions and 195 deletions

View 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.

View File

@@ -1,4 +1,4 @@
# Upgrading your iron
# Flashing / Upgrading your iron
## Miniware irons (TS100, TS80, TS80P)

View File

@@ -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.
# ...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'])))
" /* ["
+ "{: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:
if "feature" in mod:
f.write(to_unicode("#endif\n"))
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:
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:
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 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()
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"
except OSError:
version += " git"
finally:
if version_file:
version_file.close();
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
@@ -483,7 +561,7 @@ def read_opts():
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)

View File

@@ -313,11 +313,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
{
@@ -474,7 +470,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 +490,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 +531,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 +604,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 +613,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 +697,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 +736,7 @@ void showDebugMenu(void) {
return;
else if (b == BUTTON_F_SHORT) {
screen++;
screen = screen % 11;
screen = screen % 13;
}
GUIDelay();
}
@@ -726,6 +749,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 +846,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 +888,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 +913,15 @@ void startGUITask(void const *argument __unused) {
OLED::fillArea(0, 0, 41, 16, 0); // clear the area
OLED::setCursor(0, 0);
}
//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() % 25 < 16)))
if (!(systemSettings.coolingTempBlink && (xTaskGetTickCount() % 250 < 160)))
gui_drawTipTemp(false); // draw in the temp
}
}
}
OLED::refresh();
GUIDelay();
}