2019-04-03 15:16:51 +00:00
|
|
|
|
|
|
|
#ifndef Sonde_h
|
|
|
|
#define Sonde_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-03 15:16:51 +00:00
|
|
|
typedef struct st_sondeinfo {
|
|
|
|
// receiver configuration
|
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;
|
|
|
|
bool validPos;
|
|
|
|
// 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:
|
2019-04-05 18:05:18 +00:00
|
|
|
int nSonde;
|
|
|
|
int currentSonde = 0;
|
|
|
|
SondeInfo sondeList[MAXSONDE+1];
|
2019-04-03 15:16:51 +00:00
|
|
|
public:
|
2019-04-05 18:05:18 +00:00
|
|
|
void clearSonde();
|
|
|
|
void addSonde(float frequency, SondeType type);
|
|
|
|
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();
|
|
|
|
void setIP(const char *ip);
|
2019-04-03 15:16:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Sonde sonde;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|