diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index a711ec0a51..ef86df5952 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -29,6 +29,16 @@ #define ADVERT_LON 0.0 #endif +// GPS defaults for a NEW install. Boards with a permanently-fitted GNSS (and no +// UI to switch it on) override these in their platformio.ini; every other board +// keeps the historical "GPS off, advertise the configured coordinates" defaults. +#ifndef GPS_ENABLED_DEFAULT + #define GPS_ENABLED_DEFAULT 0 +#endif +#ifndef ADVERT_LOC_POLICY_DEFAULT + #define ADVERT_LOC_POLICY_DEFAULT ADVERT_LOC_PREFS +#endif + #ifndef ADMIN_PASSWORD #define ADMIN_PASSWORD "password" #endif @@ -919,9 +929,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc StrHelper::strncpy(_prefs.bridge_secret, "LVSITANOS", sizeof(_prefs.bridge_secret)); // GPS defaults - _prefs.gps_enabled = 0; + _prefs.gps_enabled = GPS_ENABLED_DEFAULT; _prefs.gps_interval = 0; - _prefs.advert_loc_policy = ADVERT_LOC_PREFS; + _prefs.advert_loc_policy = ADVERT_LOC_POLICY_DEFAULT; _prefs.adc_multiplier = 0.0f; // 0.0f means use default board multiplier diff --git a/examples/simple_room_server/MyMesh.cpp b/examples/simple_room_server/MyMesh.cpp index 546d094fc8..fb66008f08 100644 --- a/examples/simple_room_server/MyMesh.cpp +++ b/examples/simple_room_server/MyMesh.cpp @@ -670,9 +670,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc #endif // GPS defaults - _prefs.gps_enabled = 0; + _prefs.gps_enabled = GPS_ENABLED_DEFAULT; _prefs.gps_interval = 0; - _prefs.advert_loc_policy = ADVERT_LOC_PREFS; + _prefs.advert_loc_policy = ADVERT_LOC_POLICY_DEFAULT; #if defined(USE_SX1262) || defined(USE_SX1268) #ifdef SX126X_RX_BOOSTED_GAIN diff --git a/examples/simple_room_server/MyMesh.h b/examples/simple_room_server/MyMesh.h index 5cf949c6bd..d376ee958e 100644 --- a/examples/simple_room_server/MyMesh.h +++ b/examples/simple_room_server/MyMesh.h @@ -61,6 +61,16 @@ #define ADVERT_LON 0.0 #endif +// GPS defaults for a NEW install. Boards with a permanently-fitted GNSS (and no +// UI to switch it on) override these in their platformio.ini; every other board +// keeps the historical "GPS off, advertise the configured coordinates" defaults. +#ifndef GPS_ENABLED_DEFAULT + #define GPS_ENABLED_DEFAULT 0 +#endif +#ifndef ADVERT_LOC_POLICY_DEFAULT + #define ADVERT_LOC_POLICY_DEFAULT ADVERT_LOC_PREFS +#endif + #ifndef ADMIN_PASSWORD #define ADMIN_PASSWORD "password" #endif diff --git a/variants/thinknode_m6/platformio.ini b/variants/thinknode_m6/platformio.ini index ad7e6902cf..cfac5e2cd5 100644 --- a/variants/thinknode_m6/platformio.ini +++ b/variants/thinknode_m6/platformio.ini @@ -47,6 +47,16 @@ build_flags = -D ADVERT_LON=0.0 -D ADMIN_PASSWORD='"password"' -D MAX_NEIGHBOURS=50 +; The L76K GNSS is soldered to the M6 and the enclosure is sealed, so there is +; no button or screen to switch GPS on with. Skip the 1s "is a GPS attached?" +; probe (it gates the 'gps' setting, and losing that race leaves GPS +; unreachable until reboot), enable GPS for new installs, and advertise the +; position the GNSS actually reports instead of the fixed 0,0 above. +; All of it stays changeable at runtime over the serial CLI: 'gps on'/'gps off', +; 'gps advert prefs|share|none', and bare 'gps' to print fix + satellite count. + -D ENV_SKIP_GPS_DETECT=1 + -D GPS_ENABLED_DEFAULT=1 + -D ADVERT_LOC_POLICY_DEFAULT=ADVERT_LOC_SHARE ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 ; -D GPS_NMEA_DEBUG=1 @@ -64,6 +74,13 @@ build_flags = -D ADVERT_LON=0.0 -D ADMIN_PASSWORD='"password"' -D ROOM_PASSWORD='"hello"' +; Same reasoning as the repeater env above: the L76K is soldered on and the +; enclosure is sealed, so GPS has to come up enabled and advertise the position +; the GNSS actually reports. Runtime CLI still wins ('gps on'/'gps off', +; 'gps advert prefs|share|none'). + -D ENV_SKIP_GPS_DETECT=1 + -D GPS_ENABLED_DEFAULT=1 + -D ADVERT_LOC_POLICY_DEFAULT=ADVERT_LOC_SHARE ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 build_src_filter = ${ThinkNode_M6.build_src_filter}