No longer insert smart errors into received data frames. With JSON we can just build an error.

This commit is contained in:
rljonesau 2018-12-22 17:34:10 +11:00
parent e6ea53496f
commit 54fa331d23
5 changed files with 17 additions and 14 deletions

View file

@ -993,3 +993,8 @@ bool hasOEMcontroller()
{ {
return bHasOEMController; return bHasOEMController;
} }
int getSmartError()
{
return SmartError.getError();
}

View file

@ -417,8 +417,14 @@ CProtocolPackage::reportFrames(bool isOEM)
int int
CProtocolPackage::getErrState() const CProtocolPackage::getErrState() const
{ {
if(getBlueWireStat() & 0x01) if(getBlueWireStat() & 0x01) {
return 8; // force E-07 - we're not seeing heater data return 8; // force E-07 - we're not seeing heater data
else }
return Heater.getErrState(); else {
int smartErr = getSmartError();
if(smartErr)
return smartErr;
else
return Heater.getErrState();
}
} }

View file

@ -51,21 +51,12 @@ CSmartError::inhibit()
// In addition, the hetaer frame has the ErrState updated to track the // In addition, the hetaer frame has the ErrState updated to track the
// smart error, providing no heater error exists! // smart error, providing no heater error exists!
void void
CSmartError::monitor(CProtocol& heaterFrame) CSmartError::monitor(const CProtocol& heaterFrame)
{ {
bool bSilent = true; bool bSilent = true;
if(heaterFrame.verifyCRC(bSilent)) { // check but don't report dodgy frames to debug if(heaterFrame.verifyCRC(bSilent)) { // check but don't report dodgy frames to debug
// only accept valid heater frames! // only accept valid heater frames!
monitor(heaterFrame.getRunState()); monitor(heaterFrame.getRunState());
unsigned char HtrErr = heaterFrame.getErrState();
if((HtrErr & 0xfe) == 0) {
// heater is Idle or Normal running state (E-0X + 1 in protocol!!)
unsigned char smartErr = getError();
if(smartErr) {
heaterFrame.setErrState(smartErr); // 10 = ign fail, 11 = retry
heaterFrame.setCRC(); // changed the message, fix the CRC!
}
}
} }
} }

View file

@ -29,7 +29,7 @@ public:
CSmartError(); CSmartError();
void reset(); void reset();
void inhibit(); void inhibit();
void monitor(CProtocol& heaterFrame); void monitor(const CProtocol& heaterFrame);
void monitor(unsigned char runstate); void monitor(unsigned char runstate);
unsigned char getError(); unsigned char getError();
}; };

View file

@ -48,6 +48,7 @@ extern void resetJSONmoderator();
extern const char* getBlueWireStatStr(); extern const char* getBlueWireStatStr();
extern bool hasOEMcontroller(); extern bool hasOEMcontroller();
extern int getBlueWireStat(); extern int getBlueWireStat();
extern int getSmartError();
#define LOWERLIMIT(A, B) if(A < B) A = B #define LOWERLIMIT(A, B) if(A < B) A = B
#define UPPERLIMIT(A, B) if(A > B) A = B #define UPPERLIMIT(A, B) if(A > B) A = B