Skip to content

Commit 2330368

Browse files
committed
GPS - Match PB
1 parent 232dc1a commit 2330368

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

src/components/gps/hardware.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {
6969
if (_driver_type == GPS_DRV_MTK) {
7070
WS_DEBUG_PRINTLN("[gps] Handling GPSConfig for MediaTek driver...");
7171
// Iterate through the command sentences and send them to the GPS module
72-
for (size_t i = 0; i < gps_config->commands_count; i++) {
72+
for (size_t i = 0; i < gps_config->commands_pmtks_count; i++) {
7373
// Build the PMTK ACK response for the command
7474
char msg_resp[MAX_NEMA_SENTENCE_LEN];
75-
if (!BuildPmtkAck(gps_config->commands[i], msg_resp)) {
75+
if (!BuildPmtkAck(gps_config->commands_pmtks[i], msg_resp)) {
7676
WS_DEBUG_PRINTLN("[gps] ERROR: Failed to build PMTK ACK response!");
7777
return false;
7878
}
@@ -90,21 +90,21 @@ bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {
9090
WS_DEBUG_PRINTLN(" done!");
9191
}
9292
WS_DEBUG_PRINT("[gps] TX, CMD: ");
93-
WS_DEBUG_PRINTLN(gps_config->commands[i]);
93+
WS_DEBUG_PRINTLN(gps_config->commands_pmtks[i]);
9494
// Send the command to the GPS module
95-
_ada_gps->sendCommand(gps_config->commands[i]);
95+
_ada_gps->sendCommand(gps_config->commands_pmtks[i]);
9696
WS_DEBUG_PRINTLN("[gps] Waiting for RX...");
9797
// and wait for the corresponding response from the GPS module
9898
if (!_ada_gps->waitForSentence(msg_resp, 255)) {
9999
WS_DEBUG_PRINT("[gps] ERROR: Failed to get response | cmd:");
100-
WS_DEBUG_PRINTLN(gps_config->commands[i]);
100+
WS_DEBUG_PRINTLN(gps_config->commands_pmtks[i]);
101101
return false;
102102
}
103103
}
104104
} else if (_driver_type == GPS_DRV_UBLOX) {
105-
WS_DEBUG_PRINTLN("[gps] Handling GPSConfig for MediaTek driver...");
105+
WS_DEBUG_PRINTLN("[gps] Handling GPSConfig for U-Blox driver...");
106106
// Iterate through the command sentences and send them to the GPS module
107-
for (size_t i = 0; i < gps_config->commands_count; i++) {
107+
for (size_t i = 0; i < gps_config->commands_ubxes; i++) {
108108
// TODO
109109
}
110110
} else {
@@ -161,7 +161,7 @@ bool GPSHardware::begin() {
161161
WS_DEBUG_PRINTLN("[gps] ERROR: Failed to query GPS module type!");
162162
return false;
163163
}
164-
WS_DEBUG_PRINTLN("[gps] Module detected, ready for commands!");
164+
WS_DEBUG_PRINTLN("[gps] Module detected, ready for commands_pmtks!");
165165
return true;
166166
}
167167

src/protos/gps.pb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#error Regenerate this file with the current version of nanopb generator.
77
#endif
88

9-
PB_BIND(wippersnapper_gps_GPSConfig, wippersnapper_gps_GPSConfig, 2)
9+
PB_BIND(wippersnapper_gps_GPSConfig, wippersnapper_gps_GPSConfig, 4)
1010

1111

1212
PB_BIND(wippersnapper_gps_GPSDateTime, wippersnapper_gps_GPSDateTime, AUTO)

src/protos/gps.pb.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#endif
1111

1212
/* Struct definitions */
13+
typedef PB_BYTES_ARRAY_T(512) wippersnapper_gps_GPSConfig_commands_ubxes_t;
1314
/* *
1415
GPSConfig represents a message containing configuration data to set up and configure a GPS.
1516
Since GPS devices can output lots of data, this message allows users to select which data they want to receive
@@ -18,7 +19,8 @@ typedef struct _wippersnapper_gps_GPSConfig {
1819
/* NOTE: Baud rate is not included here as it is included in the UartAdd->UartSerialConfig message. */
1920
pb_size_t commands_pmtks_count;
2021
char commands_pmtks[16][90]; /* * List of PMTK commands in string format. * */
21-
pb_callback_t commands_ubxes; /* * List of UBX commands in bytes format. * */
22+
pb_size_t commands_ubxes_count;
23+
wippersnapper_gps_GPSConfig_commands_ubxes_t commands_ubxes[16]; /* * List of UBX commands in bytes format. * */
2224
int32_t period; /* * Desired period to poll the GPS module, in milliseconds */
2325
} wippersnapper_gps_GPSConfig;
2426

@@ -75,12 +77,12 @@ extern "C" {
7577
#endif
7678

7779
/* Initializer values for message structs */
78-
#define wippersnapper_gps_GPSConfig_init_default {0, {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}, {{NULL}, NULL}, 0}
80+
#define wippersnapper_gps_GPSConfig_init_default {0, {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0}
7981
#define wippersnapper_gps_GPSDateTime_init_default {0, 0, 0, 0, 0, 0, 0}
8082
#define wippersnapper_gps_GPSRMCResponse_init_default {false, wippersnapper_gps_GPSDateTime_init_default, "", "", "", "", "", "", ""}
8183
#define wippersnapper_gps_GPGGAResponse_init_default {false, wippersnapper_gps_GPSDateTime_init_default, "", "", "", "", 0, 0, "", "", ""}
8284
#define wippersnapper_gps_GPSEvent_init_default {0, {wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default, wippersnapper_gps_GPSRMCResponse_init_default}, 0, {wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default, wippersnapper_gps_GPGGAResponse_init_default}}
83-
#define wippersnapper_gps_GPSConfig_init_zero {0, {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}, {{NULL}, NULL}, 0}
85+
#define wippersnapper_gps_GPSConfig_init_zero {0, {"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0}
8486
#define wippersnapper_gps_GPSDateTime_init_zero {0, 0, 0, 0, 0, 0, 0}
8587
#define wippersnapper_gps_GPSRMCResponse_init_zero {false, wippersnapper_gps_GPSDateTime_init_zero, "", "", "", "", "", "", ""}
8688
#define wippersnapper_gps_GPGGAResponse_init_zero {false, wippersnapper_gps_GPSDateTime_init_zero, "", "", "", "", 0, 0, "", "", ""}
@@ -121,9 +123,9 @@ extern "C" {
121123
/* Struct field encoding specification for nanopb */
122124
#define wippersnapper_gps_GPSConfig_FIELDLIST(X, a) \
123125
X(a, STATIC, REPEATED, STRING, commands_pmtks, 1) \
124-
X(a, CALLBACK, REPEATED, BYTES, commands_ubxes, 2) \
126+
X(a, STATIC, REPEATED, BYTES, commands_ubxes, 2) \
125127
X(a, STATIC, SINGULAR, INT32, period, 3)
126-
#define wippersnapper_gps_GPSConfig_CALLBACK pb_default_field_callback
128+
#define wippersnapper_gps_GPSConfig_CALLBACK NULL
127129
#define wippersnapper_gps_GPSConfig_DEFAULT NULL
128130

129131
#define wippersnapper_gps_GPSDateTime_FIELDLIST(X, a) \
@@ -187,9 +189,9 @@ extern const pb_msgdesc_t wippersnapper_gps_GPSEvent_msg;
187189
#define wippersnapper_gps_GPSEvent_fields &wippersnapper_gps_GPSEvent_msg
188190

189191
/* Maximum encoded size of messages (where known) */
190-
/* wippersnapper_gps_GPSConfig_size depends on runtime parameters */
191-
#define WIPPERSNAPPER_GPS_GPS_PB_H_MAX_SIZE wippersnapper_gps_GPSEvent_size
192+
#define WIPPERSNAPPER_GPS_GPS_PB_H_MAX_SIZE wippersnapper_gps_GPSConfig_size
192193
#define wippersnapper_gps_GPGGAResponse_size 168
194+
#define wippersnapper_gps_GPSConfig_size 9707
193195
#define wippersnapper_gps_GPSDateTime_size 77
194196
#define wippersnapper_gps_GPSEvent_size 3130
195197
#define wippersnapper_gps_GPSRMCResponse_size 139

src/protos/i2c.pb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PB_BIND(wippersnapper_i2c_I2cBusScan, wippersnapper_i2c_I2cBusScan, AUTO)
1818
PB_BIND(wippersnapper_i2c_I2cBusScanned, wippersnapper_i2c_I2cBusScanned, 4)
1919

2020

21-
PB_BIND(wippersnapper_i2c_I2cDeviceAddOrReplace, wippersnapper_i2c_I2cDeviceAddOrReplace, 2)
21+
PB_BIND(wippersnapper_i2c_I2cDeviceAddOrReplace, wippersnapper_i2c_I2cDeviceAddOrReplace, 4)
2222

2323

2424
PB_BIND(wippersnapper_i2c_I2cDeviceAddedOrReplaced, wippersnapper_i2c_I2cDeviceAddedOrReplaced, AUTO)

src/protos/i2c.pb.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,16 @@ extern const pb_msgdesc_t wippersnapper_i2c_I2cDeviceOutputWrite_msg;
345345
#define wippersnapper_i2c_I2cDeviceOutputWrite_fields &wippersnapper_i2c_I2cDeviceOutputWrite_msg
346346

347347
/* Maximum encoded size of messages (where known) */
348-
#define WIPPERSNAPPER_I2C_I2C_PB_H_MAX_SIZE wippersnapper_i2c_I2cBusScanned_size
348+
#define WIPPERSNAPPER_I2C_I2C_PB_H_MAX_SIZE wippersnapper_i2c_I2cDeviceAddOrReplace_size
349349
#define wippersnapper_i2c_I2cBusDescriptor_size 32
350350
#define wippersnapper_i2c_I2cBusScan_size 42
351351
#define wippersnapper_i2c_I2cBusScanned_size 6242
352+
#define wippersnapper_i2c_I2cDeviceAddOrReplace_size 9837
352353
#define wippersnapper_i2c_I2cDeviceAddedOrReplaced_size 56
353354
#define wippersnapper_i2c_I2cDeviceDescriptor_size 50
354355
#define wippersnapper_i2c_I2cDeviceOutputWrite_size 569
355356
#define wippersnapper_i2c_I2cDeviceRemove_size 54
356357
#define wippersnapper_i2c_I2cDeviceRemoved_size 54
357-
#if defined(wippersnapper_gps_GPSConfig_size)
358-
#define wippersnapper_i2c_I2cDeviceAddOrReplace_size (133 + wippersnapper_gps_GPSConfig_size)
359-
#endif
360358
#if defined(wippersnapper_sensor_SensorEvent_size)
361359
#define wippersnapper_i2c_I2cDeviceEvent_size (142 + 15*wippersnapper_sensor_SensorEvent_size)
362360
#endif

src/protos/signal.pb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#error Regenerate this file with the current version of nanopb generator.
77
#endif
88

9-
PB_BIND(wippersnapper_signal_BrokerToDevice, wippersnapper_signal_BrokerToDevice, 2)
9+
PB_BIND(wippersnapper_signal_BrokerToDevice, wippersnapper_signal_BrokerToDevice, 4)
1010

1111

1212
PB_BIND(wippersnapper_signal_DeviceToBroker, wippersnapper_signal_DeviceToBroker, 4)

src/protos/signal.pb.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,13 @@ extern const pb_msgdesc_t wippersnapper_signal_DeviceToBroker_msg;
270270
#define wippersnapper_signal_DeviceToBroker_fields &wippersnapper_signal_DeviceToBroker_msg
271271

272272
/* Maximum encoded size of messages (where known) */
273-
#if defined(wippersnapper_digitalio_DigitalIOEvent_size) && defined(wippersnapper_digitalio_DigitalIOWrite_size) && defined(wippersnapper_uart_UartAdd_size) && defined(wippersnapper_uart_UartWrite_size) && defined(wippersnapper_i2c_I2cDeviceAddOrReplace_size)
274-
union wippersnapper_signal_BrokerToDevice_payload_size_union {char f12[(6 + wippersnapper_digitalio_DigitalIOEvent_size)]; char f13[(6 + wippersnapper_digitalio_DigitalIOWrite_size)]; char f80[(7 + wippersnapper_uart_UartAdd_size)]; char f82[(7 + wippersnapper_uart_UartWrite_size)]; char f91[(7 + wippersnapper_i2c_I2cDeviceAddOrReplace_size)]; char f0[573];};
273+
#if defined(wippersnapper_digitalio_DigitalIOEvent_size) && defined(wippersnapper_digitalio_DigitalIOWrite_size) && defined(wippersnapper_uart_UartAdd_size) && defined(wippersnapper_uart_UartWrite_size)
274+
union wippersnapper_signal_BrokerToDevice_payload_size_union {char f12[(6 + wippersnapper_digitalio_DigitalIOEvent_size)]; char f13[(6 + wippersnapper_digitalio_DigitalIOWrite_size)]; char f80[(7 + wippersnapper_uart_UartAdd_size)]; char f82[(7 + wippersnapper_uart_UartWrite_size)]; char f0[9841];};
275275
#endif
276276
#if defined(wippersnapper_digitalio_DigitalIOEvent_size) && defined(wippersnapper_analogio_AnalogIOEvent_size) && defined(wippersnapper_ds18x20_Ds18x20Event_size) && defined(wippersnapper_uart_UartInputEvent_size) && defined(wippersnapper_i2c_I2cDeviceEvent_size)
277277
union wippersnapper_signal_DeviceToBroker_payload_size_union {char f10[(6 + wippersnapper_digitalio_DigitalIOEvent_size)]; char f20[(7 + wippersnapper_analogio_AnalogIOEvent_size)]; char f80[(7 + wippersnapper_ds18x20_Ds18x20Event_size)]; char f92[(7 + wippersnapper_uart_UartInputEvent_size)]; char f113[(7 + wippersnapper_i2c_I2cDeviceEvent_size)]; char f0[6246];};
278278
#endif
279-
#if defined(wippersnapper_digitalio_DigitalIOEvent_size) && defined(wippersnapper_digitalio_DigitalIOWrite_size) && defined(wippersnapper_uart_UartAdd_size) && defined(wippersnapper_uart_UartWrite_size) && defined(wippersnapper_i2c_I2cDeviceAddOrReplace_size)
279+
#if defined(wippersnapper_digitalio_DigitalIOEvent_size) && defined(wippersnapper_digitalio_DigitalIOWrite_size) && defined(wippersnapper_uart_UartAdd_size) && defined(wippersnapper_uart_UartWrite_size)
280280
#define WIPPERSNAPPER_SIGNAL_SIGNAL_PB_H_MAX_SIZE wippersnapper_signal_BrokerToDevice_size
281281
#define wippersnapper_signal_BrokerToDevice_size (0 + sizeof(union wippersnapper_signal_BrokerToDevice_payload_size_union))
282282
#endif

src/protos/uart.pb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ PB_BIND(wippersnapper_uart_TrinamicDynamixelConfig, wippersnapper_uart_TrinamicD
1818
PB_BIND(wippersnapper_uart_PM25AQIConfig, wippersnapper_uart_PM25AQIConfig, AUTO)
1919

2020

21-
PB_BIND(wippersnapper_uart_UartDeviceConfig, wippersnapper_uart_UartDeviceConfig, 2)
21+
PB_BIND(wippersnapper_uart_UartDeviceConfig, wippersnapper_uart_UartDeviceConfig, 4)
2222

2323

24-
PB_BIND(wippersnapper_uart_UartAdd, wippersnapper_uart_UartAdd, 2)
24+
PB_BIND(wippersnapper_uart_UartAdd, wippersnapper_uart_UartAdd, 4)
2525

2626

2727
PB_BIND(wippersnapper_uart_UartAdded, wippersnapper_uart_UartAdded, AUTO)

0 commit comments

Comments
 (0)