Put a warning header up in view1090 interactive mode when there's no connection
This commit is contained in:
parent
fb110802d6
commit
a224f6f783
|
|
@ -623,6 +623,7 @@ unsigned modeCToModeA (int modeC);
|
||||||
void interactiveInit(void);
|
void interactiveInit(void);
|
||||||
void interactiveShowData(void);
|
void interactiveShowData(void);
|
||||||
void interactiveCleanup(void);
|
void interactiveCleanup(void);
|
||||||
|
void interactiveNoConnection(void);
|
||||||
|
|
||||||
// Provided by dump1090.c / view1090.c / faup1090.c
|
// Provided by dump1090.c / view1090.c / faup1090.c
|
||||||
void receiverPositionChanged(float lat, float lon, float alt);
|
void receiverPositionChanged(float lat, float lon, float alt);
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,6 @@ void interactiveInit() {
|
||||||
initscr();
|
initscr();
|
||||||
clear();
|
clear();
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
mvprintw(0, 0, " Hex Mode Sqwk Flight Alt Spd Hdg Lat Long RSSI Msgs Ti");
|
|
||||||
mvhline(1, 0, ACS_HLINE, 80);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void interactiveCleanup(void) {
|
void interactiveCleanup(void) {
|
||||||
|
|
@ -95,6 +92,14 @@ void interactiveCleanup(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void interactiveNoConnection(void) {
|
||||||
|
if (!Modes.interactive)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mvprintw(0, 0, " /!\\ input connection lost /!\\ ");
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
void interactiveShowData(void) {
|
void interactiveShowData(void) {
|
||||||
struct aircraft *a = Modes.aircrafts;
|
struct aircraft *a = Modes.aircrafts;
|
||||||
static uint64_t next_update;
|
static uint64_t next_update;
|
||||||
|
|
@ -102,12 +107,18 @@ void interactiveShowData(void) {
|
||||||
char progress;
|
char progress;
|
||||||
char spinner[4] = "|/-\\";
|
char spinner[4] = "|/-\\";
|
||||||
|
|
||||||
|
if (!Modes.interactive)
|
||||||
|
return;
|
||||||
|
|
||||||
// Refresh screen every (MODES_INTERACTIVE_REFRESH_TIME) miliseconde
|
// Refresh screen every (MODES_INTERACTIVE_REFRESH_TIME) miliseconde
|
||||||
if (now < next_update)
|
if (now < next_update)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
next_update = now + MODES_INTERACTIVE_REFRESH_TIME;
|
next_update = now + MODES_INTERACTIVE_REFRESH_TIME;
|
||||||
|
|
||||||
|
mvprintw(0, 0, " Hex Mode Sqwk Flight Alt Spd Hdg Lat Long RSSI Msgs Ti");
|
||||||
|
mvhline(1, 0, ACS_HLINE, 80);
|
||||||
|
|
||||||
progress = spinner[(now/1000)%4];
|
progress = spinner[(now/1000)%4];
|
||||||
mvaddch(0, 79, progress);
|
mvaddch(0, 79, progress);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ void view1090Init(void) {
|
||||||
modesChecksumInit(Modes.nfix_crc);
|
modesChecksumInit(Modes.nfix_crc);
|
||||||
icaoFilterInit();
|
icaoFilterInit();
|
||||||
modeACInit();
|
modeACInit();
|
||||||
interactiveInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -210,23 +209,25 @@ int main(int argc, char **argv) {
|
||||||
s = makeBeastInputService();
|
s = makeBeastInputService();
|
||||||
c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port);
|
c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
|
interactiveCleanup();
|
||||||
fprintf(stderr, "Failed to connect to %s:%d: %s\n", bo_connect_ipaddr, bo_connect_port, Modes.aneterr);
|
fprintf(stderr, "Failed to connect to %s:%d: %s\n", bo_connect_ipaddr, bo_connect_port, Modes.aneterr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sendSettings(c);
|
sendSettings(c);
|
||||||
|
|
||||||
// Keep going till the user does something that stops us
|
// Keep going till the user does something that stops us
|
||||||
|
interactiveInit();
|
||||||
while (!Modes.exit) {
|
while (!Modes.exit) {
|
||||||
struct timespec r = { 0, 100 * 1000 * 1000};
|
struct timespec r = { 0, 100 * 1000 * 1000};
|
||||||
icaoFilterExpire();
|
icaoFilterExpire();
|
||||||
trackPeriodicUpdate();
|
trackPeriodicUpdate();
|
||||||
modesNetPeriodicWork();
|
modesNetPeriodicWork();
|
||||||
|
|
||||||
if (Modes.interactive)
|
interactiveShowData();
|
||||||
interactiveShowData();
|
|
||||||
|
|
||||||
if (s->connections == 0) {
|
if (s->connections == 0) {
|
||||||
// lost input connection, try to reconnect
|
// lost input connection, try to reconnect
|
||||||
|
interactiveNoConnection();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port);
|
c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port);
|
||||||
if (c) {
|
if (c) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue