mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-22 01:37:52 +00:00
Check for null screen
This commit is contained in:
@@ -37,7 +37,8 @@ int32_t BMX160Sensor::runOnce()
|
||||
if (!showingScreen) {
|
||||
powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration
|
||||
showingScreen = true;
|
||||
screen->startAlert((FrameCallback)drawFrameCalibration);
|
||||
if (screen)
|
||||
screen->startAlert((FrameCallback)drawFrameCalibration);
|
||||
}
|
||||
|
||||
if (magAccel.x > highestX)
|
||||
@@ -58,7 +59,8 @@ int32_t BMX160Sensor::runOnce()
|
||||
doCalibration = false;
|
||||
endCalibrationAt = 0;
|
||||
showingScreen = false;
|
||||
screen->endAlert();
|
||||
if (screen)
|
||||
screen->endAlert();
|
||||
}
|
||||
|
||||
// LOG_DEBUG("BMX160 min_x: %.4f, max_X: %.4f, min_Y: %.4f, max_Y: %.4f, min_Z: %.4f, max_Z: %.4f", lowestX, highestX,
|
||||
@@ -103,8 +105,8 @@ int32_t BMX160Sensor::runOnce()
|
||||
heading += 270;
|
||||
break;
|
||||
}
|
||||
|
||||
screen->setHeading(heading);
|
||||
if (screen)
|
||||
screen->setHeading(heading);
|
||||
#endif
|
||||
|
||||
return MOTION_SENSOR_CHECK_INTERVAL_MS;
|
||||
@@ -118,7 +120,8 @@ void BMX160Sensor::calibrate(uint16_t forSeconds)
|
||||
doCalibration = true;
|
||||
uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided
|
||||
endCalibrationAt = millis() + calibrateFor;
|
||||
screen->setEndCalibration(endCalibrationAt);
|
||||
if (screen)
|
||||
screen->setEndCalibration(endCalibrationAt);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ int32_t ICM20948Sensor::runOnce()
|
||||
if (!showingScreen) {
|
||||
powerFSM.trigger(EVENT_PRESS); // keep screen alive during calibration
|
||||
showingScreen = true;
|
||||
screen->startAlert((FrameCallback)drawFrameCalibration);
|
||||
if (screen)
|
||||
screen->startAlert((FrameCallback)drawFrameCalibration);
|
||||
}
|
||||
|
||||
if (magX > highestX)
|
||||
@@ -81,7 +82,8 @@ int32_t ICM20948Sensor::runOnce()
|
||||
doCalibration = false;
|
||||
endCalibrationAt = 0;
|
||||
showingScreen = false;
|
||||
screen->endAlert();
|
||||
if (screen)
|
||||
screen->endAlert();
|
||||
}
|
||||
|
||||
// LOG_DEBUG("ICM20948 min_x: %.4f, max_X: %.4f, min_Y: %.4f, max_Y: %.4f, min_Z: %.4f, max_Z: %.4f", lowestX, highestX,
|
||||
@@ -124,8 +126,8 @@ int32_t ICM20948Sensor::runOnce()
|
||||
heading += 270;
|
||||
break;
|
||||
}
|
||||
|
||||
screen->setHeading(heading);
|
||||
if (screen)
|
||||
screen->setHeading(heading);
|
||||
#endif
|
||||
|
||||
// Wake on motion using polling - this is not as efficient as using hardware interrupt pin (see above)
|
||||
@@ -159,7 +161,8 @@ void ICM20948Sensor::calibrate(uint16_t forSeconds)
|
||||
doCalibration = true;
|
||||
uint16_t calibrateFor = forSeconds * 1000; // calibrate for seconds provided
|
||||
endCalibrationAt = millis() + calibrateFor;
|
||||
screen->setEndCalibration(endCalibrationAt);
|
||||
if (screen)
|
||||
screen->setEndCalibration(endCalibrationAt);
|
||||
#endif
|
||||
}
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user