Nouveau driver ePaper Display de Waveshare supportant les Image de la librairie PIL

Beaucoup plus facile à utiliser pour de l'affichage riche
This commit is contained in:
Pierrick C
2017-09-20 18:06:00 +02:00
parent e95f6eb57a
commit 61c4296af6
6 changed files with 121 additions and 50 deletions

View File

@ -20,7 +20,7 @@
#define MQTT_USERNAME "arofarn"
#define MQTT_KEY "WaKaW9XMGUZ3rRJD"
#define MQTT_ID "huzzah0"
#define MQTT_PUB_INTERVAL 10000
#define MQTT_PUB_INTERVAL 15000 // milliseconds
/************************* Time and NTP Setup *********************************/
@ -33,7 +33,7 @@
#define MODE_STATION true
#define DEFAULT_ALTITUDE 140.0
#define DEFAULT_MSLP 1013.25 //Atmospheric Pressure at Sea-Level
#define DEFAULT_MSLP 1013.25 //Mean Atmospheric Pressure at Mean Sea-Level
// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient wifi_client;
@ -152,21 +152,11 @@ void loop() {
date_str = NTP.getTimeDateString();
date_str.toCharArray(date_val,20);
// Now we can publish stuff!
Serial.print(F("Sending date and time "));
Serial.print(date_val);
Serial.print("...");
if (! mqtt_client.publish("huzzah0/NTP/date", date_val, true, 2)) {
Serial.println(F("Failed"));
} else {
Serial.println(F("OK!"));
}
// Now we can publish stuff!
Serial.print(F("Sending pressure value "));
Serial.print(pressure_val);
Serial.print("...");
val2json(pressure_val, date_str, "hPa", "PA").toCharArray(tosend, 120);
val2json(pressure_val, date_str, "hPa", "AP").toCharArray(tosend, 120);
if (! mqtt_client.publish("huzzah0/AdaBME280_1/pressure", tosend, true, 2) ) {
Serial.println(F("Failed"));
} else {
@ -182,7 +172,7 @@ void loop() {
Serial.print(F("Sending sea-level pressure value "));
Serial.print(atm_press_sea_level);
Serial.print("...");
val2json(atm_press_sea_level, date_str, "hPa", "SLPA").toCharArray(tosend, 120);
val2json(atm_press_sea_level, date_str, "hPa", "MSLP").toCharArray(tosend, 120);
if (! mqtt_client.publish("huzzah0/AdaBME280_1/sea_level_pressure", tosend, true, 2) ) {
Serial.println(F("Failed"));
} else {
@ -202,7 +192,7 @@ void loop() {
Serial.print(F("Sending humity value "));
Serial.print(humidity_val);
Serial.print("...");
val2json(humidity_val, date_str, "%", "HR").toCharArray(tosend, 120);
val2json(humidity_val, date_str, "%", "RH").toCharArray(tosend, 120);
if (! mqtt_client.publish("huzzah0/AdaBME280_1/humidity", tosend, true, 2)) {
Serial.println(F("Failed"));
} else {
@ -213,12 +203,22 @@ void loop() {
Serial.print(F("Sending temperature value "));
Serial.print(temperature_val);
Serial.print("...");
val2json(temperature_val, date_str, "degC", "TA").toCharArray(tosend, 120);
val2json(temperature_val, date_str, "degC", "AT").toCharArray(tosend, 120);
if (! mqtt_client.publish("huzzah0/AdaBME280_1/temperature", tosend, true, 2)) {
Serial.println(F("Failed"));
} else {
Serial.println(F("OK!"));
}
// __LAST__ thing to send : Date and Time
Serial.print(F("Sending date and time "));
Serial.print(date_val);
Serial.print("...");
if (! mqtt_client.publish("huzzah0/NTP/date", date_val, true, 2)) {
Serial.println(F("Failed"));
} else {
Serial.println(F("OK!"));
}
}
delay(10);