Add support for reporting MMU errors via S3 msg

pull/71/head
D.R.racer 2021-07-26 08:45:27 +02:00 committed by DRracer
parent 6af65bc4c8
commit 8a1df52d79
3 changed files with 20 additions and 0 deletions

View File

@ -190,6 +190,11 @@ void ReportVersion(const mp::RequestMsg &rq) {
case 2:
v = project_version_revision;
break;
case 3:
// @@TODO may be allow reporting uint16_t number of errors,
// but anything beyond 255 errors means there is something seriously wrong with the MMU
v = mg::globals.DriveErrors();
break;
default:
v = 0;
break;

View File

@ -28,5 +28,13 @@ void Globals::SetFilamentLoaded(bool newFilamentLoaded) {
filamentLoaded = newFilamentLoaded;
}
uint16_t Globals::DriveErrors() const {
return modules::permanent_storage::DriveError::get();
}
void Globals::IncDriveErrors() {
modules::permanent_storage::DriveError::increment();
}
} // namespace globals
} // namespace modules

View File

@ -33,6 +33,13 @@ public:
/// @param newFilamentLoaded new state
void SetFilamentLoaded(bool newFilamentLoaded);
/// @returns the total number of MMU errors so far
/// Errors are stored in the EEPROM
uint16_t DriveErrors() const;
/// Increment MMU errors by 1
void IncDriveErrors();
private:
uint8_t activeSlot;
bool filamentLoaded;