Check number of broken temperature sensors
This commit is contained in:
parent
4316e604da
commit
e0b9568e56
@ -13,5 +13,6 @@
|
|||||||
#define SlavesTimeoutError 1
|
#define SlavesTimeoutError 1
|
||||||
#define SlavesErrorFrameError 2
|
#define SlavesErrorFrameError 2
|
||||||
#define SLAVES_FRAME_TIMEOUT_ERROR 3
|
#define SLAVES_FRAME_TIMEOUT_ERROR 3
|
||||||
|
#define SLAVES_TOO_FEW_TEMPS 4
|
||||||
|
|
||||||
#endif /* INC_AMS_ERRORCODES_H_ */
|
#endif /* INC_AMS_ERRORCODES_H_ */
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#define SLAVETIMEOUT 500
|
#define SLAVETIMEOUT 500
|
||||||
#define SLAVE_HEARTBEAT_FRAMES 11
|
#define SLAVE_HEARTBEAT_FRAMES 11
|
||||||
|
// 30% * 90 = 27, each sensor measures 2 cells
|
||||||
|
#define SLAVE_MIN_TEMP_SENSORS 14
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
|
@ -78,6 +78,20 @@ uint8_t checkSlaveTimeout() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int working_cell_temps = 0;
|
||||||
|
for (int i = 0; i < NUMBEROFTEMPS; i++) {
|
||||||
|
if (slaves[n].cellTemps[i] != 0) {
|
||||||
|
working_cell_temps++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (working_cell_temps < SLAVE_MIN_TEMP_SENSORS) {
|
||||||
|
AMSErrorHandle temperror;
|
||||||
|
temperror.errorcode = SLAVES_TOO_FEW_TEMPS;
|
||||||
|
temperror.errorarg[0] = n;
|
||||||
|
AMS_Error_Handler(&temperror);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user