Cameteo/arduino/cameteo-teensy-bug/cameteo-teensy/SerialMessages.cpp

56 lines
2.4 KiB
C++
Executable File

#include "cameteo_teensy.h"
void BootMessage(String s) {
char c[13]; // char buffer for conversion String->char
s.toCharArray(c, sizeof(s));
SERIAL_PORT.printf("%-12s", c);
}
void BootOK() {
SERIAL_PORT.println("OK");
}
void BootError() {
SERIAL_PORT.println("EE");
}
void sendDataOnSerial() {
//Print date & hour on serial port
SERIAL_PORT.printf("%04d/%02d/%02d_%02d:%02d:%02d\n", year(), month(), day(), hour(), minute(), second());
// if (isnan(dht22_event_hum.relative_humidity) ||
// isnan(dht22_event_temp.temperature)) {
// SERIAL_PORT.printf("Failed to read from DHT sensor!\n");
// }
// else {
// SERIAL_PORT.printf("Temperature:%8.2f %cC | Humidity:%8.0f %%\n",
// dht22_event_temp.temperature, DEGREE, dht22_event_hum.relative_humidity);
// }
// if (bme280_event.pressure) {
SERIAL_PORT.printf("Temperature:%8.2f %cC | Humidity: %8.2f % | Pressure: %8.2f hPa | Altitude:%8.2f m\n",
bme280_temp, DEGREE, bme280_press, bme280_alti);
// }
// else {
// SERIAL_PORT.printf("BME280 Sensor error\n");
// }
SERIAL_PORT.printf("Lightning strikes (from start) : %d | Perturb.: %d | Noise : %d | Unknown detect.: %d\n", lightning_nb_total,
as3935_perturb_total,
as3935_noise_total,
as3935_unknown_total);
//SERIAL_PORT.printf("Temperature:%8.2f %cC\n", tcn75a_temp, DEGREE);
SERIAL_PORT.printf("GPS data: %04d/%02d/%02d_%02d:%02d:%02d (%d)\n", gps_year, gps_month, gps_day,
gps_hour, gps_minutes, gps_second,
gps_fix_age);
SERIAL_PORT.printf(" Latitude: %11.8f | Longitude: %11.8f | Altitude: %5.2f m\n", gps_latitude, gps_longitude, gps_altitude);
SERIAL_PORT.printf(" Speed: %4.1f km/h | Course : %4.1f %c\n", gps_speed, gps_course, DEGREE);
SERIAL_PORT.printf(" Chars: %11d | Sentences: %11d | Failed cheksum: %4d\n", gps_chars, gps_sentences, gps_failed_checksum);
SERIAL_PORT.printf("Battery : %10d mV | Low Battery : %d\n", batt_voltage, low_battery_flag);
}