Add tip resistance view

This commit is contained in:
Ben V. Brown
2022-07-01 19:37:13 +10:00
parent 39b7fe1e45
commit 1b43f71a2e
3 changed files with 15 additions and 9 deletions

View File

@@ -130,6 +130,7 @@ def get_debug_menu() -> List[str]:
"PWR ", "PWR ",
"ID ", "ID ",
"Max ", "Max ",
"Tip Res",
"HW G ", "HW G ",
"HW M ", "HW M ",
"HW P ", "HW P ",

View File

@@ -248,7 +248,6 @@ void startMeasureTipResistance() {
lastTipReadinguV = TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0)); lastTipReadinguV = TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0));
gpio_write(TIP_RESISTANCE_SENSE, 1); gpio_write(TIP_RESISTANCE_SENSE, 1);
} }
void FinishMeasureTipResistance() { void FinishMeasureTipResistance() {
gpio_write(TIP_RESISTANCE_SENSE, 0); gpio_write(TIP_RESISTANCE_SENSE, 0);
// read the tip uV with the current source on // read the tip uV with the current source on
@@ -261,10 +260,10 @@ void FinishMeasureTipResistance() {
newReading -= lastTipReadinguV; newReading -= lastTipReadinguV;
// As we are only detecting two resistances; we can split the difference for now // As we are only detecting two resistances; we can split the difference for now
uint8_t newRes = 0; uint8_t newRes = 0;
if (newReading > 5000) { if (newReading > 8000) {
return; // Change nothing as probably disconnected tip return; // Change nothing as probably disconnected tip
} else if (newReading < 4000) { } else if (newReading < 5000) {
newRes = 60; newRes = 62;
} else { } else {
newRes = 80; newRes = 80;
} }

View File

@@ -775,19 +775,25 @@ void showDebugMenu(void) {
OLED::printNumber(TipThermoModel::getTipMaxInC(), 3, FontStyle::SMALL); OLED::printNumber(TipThermoModel::getTipMaxInC(), 3, FontStyle::SMALL);
break; break;
case 11: case 11:
// Tip resistance
OLED::printNumber(getTipResitanceX10() / 10, 2, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::printNumber(getTipResitanceX10() % 10, 1, FontStyle::SMALL);
case 12:
// High water mark for GUI // High water mark for GUI
OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL); OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL);
break; break;
case 12: case 13:
// High water mark for the Movement task // High water mark for the Movement task
OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5, FontStyle::SMALL); OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5, FontStyle::SMALL);
break; break;
case 13: case 14:
// High water mark for the PID task // High water mark for the PID task
OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5, FontStyle::SMALL); OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5, FontStyle::SMALL);
break; break;
break;
#ifdef HALL_SENSOR #ifdef HALL_SENSOR
case 14: case 15:
// Print raw hall effect value if availabe, none if hall effect disabled. // Print raw hall effect value if availabe, none if hall effect disabled.
{ {
int16_t hallEffectStrength = getRawHallEffect(); int16_t hallEffectStrength = getRawHallEffect();
@@ -809,9 +815,9 @@ void showDebugMenu(void) {
else if (b == BUTTON_F_SHORT) { else if (b == BUTTON_F_SHORT) {
screen++; screen++;
#ifdef HALL_SENSOR #ifdef HALL_SENSOR
screen = screen % 15; screen = screen % 16;
#else #else
screen = screen % 14; screen = screen % 15;
#endif #endif
} }
GUIDelay(); GUIDelay();