Merge pull request #2253 from meshtastic/set-ham-mode

Set ham mode admin message
This commit is contained in:
Ben Meadors 2023-02-04 18:07:10 -06:00 committed by GitHub
commit 9e1f7c4f56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -106,6 +106,10 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
else
handleSetChannel(r->set_channel);
break;
case meshtastic_AdminMessage_set_ham_mode_tag:
LOG_INFO("Client is setting ham mode\n");
handleSetHamMode(r->set_ham_mode);
break;
/**
* Other
@ -598,6 +602,18 @@ void AdminModule::saveChanges(int saveWhat, bool shouldReboot)
}
}
void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p)
{
strncpy(owner.long_name, p.call_sign, sizeof(owner.long_name));
owner.is_licensed = true;
config.lora.override_duty_cycle = true;
config.lora.tx_power = p.tx_power;
config.lora.override_frequency = p.frequency;
service.reloadOwner(false);
service.reloadConfig(SEGMENT_CONFIG | SEGMENT_DEVICESTATE);
}
AdminModule::AdminModule() : ProtobufModule("Admin", meshtastic_PortNum_ADMIN_APP, &meshtastic_AdminMessage_msg)
{
// restrict to the admin channel for rx

View File

@ -43,6 +43,7 @@ class AdminModule : public ProtobufModule<meshtastic_AdminMessage>
void handleSetConfig(const meshtastic_Config &c);
void handleSetModuleConfig(const meshtastic_ModuleConfig &c);
void handleSetChannel();
void handleSetHamMode(const meshtastic_HamParameters &req);
void reboot(int32_t seconds);
};