114 lines
2.2 KiB
C
114 lines
2.2 KiB
C
/*
|
|
* plausibility_check.c
|
|
*
|
|
* Created on: Mar 18, 2025
|
|
* Author: janek
|
|
*/
|
|
#include "plausibility_check.h"
|
|
|
|
extern enable_gpios update_ports;
|
|
extern current_measurements current_measurements_adc_val;
|
|
volatile uint8_t error_data[16];
|
|
|
|
void check_plausibility() {
|
|
if (!update_ports.portb.sdc) {error_data[0] = 1;}
|
|
else {error_data[0] = 0;}
|
|
|
|
if (update_ports.porta.acc_cooling == 1 && current_measurements_adc_val.acc_cooling == 0) {
|
|
error_data[3] = 1;
|
|
}
|
|
else {
|
|
error_data[3] = 0;
|
|
}
|
|
|
|
if (update_ports.porta.ts_cooling == 1 && current_measurements_adc_val.ts_cooling == 0) {
|
|
error_data[4] = 1;
|
|
}
|
|
else {
|
|
error_data[4] = 0;
|
|
}
|
|
|
|
if (update_ports.porta.drs == 1 && current_measurements_adc_val.drs == 0) {
|
|
error_data[5] = 1;
|
|
}
|
|
else {
|
|
error_data[5] = 0;
|
|
}
|
|
|
|
if (update_ports.porta.acu == 1 && current_measurements_adc_val.acu == 0) {
|
|
error_data[6] = 1;
|
|
}
|
|
else {
|
|
error_data[6] = 0;
|
|
}
|
|
|
|
if (update_ports.porta.epsc == 1 && current_measurements_adc_val.epsc == 0) {
|
|
error_data[7] = 1;
|
|
}
|
|
else {
|
|
error_data[7] = 0;
|
|
}
|
|
|
|
if (update_ports.porta.inverter == 1 && current_measurements_adc_val.inverter == 0) {
|
|
error_data[8] = 3;
|
|
}
|
|
else {
|
|
error_data[8] = 2;
|
|
}
|
|
|
|
if (update_ports.porta.lidar == 1 && current_measurements_adc_val.lidar == 0) {
|
|
error_data[9] = 3;
|
|
}
|
|
else {
|
|
error_data[9] = 2;
|
|
}
|
|
|
|
if (update_ports.porta.misc == 1 && current_measurements_adc_val.misc == 0) {
|
|
error_data[10] = 3;
|
|
}
|
|
else {
|
|
error_data[10] = 2;
|
|
}
|
|
|
|
if (update_ports.portb.alwayson == 1 && current_measurements_adc_val.alwayson == 0) {
|
|
error_data[11] = 3;
|
|
}
|
|
else {
|
|
error_data[11] = 2;
|
|
}
|
|
|
|
if (update_ports.portb.sdc == 1 && current_measurements_adc_val.sdc == 0) {
|
|
error_data[12] = 3;
|
|
}
|
|
else {
|
|
error_data[12] = 2;
|
|
}
|
|
|
|
if (update_ports.portb.ebs1 == 1 && current_measurements_adc_val.ebs1 == 0) {
|
|
error_data[13] = 3;
|
|
}
|
|
else {
|
|
error_data[13] = 2;
|
|
}
|
|
|
|
if (update_ports.portb.ebs2 == 1 && current_measurements_adc_val.ebs2 == 0) {
|
|
error_data[14] = 3;
|
|
}
|
|
else {
|
|
error_data[14] = 2;
|
|
}
|
|
|
|
if (update_ports.portb.ebs3 == 1 && current_measurements_adc_val.ebs3 == 0) {
|
|
error_data[15] = 3;
|
|
}
|
|
else {
|
|
error_data[15] = 2;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|