Files
Ardiuno/WS3/WS3-ESP32/ws3_defs.h
2021-01-06 17:44:20 +01:00

63 lines
1.5 KiB
C

// Definition used in this code
#ifndef ws3_defs_h
#define ws2_defs_h
// Domoticz MQTT configuration by WiFiManager
#define mqtt_port 1883
// Max MQTT packet size
#define MQTT_MAX_PACKET_SIZE 128
// Defines
#define OTAPASSWORD "123" // Password for OTA upload thru Arduino IDE
// Debug
#define DEBUG 1
#ifdef DEBUG
#define debug(x) Serial.print(x)
#define debugln(x) Serial.println(x)
#else /* DEBUG */
#define debug(x)
#define debugln(x)
#endif /* DEBUG */
// Baud used to read see JP2
#define WS3_BAUD 2400
// Toggle support for PM2.5 sensor
//#define SUPPORT_PM25_SENSOR
// Define the length of data
#ifdef SUPPORT_PM25_SENSOR
// There is 88 bytes per packets
#define WS3_PKT_LEN 78
// And the checksum is the last 2 bytes
#define WS3_CHK_LEN 2
#define CHK_SUM_DELINEATOR 75
#else /* SUPPORT_PM25_SENSOR */
// There is 88 bytes per packets
#define WS3_PKT_LEN 78
// And the checksum is the last 2 bytes
#define WS3_CHK_LEN 2
#define CHK_SUM_DELINEATOR 75
#endif /* SUPPRT_PM25_SENSOR */
// Seems the Metric format does not have a correct checksum
// In this case we should not test the checksum, just see
// if we have a correct dataline
#define DONT_CHKSUM 1
// Define ALTITUDE if you need to get pression corrected
// Set this to 0 if you don't care
#define ALTITUDE 340 // Longwy is at 340m
#ifdef ESP32
#define RXD2 16
#define TXD2 17
#else /* ESP32 */
#define RXD2 15
#define TXD2 16
#endif /* ESP32 */
#endif /* ws3_defs_h */