Automatic Control and User Interface for Central Tire Inflation System

wow, man, i didn’t seen sooo much variables in a single sketch in my whole life :fearful:

are you sure they are REALLY needed?
for me, this sketch is very confusing. however, just by random, i have some observations:

there is no really needed to assign 0 to variables. if you write only this:

uint16_t currentPotRaw;  //Current set point POT raw value 
int16_t withinTolSetPoint;  //[Tire pressure storage unit]
int16_t summedPressure;

they will have the value of 0 anyway. also, i like to declare variables the same types in same places, in increasing order of memory footprint. so, i would declare first all global bools, then all global bytes, ints, floats, longs, etc. for me it is more logical and maintainable.

afaik, this is not (very) correct. every switch case should have at least a break; statement, and it is recommended to have a default case. read on here if you mind.

instead constants, i like it better to use #defines (yes, the arduino docs aren’t recommend them, but if one understands how are they working, i think they are actually better to use)

this could be:

#define FILTER_THRESHOLD 100  // raw ADC value

in some cases they could use less memory and it seems more cleaner to me

for cases like this, you just should use a for cycle.

for overall code organisation and control, in arduino ide i highly recommend for everyone to use tabs. short explanation here: