Merge pull request #692 from crossan007/add_set_channel

add handleSetChannel
1.2-legacy
Jm Casler 2021-02-15 18:49:29 -08:00 zatwierdzone przez GitHub
commit 418a12e75f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -87,6 +87,10 @@ void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
handleSetRadio(toRadioScratch.set_radio);
break;
case ToRadio_set_channel_tag:
DEBUG_MSG("Client is setting channel\n");
handleSetChannel(toRadioScratch.set_channel);
break;
default:
DEBUG_MSG("Error: unexpected ToRadio variant\n");
break;
@ -275,6 +279,17 @@ void PhoneAPI::handleSetOwner(const User &o)
service.reloadOwner();
}
void PhoneAPI::handleSetChannel(const ChannelSettings &cc)
{
radioConfig.channel_settings = cc;
bool didReset = service.reloadConfig();
if (didReset) {
state = STATE_SEND_MY_INFO; // Squirt a completely new set of configs to the client
}
}
void PhoneAPI::handleSetRadio(const RadioConfig &r)
{
radioConfig = r;

Wyświetl plik

@ -88,6 +88,7 @@ class PhoneAPI
//
void handleSetOwner(const User &o);
void handleSetChannel(const ChannelSettings &cc);
void handleSetRadio(const RadioConfig &r);
protected: