Skip to content

Commit

Permalink
Merge branch 'main' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
SinisterRj committed Sep 27, 2022
2 parents 76394f1 + 2fddd9f commit a830d4b
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 172 deletions.
2 changes: 1 addition & 1 deletion ArduinoFirmware/EEPROM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void readEEPROMData() {
if ((sensors[i].alarmSP < sensors[i].lowSP) || (sensors[i].alarmSP > sensors[i].highSP)) {
// Wrong value. Change back to standard:
#ifdef HAS_SERIAL_COMM
SERIAL.println("Invalid EEPROM set point read (" + String(sensors[i].alarmSP) +"). Defining standard set point to " + sensors[i].label + " (" + String(defaultSensors[i].alarmSP) + ").");
Serial.println("Invalid EEPROM set point read (" + String(sensors[i].alarmSP) +"). Defining standard set point to " + sensors[i].label + " (" + String(defaultSensors[i].alarmSP) + ").");
#endif
sensors[i].alarmSP = defaultSensors[i].alarmSP;
}
Expand Down
39 changes: 18 additions & 21 deletions ArduinoFirmware/SafetyPrinter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@

#define DIGIGTAL_SENSOR 0 // Internal use, don't change
#define NTC_SENSOR 1 // Internal use, don't change

// Board Codes
#define UNO 1
#define NANO 2
#define LEONARDO 3


#include <Arduino.h> // Needed to compile with Platformio
#include <avr/wdt.h> // Watchdog
#include <EEPROM.h> // EEPROM access
Expand Down Expand Up @@ -326,7 +321,8 @@ void setup() {
digitalWrite(ARDUINO_RESET_PIN, HIGH);

#ifdef HAS_SERIAL_COMM
SERIAL.begin(BAUD_RATE);
Serial.begin(BAUD_RATE);
Serial.println(F("booting..."));
#endif

#ifdef HAS_LCD
Expand Down Expand Up @@ -412,17 +408,17 @@ void loop() {
//Debug Info
#ifdef DEBUG
if (checkTimer(&debugTimer.startMs,DEBUG_DELAY,&debugTimer.started)) {
SERIAL.println();
SERIAL.print (F("Free memory [bytes]= ")); // 2048 bytes from datasheet
SERIAL.println (freeMemory());
SERIAL.print (F("Temperature [C]= "));
SERIAL.println (readTemp(), 2);
SERIAL.print (F("Voltage [V]= "));
SERIAL.println (readVcc(), 2); // 2.7V to 5.5V from datasheet
SERIAL.print (F("Execution time max [us] = "));
SERIAL.println (lTLastMax,DEC);
SERIAL.print (F("Execution time average [us] = "));
SERIAL.println (lTLastSum/LOOP_TIME_SAMPLES, DEC);
Serial.println();
Serial.print (F("Free memory [bytes]= ")); // 2048 bytes from datasheet
Serial.println (freeMemory());
Serial.print (F("Temperature [C]= "));
Serial.println (readTemp(), 2);
Serial.print (F("Voltage [V]= "));
Serial.println (readVcc(), 2); // 2.7V to 5.5V from datasheet
Serial.print (F("Execution time max [us] = "));
Serial.println (lTLastMax,DEC);
Serial.print (F("Execution time average [us] = "));
Serial.println (lTLastSum/LOOP_TIME_SAMPLES, DEC);
} else {
startTimer(&debugTimer.startMs,&debugTimer.started);
}
Expand Down Expand Up @@ -544,8 +540,8 @@ void validateSensorsInfo() {
sensors[x].enabled = false;
sensors[x].forceDisable = true;
#ifdef HAS_SERIAL_COMM
SERIAL.print(sensors[x].label);
SERIAL.println(F(": Multiple assings to the same I/O pin. Check your Configuration.h file. Sensor disabled."));
Serial.print(sensors[x].label);
Serial.println(F(": Multiple assings to the same I/O pin. Check your Configuration.h file. Sensor disabled."));
#endif
}
}
Expand Down Expand Up @@ -779,6 +775,7 @@ float readTemp() {
// Channel 8 can not be selected with
// the analogRead function yet.


// Set the internal reference and mux.
ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3));
ADCSRA |= _BV(ADEN); // enable the ADC
Expand Down Expand Up @@ -807,7 +804,7 @@ float readVcc() {
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));

result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
Expand Down

0 comments on commit a830d4b

Please sign in to comment.