ESP32-PaxCounter/src/main.h

71 lines
2.1 KiB
C
Raw Normal View History

2018-04-05 08:47:17 +02:00
#include "configmanager.h"
#include "lorawan.h"
#include "macsniff.h"
2018-07-14 19:12:20 +02:00
#include "senddata.h"
2018-06-10 21:03:16 +02:00
// program version - note: increment version after modifications to configData_t
// struct!!
2018-07-14 20:13:38 +02:00
#define PROGVERSION "1.3.9" // use max 10 chars here!
2018-06-10 21:03:16 +02:00
#define PROGNAME "PAXCNT"
2018-03-30 20:51:49 +02:00
2018-04-19 15:17:23 +02:00
//--- Declarations ---
2018-03-30 20:51:49 +02:00
2018-06-16 19:50:36 +02:00
// Struct holding devices's runtime configuration
typedef struct {
uint8_t lorasf; // 7-12, lora spreadfactor
uint8_t txpower; // 2-15, lora tx power
uint8_t adrmode; // 0=disabled, 1=enabled
uint8_t screensaver; // 0=disabled, 1=enabled
uint8_t screenon; // 0=disabled, 1=enabled
uint8_t countermode; // 0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed
int16_t rssilimit; // threshold for rssilimiter, negative value!
uint8_t sendcycle; // payload send cycle [seconds/2]
uint8_t wifichancycle; // wifi channel switch cycle [seconds/100]
uint8_t blescantime; // BLE scan cycle duration [seconds]
uint8_t blescan; // 0=disabled, 1=enabled
uint8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
uint8_t vendorfilter; // 0=disabled, 1=enabled
uint8_t rgblum; // RGB Led luminosity (0..100%)
uint8_t gpsmode; // 0=disabled, 1=enabled
char version[10]; // Firmware version
} configData_t;
#ifdef HAS_GPS
typedef struct {
uint32_t latitude;
uint32_t longitude;
uint8_t satellites;
uint16_t hdop;
uint16_t altitude;
} gpsStatus_t;
extern gpsStatus_t gps_status; // struct for storing gps data
extern TinyGPSPlus gps; // Make TinyGPS++ instance globally availabe
#endif
enum led_states { LED_OFF, LED_ON };
2018-03-30 20:51:49 +02:00
#if defined(CFG_eu868)
const char lora_datarate[] = {"1211100908077BFSNA"};
#elif defined(CFG_us915)
const char lora_datarate[] = {"100908078CNA121110090807"};
#endif
2018-04-19 15:17:23 +02:00
//--- Prototypes ---
2018-04-06 22:24:54 +02:00
2018-04-19 15:17:23 +02:00
// defined in main.cpp
2018-04-26 18:07:48 +02:00
void reset_counters(void);
void blink_LED(uint16_t set_color, uint16_t set_blinkduration);
void led_loop(void);
2018-04-06 21:34:25 +02:00
2018-04-19 15:17:23 +02:00
// defined in blescan.cpp
2018-05-20 13:50:00 +02:00
#ifdef BLECOUNTER
void start_BLEscan(void);
void stop_BLEscan(void);
2018-06-08 22:41:37 +02:00
#endif
// defined in gpsread.cpp
2018-06-08 22:41:37 +02:00
#ifdef HAS_GPS
2018-06-10 21:03:16 +02:00
void gps_read(void);
void gps_loop(void *pvParameters);
2018-06-16 19:50:36 +02:00
#endif