rdz_ttgo_sonde/libraries/SondeLib/Sonde.h

89 wiersze
1.9 KiB
C
Czysty Zwykły widok Historia

2019-04-03 15:16:51 +00:00
#ifndef Sonde_h
#define Sonde_H
2019-04-15 18:28:50 +00:00
#include "aprs.h"
2019-04-05 18:05:18 +00:00
// RX_TIMEOUT: no header detected
// RX_ERROR: header detected, but data not decoded (crc error, etc.)
// RX_OK: header and data ok
enum RxResult { RX_OK, RX_TIMEOUT, RX_ERROR };
enum SondeType { STYPE_DFM06, STYPE_DFM09, STYPE_RS41 };
extern const char *sondeTypeStr[5];
2019-04-15 18:28:50 +00:00
typedef struct st_rdzconfig {
int oled_sda;
int oled_scl;
int oled_rst;
2019-04-15 18:28:50 +00:00
int noisefloor; // for spectrum display
char call[9];
char passcode[9];
// for now, one feed for each type is enough, but might get extended to more?
struct st_feedinfo udpfeed; // target for AXUDP messages
struct st_feedinfo tcpfeed; // target for APRS-IS TCP connections
} RDZConfig;
2019-04-03 15:16:51 +00:00
typedef struct st_sondeinfo {
// receiver configuration
2019-04-08 17:22:08 +00:00
bool active;
2019-04-05 18:05:18 +00:00
SondeType type;
2019-04-03 15:16:51 +00:00
float freq;
// decoded ID
char id[10];
bool validID;
// decoded position
float lat;
float lon;
float hei;
float vs;
float hs;
2019-04-05 21:32:26 +00:00
float dir; // 0..360
uint8_t validPos; // bit pattern for validity of above 6 fields
2019-04-03 15:16:51 +00:00
// RSSI from receiver
int rssi;
2019-04-05 18:05:18 +00:00
uint8_t rxStat[20];
2019-04-03 15:16:51 +00:00
} SondeInfo;
2019-04-05 18:05:18 +00:00
// rxState: 0=undef[empty] 1=timeout[.] 2=errro[E] 3=ok[1]
2019-04-03 15:16:51 +00:00
2019-04-05 18:05:18 +00:00
#define MAXSONDE 10
2019-04-03 15:16:51 +00:00
class Sonde
{
private:
public:
2019-04-15 18:28:50 +00:00
RDZConfig config;
2019-04-09 22:29:11 +00:00
int currentSonde = 0;
2019-04-08 17:22:08 +00:00
int nSonde;
SondeInfo sondeList[MAXSONDE+1];
Sonde();
void setConfig(const char *str);
2019-04-05 18:05:18 +00:00
void clearSonde();
2019-04-08 17:22:08 +00:00
void addSonde(float frequency, SondeType type, int active);
2019-04-05 18:05:18 +00:00
void nextConfig();
void setup();
int receiveFrame();
SondeInfo *si();
2019-04-03 15:16:51 +00:00
void updateDisplayPos();
void updateDisplayPos2();
void updateDisplayID();
void updateDisplayRSSI();
void updateDisplayRXConfig();
2019-04-05 18:05:18 +00:00
void updateStat();
void updateDisplayIP();
2019-04-03 15:16:51 +00:00
void updateDisplay();
2019-04-05 18:05:18 +00:00
void updateDisplayScanner();
void clearDisplay();
2019-04-08 17:22:08 +00:00
void setIP(const char *ip, bool isAP);
2019-04-03 15:16:51 +00:00
};
extern Sonde sonde;
#endif