Turn on mode A/C if a Beast connection asks for it.
Add a --no-modeac-auto option to disable this.
This commit is contained in:
parent
cbdfd9dc5d
commit
6336611bc7
3 changed files with 27 additions and 0 deletions
21
net_io.c
21
net_io.c
|
|
@ -81,6 +81,8 @@ static void send_sbs_heartbeat(struct net_service *service);
|
|||
static void writeFATSVEvent(struct modesMessage *mm, struct aircraft *a);
|
||||
static void writeFATSVPositionUpdate(float lat, float lon, float alt);
|
||||
|
||||
static void autoset_modeac();
|
||||
|
||||
//
|
||||
//=========================================================================
|
||||
//
|
||||
|
|
@ -315,6 +317,8 @@ static void modesCloseClient(struct client *c) {
|
|||
c->fd = -1;
|
||||
c->service = NULL;
|
||||
c->modeac_requested = 0;
|
||||
|
||||
autoset_modeac();
|
||||
}
|
||||
//
|
||||
//=========================================================================
|
||||
|
|
@ -788,6 +792,22 @@ static void handle_radarcape_position(float lat, float lon, float alt)
|
|||
}
|
||||
}
|
||||
|
||||
// recompute global Mode A/C setting
|
||||
static void autoset_modeac() {
|
||||
struct client *c;
|
||||
|
||||
if (!Modes.mode_ac_auto)
|
||||
return;
|
||||
|
||||
Modes.mode_ac = 0;
|
||||
for (c = Modes.clients; c; c = c->next) {
|
||||
if (c->modeac_requested) {
|
||||
Modes.mode_ac = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send some Beast settings commands to a client
|
||||
void sendBeastSettings(struct client *c, const char *settings)
|
||||
{
|
||||
|
|
@ -826,6 +846,7 @@ static int handleBeastCommand(struct client *c, char *p) {
|
|||
break;
|
||||
}
|
||||
|
||||
autoset_modeac();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue