Finished some missing comment lines.

This commit is contained in:
2018-11-11 09:14:16 +00:00
parent 19bbe242c3
commit 3ba527d06c

View File

@@ -54,8 +54,8 @@ SoftwareSerial mySerial(BLUE_RX, BLUE_TX); // Start file descriptor and assign p
// Macros -------------------------------------------------------- // Macros --------------------------------------------------------
#define rLEFT digitalRead(LEFT) // Read button Left #define rLEFT digitalRead(LEFT) // Read button Left
#define rRIGHT digitalRead(RIGHT) // Read button Right #define rRIGHT digitalRead(RIGHT) // Read button Right
#define rACT digitalRead(ACT) // Read button Action #define rACT digitalRead(ACT) // Read button Action
//---------------------------------------------------------------- //----------------------------------------------------------------
@@ -141,48 +141,45 @@ void setup()
// Timer compare interrupt service routine -- // Timer compare interrupt service routine --
ISR(TIMER1_COMPA_vect) ISR(TIMER1_COMPA_vect)
{ {
menuState(); // Read buttons act accordingly and update menus menuState(); // Read buttons act accordingly and update menus
if (amp_pin(i_load) > curr_limit) // If load current more then current limit if (amp_pin(i_load) > curr_limit) // If load current more then current limit
{ {
load_status = off; // Turn off load load_status = off; // Turn off load
} }
digitalWrite(load_line, load_status); // Turn load on or off depending on the load_status digitalWrite(load_line, load_status); // Turn load on or off depending on the load_status
if (mySerial.available()) { // If there is incoming serial data
ble_data = mySerial.read(); // save it caracter into ble_data
if (mySerial.available()) { switch(ble_data) // Evaluate caracter
ble_data = mySerial.read();
// Serial.write(mySerial.read()); // For debug only
switch(ble_data)
{ {
case 'a': case 'a': // If caracter is 'a'
dtostrf(parameters[battery_volt], 5, 2, outstr); dtostrf(parameters[battery_volt], 5, 2, outstr); // convert battery voltage to string
mySerial.write(outstr); mySerial.write(outstr); // and send it to bluetooth
break; break; // finish switch statment
case 'b':
dtostrf(parameters[voltage_1], 5, 2, outstr);
mySerial.write(outstr);
break;
case 'c':
dtostrf(parameters[voltage_2], 5, 2, outstr);
mySerial.write(outstr);
break;
case 'd': case 'b': // If caracter is 'b'
dtostrf(parameters[curr], 5, 2, outstr); dtostrf(parameters[voltage_1], 5, 2, outstr); // convert voltage 1 to string
mySerial.write(outstr); mySerial.write(outstr); // and send it to bluetooth
break; break; // finish switch statment
case 'e': case 'c': // If caracter is 'c'
load_status = on; dtostrf(parameters[voltage_2], 5, 2, outstr); // convert voltage 2 to string
break; mySerial.write(outstr); // and send it to bluetooth
break; // finish switch statment
case 'f':
load_status = off; case 'd': // If caracter is 'd'
break; dtostrf(parameters[curr], 5, 2, outstr); // convert load current to string
mySerial.write(outstr); // and send it to bluetooth
break; // finish switch statment
case 'e': // If caracter is 'd'
load_status = on; // turn ON load
break; // finish switch statment
case 'f': // If caracter is 'f'
load_status = off; // turn OFF load
break; // finish switch statment
} }
} }
} }
@@ -196,8 +193,8 @@ void loop()
parameters[voltage_2] = volt_pin(volt_2); // Update voltage two value parameters[voltage_2] = volt_pin(volt_2); // Update voltage two value
parameters[curr] = amp_pin(i_load); // Update current load parameters[curr] = amp_pin(i_load); // Update current load
if (sd_inserted == no) // If SD card is not inserted if (sd_inserted == no) // If SD card is not inserted
{ {
@@ -205,7 +202,7 @@ void loop()
} }
else if (sd_rw == on) // otherwise sd_rw is ON else if (sd_rw == on) // otherwise sd_rw is ON
{ {
myFile = SD.open(file_name + ".TXT", FILE_WRITE); // Open file name and add ".TXT", myFile = SD.open(file_name + ".TXT", FILE_WRITE); // Open file name and add ".TXT",
// for writing // for writing
if (myFile) // if succeds if (myFile) // if succeds
{ {