Use int based lat/long from now on in the device code

for https://github.com/meshtastic/Meshtastic-device/issues/124
This commit is contained in:
geeksville
2020-05-04 08:09:08 -07:00
parent 29fd8dc7a5
commit 9b309fe0a0
8 changed files with 31 additions and 38 deletions

View File

@@ -269,8 +269,7 @@ void MeshService::sendToMesh(MeshPacket *p)
if (p->to == nodeDB.getNodeNum()) {
DEBUG_MSG("Dropping locally processed message\n");
releaseToPool(p);
}
else {
} else {
// Note: We might return !OK if our fifo was full, at that point the only option we have is to drop it
if (router.send(p) != ERRNO_OK) {
DEBUG_MSG("No radio was able to send packet, discarding...\n");
@@ -333,8 +332,8 @@ int MeshService::onGPSChanged(void *unused)
if (gps.latitude != 0 || gps.longitude != 0) {
if (gps.altitude != 0)
pos.altitude = gps.altitude;
pos.latitude = gps.latitude;
pos.longitude = gps.longitude;
pos.latitude_i = gps.latitude;
pos.longitude_i = gps.longitude;
pos.time = gps.getValidTime();
}

View File

@@ -55,11 +55,3 @@ PB_BIND(ToRadio, ToRadio, 2)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -66,11 +66,11 @@ typedef struct _MyNodeInfo {
} MyNodeInfo;
typedef struct _Position {
double latitude;
double longitude;
int32_t altitude;
int32_t battery_level;
uint32_t time;
int32_t latitude_i;
int32_t longitude_i;
} Position;
typedef struct _RadioConfig_UserPreferences {
@@ -237,8 +237,8 @@ typedef struct _ToRadio {
#define MyNodeInfo_error_code_tag 7
#define MyNodeInfo_error_address_tag 8
#define MyNodeInfo_error_count_tag 9
#define Position_latitude_tag 1
#define Position_longitude_tag 2
#define Position_latitude_i_tag 7
#define Position_longitude_i_tag 8
#define Position_altitude_tag 3
#define Position_battery_level_tag 4
#define Position_time_tag 6
@@ -297,11 +297,11 @@ typedef struct _ToRadio {
/* Struct field encoding specification for nanopb */
#define Position_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, latitude, 1) \
X(a, STATIC, SINGULAR, DOUBLE, longitude, 2) \
X(a, STATIC, SINGULAR, INT32, altitude, 3) \
X(a, STATIC, SINGULAR, INT32, battery_level, 4) \
X(a, STATIC, SINGULAR, UINT32, time, 6)
X(a, STATIC, SINGULAR, UINT32, time, 6) \
X(a, STATIC, SINGULAR, INT32, latitude_i, 7) \
X(a, STATIC, SINGULAR, INT32, longitude_i, 8)
#define Position_CALLBACK NULL
#define Position_DEFAULT NULL
@@ -486,21 +486,21 @@ extern const pb_msgdesc_t ToRadio_msg;
#define ToRadio_fields &ToRadio_msg
/* Maximum encoded size of messages (where known) */
#define Position_size 46
#define Position_size 50
#define Data_size 256
#define User_size 72
/* RouteDiscovery_size depends on runtime parameters */
#define SubPacket_size 383
#define MeshPacket_size 425
#define SubPacket_size 387
#define MeshPacket_size 429
#define ChannelSettings_size 44
#define RadioConfig_size 120
#define RadioConfig_UserPreferences_size 72
#define NodeInfo_size 138
#define NodeInfo_size 142
#define MyNodeInfo_size 85
#define DeviceState_size 18925
#define DeviceState_size 19185
#define DebugString_size 258
#define FromRadio_size 434
#define ToRadio_size 428
#define FromRadio_size 438
#define ToRadio_size 432
#ifdef __cplusplus
} /* extern "C" */