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

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

View File

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