sforkowany z mirror/meshtastic-firmware
fix bt reads of owner etc
rodzic
b538677ad2
commit
37eca63e58
1
TODO.md
1
TODO.md
|
@ -1,7 +1,6 @@
|
|||
# High priority
|
||||
|
||||
* implement regen user and radio prefs
|
||||
* figure out why protobuf reads of Owner fail - debug with jtag
|
||||
* have meshservice send location data on mesh (if device has a GPS)
|
||||
* implement getCurrentTime() - set based off gps but then updated locally
|
||||
* confirm second device receives that gps message and updates device db
|
||||
|
|
|
@ -20,7 +20,7 @@ framework = arduino
|
|||
board_build.partitions = partition-table.csv
|
||||
|
||||
; note: we add src to our include search path so that lmic_project_config can override
|
||||
build_flags = -Wall -Wextra -Wno-missing-field-initializers -Isrc -O3 -Wl,-Map,.pio/build/esp32/output.map -DAXP_DEBUG_PORT=Serial -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||
build_flags = -Wall -Wextra -Wno-missing-field-initializers -Isrc -O3 -Wl,-Map,.pio/build/esp32/output.map -DAXP_DEBUG_PORT=Serial
|
||||
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||
|
||||
upload_speed = 921600
|
||||
|
|
|
@ -229,7 +229,7 @@ When the esp32 advances fromnum, it will delay doing the notify by 100ms, in the
|
|||
Note: that if the phone ever sees this number decrease, it means the esp32 has rebooted.
|
||||
|
||||
meshMyNodeCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ)
|
||||
mynode - read/write this to access a MyNodeInfo protobuf
|
||||
mynode - read this to access a MyNodeInfo protobuf
|
||||
|
||||
meshNodeInfoCharacteristic("d31e02e0-c8ab-4d3f-9cc9-0b8466bdabe8", BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_READ),
|
||||
nodeinfo - read this to get a series of node infos (ending with a null empty record), write to this to restart the read statemachine that returns all the node infos
|
||||
|
|
|
@ -43,12 +43,11 @@ uint64_t getCurrentTime()
|
|||
|
||||
NodeDB::NodeDB()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void NodeDB::init() {
|
||||
ourNodeNum = getDesiredNodeNum();
|
||||
myNodeInfo.my_node_num = getDesiredNodeNum();
|
||||
|
||||
// Init our blank owner info to reasonable defaults
|
||||
sprintf(owner.id, "!%02x%02x%02x%02x%02x%02x", ourMacAddr[0],
|
||||
|
@ -58,7 +57,7 @@ void NodeDB::init() {
|
|||
// FIXME, read owner info from flash
|
||||
|
||||
// Include our owner in the node db under our nodenum
|
||||
NodeInfo *info = getOrCreateNode(ourNodeNum);
|
||||
NodeInfo *info = getOrCreateNode(getNodeNum());
|
||||
info->user = owner;
|
||||
info->has_user = true;
|
||||
info->last_seen = getCurrentTime();
|
||||
|
|
10
src/NodeDB.h
10
src/NodeDB.h
|
@ -6,12 +6,13 @@
|
|||
#include "mesh-pb-constants.h"
|
||||
#include "MeshTypes.h"
|
||||
|
||||
extern MyNodeInfo myNodeInfo;
|
||||
extern User owner;
|
||||
|
||||
class NodeDB
|
||||
{
|
||||
// NodeNum provisionalNodeNum; // if we are trying to find a node num this is our current attempt
|
||||
|
||||
NodeNum ourNodeNum = 0;
|
||||
|
||||
// A NodeInfo for every node we've seen
|
||||
// Eventually use a smarter datastructure
|
||||
// HashMap<NodeNum, NodeInfo> nodes;
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
/// we updateGUI and updateGUIforNode if we think our this change is big enough for a redraw
|
||||
void updateFrom(const MeshPacket &p);
|
||||
|
||||
NodeNum getNodeNum() { return ourNodeNum; }
|
||||
NodeNum getNodeNum() { return myNodeInfo.my_node_num; }
|
||||
|
||||
/// if returns false, that means our node should send a DenyNodeNum response. If true, we think the number is okay for use
|
||||
// bool handleWantNodeNum(NodeNum n);
|
||||
|
@ -62,5 +63,4 @@ private:
|
|||
};
|
||||
|
||||
extern NodeDB nodeDB;
|
||||
extern MyNodeInfo myNodeInfo;
|
||||
extern User owner;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
|
|||
{
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(destbuf, destbufsize);
|
||||
if (!pb_encode(&stream, fields, &src_struct))
|
||||
if (!pb_encode(&stream, fields, src_struct))
|
||||
{
|
||||
DEBUG_MSG("Error: can't encode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
assert(0); // FIXME - panic
|
||||
|
@ -27,7 +27,7 @@ size_t pb_encode_to_bytes(uint8_t *destbuf, size_t destbufsize, const pb_msgdesc
|
|||
bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msgdesc_t *fields, void *dest_struct)
|
||||
{
|
||||
pb_istream_t stream = pb_istream_from_buffer(srcbuf, srcbufsize);
|
||||
if (!pb_decode(&stream, fields, &dest_struct))
|
||||
if (!pb_decode(&stream, fields, dest_struct))
|
||||
{
|
||||
DEBUG_MSG("Error: can't decode protobuf %s\n", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
|
|
Ładowanie…
Reference in New Issue