From 53cc8f9da3cf75467d915f506de03290963d073c Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 12 Feb 2020 14:18:43 -0800 Subject: [PATCH] set rx_time in packets --- TODO.md | 4 +++- src/MeshService.cpp | 2 ++ src/mesh.pb.h | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 3ab71ce28..48c3a2241 100644 --- a/TODO.md +++ b/TODO.md @@ -1,13 +1,15 @@ # High priority -* have node info screen show real info (including time since last contact, distance and heading) +* have node info screen show real info (including distance and heading) * make debug info screen show real data (including battery level & charging) * show real text info on the text screen +* update build to generate both board types * retest BLE software update for both board types * turn on screen when a new update arrives # Medium priority +* answer to pings with our latest location * show radio and gps signal strength as an image * apply radio settings from android land * only BLE advertise for a short time after the screen is on and button pressed - to save power and prevent people for sniffing for our BT app. diff --git a/src/MeshService.cpp b/src/MeshService.cpp index 746de39f7..c7355a395 100644 --- a/src/MeshService.cpp +++ b/src/MeshService.cpp @@ -81,6 +81,8 @@ void MeshService::handleFromRadio() uint32_t oldFromNum = fromNum; while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL) { + mp->rx_time = gps.getTime() / 1000; // store the arrival timestamp for the phone + if (mp->has_payload && mp->payload.which_variant == SubPacket_user_tag) { bool wasBroadcast = mp->to == NODENUM_BROADCAST; diff --git a/src/mesh.pb.h b/src/mesh.pb.h index 111a5bbc3..6531ea4eb 100644 --- a/src/mesh.pb.h +++ b/src/mesh.pb.h @@ -112,7 +112,7 @@ typedef struct _MeshPacket { int32_t to; bool has_payload; SubPacket payload; - uint64_t rx_time; + uint32_t rx_time; } MeshPacket; typedef struct _DeviceState { @@ -277,7 +277,7 @@ X(a, STATIC, ONEOF, MESSAGE, (variant,user,variant.user), 4) X(a, STATIC, SINGULAR, INT32, from, 1) \ X(a, STATIC, SINGULAR, INT32, to, 2) \ X(a, STATIC, OPTIONAL, MESSAGE, payload, 3) \ -X(a, STATIC, SINGULAR, UINT64, rx_time, 4) +X(a, STATIC, SINGULAR, UINT32, rx_time, 4) #define MeshPacket_CALLBACK NULL #define MeshPacket_DEFAULT NULL #define MeshPacket_payload_MSGTYPE SubPacket @@ -387,15 +387,15 @@ extern const pb_msgdesc_t ToRadio_msg; #define Data_size 205 #define User_size 72 #define SubPacket_size 208 -#define MeshPacket_size 244 +#define MeshPacket_size 239 #define ChannelSettings_size 50 #define RadioConfig_size 72 #define RadioConfig_UserPreferences_size 18 #define NodeInfo_size 157 #define MyNodeInfo_size 13 -#define DeviceState_size 13189 -#define FromRadio_size 253 -#define ToRadio_size 247 +#define DeviceState_size 13029 +#define FromRadio_size 248 +#define ToRadio_size 242 #ifdef __cplusplus } /* extern "C" */