Add short_name

This commit is contained in:
Ben Meadors 2023-02-09 19:32:32 -06:00
parent 83e309f3bf
commit 7100416142
3 changed files with 10 additions and 5 deletions

@ -1 +1 @@
Subproject commit 400dc2358942f1954b188cb5698a545850ca3d73 Subproject commit 1d0b4dd242ae38b844510d4517cfdceeed294cce

View File

@ -67,6 +67,8 @@ typedef struct _meshtastic_HamParameters {
Please respect your local laws, regulations, and band plans. Please respect your local laws, regulations, and band plans.
Ensure your radio is capable of operating of the selected frequency before setting this. */ Ensure your radio is capable of operating of the selected frequency before setting this. */
float frequency; float frequency;
/* Optional short name of user */
char short_name[6];
} meshtastic_HamParameters; } meshtastic_HamParameters;
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations. /* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
@ -169,14 +171,15 @@ extern "C" {
/* Initializer values for message structs */ /* Initializer values for message structs */
#define meshtastic_AdminMessage_init_default {0, {0}} #define meshtastic_AdminMessage_init_default {0, {0}}
#define meshtastic_HamParameters_init_default {"", 0, 0} #define meshtastic_HamParameters_init_default {"", 0, 0, ""}
#define meshtastic_AdminMessage_init_zero {0, {0}} #define meshtastic_AdminMessage_init_zero {0, {0}}
#define meshtastic_HamParameters_init_zero {"", 0, 0} #define meshtastic_HamParameters_init_zero {"", 0, 0, ""}
/* Field tags (for use in manual encoding/decoding) */ /* Field tags (for use in manual encoding/decoding) */
#define meshtastic_HamParameters_call_sign_tag 1 #define meshtastic_HamParameters_call_sign_tag 1
#define meshtastic_HamParameters_tx_power_tag 2 #define meshtastic_HamParameters_tx_power_tag 2
#define meshtastic_HamParameters_frequency_tag 3 #define meshtastic_HamParameters_frequency_tag 3
#define meshtastic_HamParameters_short_name_tag 4
#define meshtastic_AdminMessage_get_channel_request_tag 1 #define meshtastic_AdminMessage_get_channel_request_tag 1
#define meshtastic_AdminMessage_get_channel_response_tag 2 #define meshtastic_AdminMessage_get_channel_response_tag 2
#define meshtastic_AdminMessage_get_owner_request_tag 3 #define meshtastic_AdminMessage_get_owner_request_tag 3
@ -259,7 +262,8 @@ X(a, STATIC, ONEOF, INT32, (payload_variant,nodedb_reset,nodedb_reset),
#define meshtastic_HamParameters_FIELDLIST(X, a) \ #define meshtastic_HamParameters_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, STRING, call_sign, 1) \ X(a, STATIC, SINGULAR, STRING, call_sign, 1) \
X(a, STATIC, SINGULAR, INT32, tx_power, 2) \ X(a, STATIC, SINGULAR, INT32, tx_power, 2) \
X(a, STATIC, SINGULAR, FLOAT, frequency, 3) X(a, STATIC, SINGULAR, FLOAT, frequency, 3) \
X(a, STATIC, SINGULAR, STRING, short_name, 4)
#define meshtastic_HamParameters_CALLBACK NULL #define meshtastic_HamParameters_CALLBACK NULL
#define meshtastic_HamParameters_DEFAULT NULL #define meshtastic_HamParameters_DEFAULT NULL
@ -272,7 +276,7 @@ extern const pb_msgdesc_t meshtastic_HamParameters_msg;
/* Maximum encoded size of messages (where known) */ /* Maximum encoded size of messages (where known) */
#define meshtastic_AdminMessage_size 234 #define meshtastic_AdminMessage_size 234
#define meshtastic_HamParameters_size 25 #define meshtastic_HamParameters_size 32
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -603,6 +603,7 @@ void AdminModule::handleSetHamMode(const meshtastic_HamParameters &p)
{ {
// Set call sign and override lora limitations for licensed use // Set call sign and override lora limitations for licensed use
strncpy(owner.long_name, p.call_sign, sizeof(owner.long_name)); strncpy(owner.long_name, p.call_sign, sizeof(owner.long_name));
strncpy(owner.short_name, p.short_name, sizeof(owner.short_name));
owner.is_licensed = true; owner.is_licensed = true;
config.lora.override_duty_cycle = true; config.lora.override_duty_cycle = true;
config.lora.tx_power = p.tx_power; config.lora.tx_power = p.tx_power;