AmboVent icon indicating copy to clipboard operation
AmboVent copied to clipboard

Code Formatting: declare only 1 variable per line

Open ElectricRCAircraftGuy opened this issue 4 years ago • 3 comments

This is a sub-issue of #11. Don't close #11 until all sub-issues are resolved.

I will help with this; just want to teach the principle too is all.

Also, I recommend the industry-standard uint8_t over the Arduino byte type. Byte is an alias to it anyway: "/home/alexa/dev/AmboVent/AmboVent/3-Software/Arduino/arduino_core/arduino/hardware/arduino/avr/cores/arduino/Arduino.h": line 126:

typedef uint8_t byte;

In Eclipse, I just Ctrl + Click on any byte in the arduino source code and it jumps to its definition.

Instead of:

byte monitor_index = 0, BPM = 14, prev_BPM, in_wait, failure, send_beep, wanted_cycle_time,
     disconnected = 0, high_pressure_detected = 0, motion_failure = 0, sent_LCD, hold_breath,
     safety_pressure_detected;  

Do:

uint8_t monitor_index = 0;
uint8_t BPM = 14;
uint8_t prev_BPM;
uint8_t in_wait;
uint8_t failure;
uint8_t send_beep;
uint8_t wanted_cycle_time;
uint8_t disconnected = 0;
uint8_t high_pressure_detected = 0;
uint8_t motion_failure = 0;
uint8_t sent_LCD;
uint8_t hold_breath;
uint8_t safety_pressure_detected;

ElectricRCAircraftGuy avatar Apr 13 '20 08:04 ElectricRCAircraftGuy

Yeah true the industry-standard uint8_t makes the code portable

Xexnon avatar Apr 13 '20 09:04 Xexnon

Related: #35

ElectricRCAircraftGuy avatar Apr 13 '20 09:04 ElectricRCAircraftGuy

PR #46 resolves a tiny portion of this issue

ElectricRCAircraftGuy avatar Apr 20 '20 08:04 ElectricRCAircraftGuy