mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-18 02:52:05 +00:00
Merge branch 'master' of github.com:meshtastic/Meshtastic-device
This commit is contained in:
commit
cf380e6cb6
@ -1 +1 @@
|
|||||||
Subproject commit a7bbc358664c83f5148bae2a502cb294e7cafee5
|
Subproject commit 94a4dbb842961e75f89de13dc6d0437a256098aa
|
@ -101,9 +101,15 @@ const char *getDeviceName()
|
|||||||
|
|
||||||
getMacAddr(dmac);
|
getMacAddr(dmac);
|
||||||
|
|
||||||
// Meshtastic_ab3c
|
// Meshtastic_ab3c or Shortname_abcd
|
||||||
static char name[20];
|
static char name[20];
|
||||||
|
sprintf(name, "%02x%02x", dmac[4], dmac[5]);
|
||||||
|
// if the shortname exists and is NOT the new default of ab3c, use it for BLE name.
|
||||||
|
if ((owner.short_name != NULL) && (owner.short_name != name)) {
|
||||||
|
sprintf(name, "%s_%02x%02x", owner.short_name, dmac[4], dmac[5]);
|
||||||
|
} else {
|
||||||
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]);
|
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]);
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ void NodeDB::installDefaultDeviceState()
|
|||||||
|
|
||||||
// Set default owner name
|
// Set default owner name
|
||||||
pickNewNodeNum(); // based on macaddr now
|
pickNewNodeNum(); // based on macaddr now
|
||||||
sprintf(owner.long_name, "Unknown %02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
sprintf(owner.long_name, "Meshtastic %02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
||||||
sprintf(owner.short_name, "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
sprintf(owner.short_name, "%02x%02x", ourMacAddr[4], ourMacAddr[5]);
|
||||||
|
|
||||||
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum
|
||||||
|
@ -148,13 +148,43 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
|
|
||||||
case STATE_SEND_CONFIG:
|
case STATE_SEND_CONFIG:
|
||||||
fromRadioScratch.which_payloadVariant = FromRadio_config_tag;
|
fromRadioScratch.which_payloadVariant = FromRadio_config_tag;
|
||||||
fromRadioScratch.config = config;
|
switch (config_state) {
|
||||||
|
case Config_device_tag:
|
||||||
|
fromRadioScratch.config.which_payloadVariant = Config_device_tag;
|
||||||
|
fromRadioScratch.config.payloadVariant.device = config.device;
|
||||||
|
break;
|
||||||
|
case Config_position_tag:
|
||||||
|
fromRadioScratch.config.which_payloadVariant = Config_position_tag;
|
||||||
|
fromRadioScratch.config.payloadVariant.position = config.position;
|
||||||
|
break;
|
||||||
|
case Config_power_tag:
|
||||||
|
fromRadioScratch.config.which_payloadVariant = Config_power_tag;
|
||||||
|
fromRadioScratch.config.payloadVariant.power = config.power;
|
||||||
|
fromRadioScratch.config.payloadVariant.power.ls_secs = default_ls_secs;
|
||||||
|
break;
|
||||||
|
case Config_wifi_tag:
|
||||||
|
fromRadioScratch.config.which_payloadVariant = Config_wifi_tag;
|
||||||
|
fromRadioScratch.config.payloadVariant.wifi = config.wifi;
|
||||||
|
break;
|
||||||
|
case Config_display_tag:
|
||||||
|
fromRadioScratch.config.which_payloadVariant = Config_display_tag;
|
||||||
|
fromRadioScratch.config.payloadVariant.display = config.display;
|
||||||
|
break;
|
||||||
|
case Config_lora_tag:
|
||||||
|
fromRadioScratch.config.which_payloadVariant = Config_lora_tag;
|
||||||
|
fromRadioScratch.config.payloadVariant.lora = config.lora;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
|
// NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
|
||||||
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
||||||
// using to the app (so that even old phone apps work with new device loads).
|
// using to the app (so that even old phone apps work with new device loads).
|
||||||
fromRadioScratch.config.power.ls_secs = default_ls_secs;
|
|
||||||
|
config_state++;
|
||||||
|
// Advance when we have sent all of our config objects
|
||||||
|
if (config_state > Config_lora_tag) {
|
||||||
state = STATE_SEND_NODEINFO;
|
state = STATE_SEND_NODEINFO;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO: {
|
case STATE_SEND_NODEINFO: {
|
||||||
@ -233,6 +263,9 @@ bool PhoneAPI::available()
|
|||||||
case STATE_SEND_MY_INFO:
|
case STATE_SEND_MY_INFO:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case STATE_SEND_CONFIG:
|
||||||
|
return true;
|
||||||
|
|
||||||
case STATE_SEND_NODEINFO:
|
case STATE_SEND_NODEINFO:
|
||||||
if (!nodeInfoForPhone)
|
if (!nodeInfoForPhone)
|
||||||
nodeInfoForPhone = nodeDB.readNextInfo();
|
nodeInfoForPhone = nodeDB.readNextInfo();
|
||||||
|
@ -31,6 +31,8 @@ class PhoneAPI
|
|||||||
|
|
||||||
State state = STATE_SEND_NOTHING;
|
State state = STATE_SEND_NOTHING;
|
||||||
|
|
||||||
|
int8_t config_state = Config_device_tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each packet sent to the phone has an incrementing count
|
* Each packet sent to the phone has an incrementing count
|
||||||
*/
|
*/
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#ifndef PB_MESH_PB_H_INCLUDED
|
#ifndef PB_MESH_PB_H_INCLUDED
|
||||||
#define PB_MESH_PB_H_INCLUDED
|
#define PB_MESH_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "localonly.pb.h"
|
#include "config.pb.h"
|
||||||
#include "portnums.pb.h"
|
#include "portnums.pb.h"
|
||||||
#include "telemetry.pb.h"
|
#include "telemetry.pb.h"
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ typedef struct _FromRadio {
|
|||||||
union {
|
union {
|
||||||
MyNodeInfo my_info;
|
MyNodeInfo my_info;
|
||||||
NodeInfo node_info;
|
NodeInfo node_info;
|
||||||
LocalConfig config;
|
Config config;
|
||||||
LogRecord log_record;
|
LogRecord log_record;
|
||||||
uint32_t config_complete_id;
|
uint32_t config_complete_id;
|
||||||
bool rebooted;
|
bool rebooted;
|
||||||
@ -980,7 +980,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11)
|
|||||||
#define FromRadio_DEFAULT NULL
|
#define FromRadio_DEFAULT NULL
|
||||||
#define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo
|
#define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo
|
||||||
#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
|
#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
|
||||||
#define FromRadio_payloadVariant_config_MSGTYPE LocalConfig
|
#define FromRadio_payloadVariant_config_MSGTYPE Config
|
||||||
#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
|
#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
|
||||||
#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
||||||
|
|
||||||
|
@ -225,6 +225,11 @@ void NRF52Bluetooth::setup()
|
|||||||
Bluefruit.autoConnLed(false);
|
Bluefruit.autoConnLed(false);
|
||||||
Bluefruit.begin();
|
Bluefruit.begin();
|
||||||
|
|
||||||
|
// Clear existing data.
|
||||||
|
Bluefruit.Advertising.stop();
|
||||||
|
Bluefruit.Advertising.clearData();
|
||||||
|
Bluefruit.ScanResponse.clearData();
|
||||||
|
|
||||||
// Set the advertised device name (keep it short!)
|
// Set the advertised device name (keep it short!)
|
||||||
Bluefruit.setName(getDeviceName());
|
Bluefruit.setName(getDeviceName());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user