Skip to content

Commit 9750fdd

Browse files
committed
Address @tyeth review for UART/GPS #1
1 parent dee52e8 commit 9750fdd

File tree

5 files changed

+22
-69
lines changed

5 files changed

+22
-69
lines changed

.github/workflows/release-offline.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ jobs:
214214
git clone --quiet https://github.com/pstolarz/OneWireNg.git /home/runner/Arduino/libraries/OneWireNg
215215
git clone --quiet https://github.com/pstolarz/Arduino-Temperature-Control-Library.git /home/runner/Arduino/libraries/Arduino-Temperature-Control-Library
216216
git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino
217-
git clone --quiet --branch fix-for-pico https://github.com/brentru/SdFat.git /home/runner/Arduino/libraries/SdFat_-_Adafruit_Fork/
218217
- name: Download stable Nanopb
219218
id: download-nanopb
220219
continue-on-error: true

src/components/gps/controller.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,6 @@ void GPSController::update() {
125125
return; // bail-out!
126126

127127
for (GPSHardware *drv : _gps_drivers) {
128-
// TODO: Commented out due to parsing failures, stability issue (failed to
129-
// parse NMEA acks for this) Perform a keep-alive check by sending an
130-
// antenna check command every 2 seconds
131-
/* if (millis() - drv->GetPrvKat() > 2000) {
132-
drv->GetAdaGps()->sendCommand(CMD_MTK_CHECK_ANTENNA);
133-
drv->SetPrvKat(millis());
134-
} */
135-
136128
// Did read period elapse?
137129
ulong cur_time = millis();
138130
if (cur_time - drv->GetPollPeriodPrv() < drv->GetPollPeriod())

src/components/gps/hardware.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -104,66 +104,7 @@ bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {
104104
}
105105
}
106106
} else if (_driver_type == GPS_DRV_UBLOX) {
107-
WS_DEBUG_PRINTLN("[gps] Handling GPSConfig for U-Blox driver...");
108107
I2cReadDiscard();
109-
// Iterate through the command sentences and send them to the GPS module
110-
for (size_t i = 0; i < gps_config->commands_ubxes_count; i++) {
111-
// TODO: Tuesday fix this frame decoder!
112-
/* pb_bytes_array_t *ubx_frame = &gps_config->commands_ubxes[i];
113-
// Validate minimum frame size
114-
if (ubx_frame->size < 8) {
115-
WS_DEBUG_PRINT("[gps] Invalid UBX frame size: ");
116-
WS_DEBUG_PRINTLN(ubx_frame->size);
117-
continue;
118-
}
119-
120-
// Validate sync bytes
121-
if (ubx_frame->bytes[0] != 0xB5 || ubx_frame->bytes[1] != 0x62) {
122-
WS_DEBUG_PRINTLN("[gps] Invalid UBX sync bytes");
123-
continue;
124-
}
125-
126-
// Validate frame size
127-
size_t expectedSize = 8 + payloadLength;
128-
if (ubx_frame->size != expectedSize) {
129-
WS_DEBUG_PRINT("[gps] Frame size mismatch. Expected: ");
130-
WS_DEBUG_PRINT(expectedSize);
131-
WS_DEBUG_PRINT(", Got: ");
132-
WS_DEBUG_PRINTLN(ubx_frame->size);
133-
continue;
134-
}
135-
136-
// Extract message components
137-
uint8_t msgClass = ubx_frame->bytes[2];
138-
uint8_t msgId = ubx_frame->bytes[3];
139-
uint16_t payloadLength = ubx_frame->bytes[4] | (ubx_frame->bytes[5]
140-
<< 8);
141-
142-
// Get payload
143-
uint8_t *payload = NULL;
144-
if (payloadLength > 0) {
145-
payload = &ubx_frame->bytes[6];
146-
}
147-
148-
WS_DEBUG_PRINT("[gps] Sending UBX CMD #");
149-
WS_DEBUG_PRINT(i);
150-
WS_DEBUG_PRINT(" - Class: 0x");
151-
WS_DEBUG_PRINT(msgClass, HEX);
152-
WS_DEBUG_PRINT(", ID: 0x");
153-
WS_DEBUG_PRINT(msgId, HEX);
154-
WS_DEBUG_PRINT(", Payload len: ");
155-
WS_DEBUG_PRINTLN(payloadLength);
156-
157-
// Send the message
158-
UBXSendStatus status = _ubx_gps->sendMessageWithAck(msgClass, msgId,
159-
payload, payloadLength);
160-
161-
if (status != UBXSendStatus::UBX_SEND_SUCCESS) {
162-
WS_DEBUG_PRINTLN("[gps] Failed to send UBX message");
163-
} else {
164-
WS_DEBUG_PRINTLN("[gps] OK");
165-
} */
166-
}
167108
} else {
168109
WS_DEBUG_PRINTLN("[gps] ERROR: Unsupported GPS driver type!");
169110
return false;

src/components/uart/model.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,25 @@ bool UARTModel::AddUartInputEvent(sensors_event_t &event,
183183
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
184184
sensor_event.value.float_value = event.pm100_std;
185185
break;
186-
// TODO: Add more cases for other sensor types
186+
case wippersnapper_sensor_SensorType_SENSOR_TYPE_AMBIENT_TEMPERATURE:
187+
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
188+
sensor_event.value.float_value = event.temperature;
189+
break;
190+
case wippersnapper_sensor_SensorType_SENSOR_TYPE_OBJECT_TEMPERATURE:
191+
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
192+
sensor_event.value.float_value = event.temperature;
193+
break;
194+
case wippersnapper_sensor_SensorType_SENSOR_TYPE_AMBIENT_TEMPERATURE_FAHRENHEIT:
195+
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
196+
sensor_event.value.float_value = event.temperature;
197+
break;
198+
case wippersnapper_sensor_SensorType_SENSOR_TYPE_OBJECT_TEMPERATURE_FAHRENHEIT:
199+
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
200+
sensor_event.value.float_value = event.temperature;
201+
case wippersnapper_sensor_SensorType_SENSOR_TYPE_PROXIMITY:
202+
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
203+
sensor_event.value.float_value = event.distance;
204+
break;
187205
default:
188206
sensor_event.which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
189207
sensor_event.value.float_value = event.data[0];

src/provisioning/sdcard/ws_sdcard.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,12 @@ bool ws_sdcard::ParseUartAdd(JsonObject &component,
490490
// for now
491491
msg_uart_add.cfg_serial.timeout =
492492
component["timeout"] | 1000; // Use a default UART timeout of 1000ms
493+
494+
#ifdef HAS_SOFTWARE_SERIAL
493495
msg_uart_add.cfg_serial.use_sw_serial = component["useSwSerial"] | false;
494496
msg_uart_add.cfg_serial.sw_serial_invert =
495497
component["swSerialInvert"] | false;
498+
#endif // HAS_SOFTWARE_SERIAL
496499

497500
// Configure the UART Device
498501
msg_uart_add.has_cfg_device = true;

0 commit comments

Comments
 (0)