From 422371af1c6eef23bdd490f5eac74748e9577ef2 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 27 Feb 2024 09:18:46 -0500 Subject: [PATCH] Update main.c changed to SENSOR_FIELDS --- main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index d3137984..fd07adaa 100644 --- a/main.c +++ b/main.c @@ -567,7 +567,7 @@ int main(int argc, char * argv[]) { voltage_max[i] = -1000.0; current_max[i] = -1000.0; } - for (int i = 0; i <22; i++) { + for (int i = 0; i < SENSOR_FIELDS; i++) { sensor_min[i] = 1000.0; sensor_max[i] = -1000.0; // printf("Sensor min and max initialized!"); @@ -673,7 +673,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 <22; count1++) { + for (count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -712,7 +712,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -869,7 +869,7 @@ int main(int argc, char * argv[]) { const char space[2] = " "; token = strtok(sensor_payload, space); // printf("token: %s\n", token); - for (count1 = 0; count1 <22; count1++) { + for (count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (token != NULL) { sensor[count1] = (float) atof(token); // #ifdef DEBUG_LOGGING @@ -908,7 +908,7 @@ int main(int argc, char * argv[]) { } if ((sensor_payload[0] == 'O') && (sensor_payload[1] == 'K')) { - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (sensor[count1] < sensor_min[count1]) sensor_min[count1] = sensor[count1]; if (sensor[count1] > sensor_max[count1]) @@ -1435,7 +1435,7 @@ void get_tlm_fox() { if (loop % 32 == 0) { // was 8 printf("Sending MIN frame \n"); frm_type = 0x03; - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) other[count1] = other_min[count1]; if (count1 < 8) { @@ -1449,7 +1449,7 @@ void get_tlm_fox() { if ((loop + 16) % 32 == 0) { // was 8 printf("Sending MAX frame \n"); frm_type = 0x02; - for (int count1 = 0; count1 <22; count1++) { + for (int count1 = 0; count1 < SENSOR_FIELDS; count1++) { if (count1 < 3) other[count1] = other_max[count1]; if (count1 < 8) {