Set ham mode admin message

This commit is contained in:
Ben Meadors 2023-02-04 15:11:36 -06:00
parent 21443dab05
commit b70af5cc78
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(!hasOpenEditTransaction);
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);
};