Skip to content

Commit 11f5de2

Browse files
committed
add(logging): improve sd/sensor failure messages
1 parent d308561 commit 11f5de2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/Wippersnapper_V2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,11 +1288,12 @@ void Wippersnapper_V2::connect() {
12881288
// Parse the JSON file
12891289
if (!WsV2._sdCardV2->ParseFileConfig())
12901290
haltErrorV2("[APP] Failed to parse config.json!");
1291-
WS_DEBUG_PRINTLN("[APP] Attempting to configure hardware...");
12921291
#ifndef OFFLINE_MODE_DEBUG
1292+
WS_DEBUG_PRINTLN("[APP] Creating new .log file on SD card...");
12931293
if (!WsV2._sdCardV2->CreateNewLogFile())
12941294
haltErrorV2("Unable to create new .log file on SD card!");
12951295
#endif
1296+
WS_DEBUG_PRINTLN("[APP] Attempting to configure hardware...");
12961297
// Call the TL signal decoder to parse the incoming JSON data
12971298
callDecodeB2D();
12981299
#ifndef OFFLINE_MODE_WOKWI

src/components/i2c/controller.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,9 @@ void I2cController::update() {
14541454
sensors_event_t event = {0};
14551455
// Attempt to call driver's read handler function
14561456
if (!drv->GetSensorEvent(drv->_sensors[i], &event)) {
1457-
WS_DEBUG_PRINTLN("[i2c] ERROR: Failed to read sensor!");
1457+
WS_DEBUG_PRINT("[i2c] ERROR: Failed to read sensor! (");
1458+
WS_DEBUG_PRINT(drv->GetDrvName());
1459+
WS_DEBUG_PRINTLN(")");
14581460
continue;
14591461
}
14601462
// Fill the I2cDeviceEvent's sensor_event array submsg.

src/provisioning/sdcard/ws_sdcard.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,11 @@ bool ws_sdcard::CreateNewLogFile() {
813813

814814
// Attempt to create a new log file
815815
File32 file;
816-
if (!file.open(_log_filename, O_RDWR | O_CREAT | O_AT_END))
816+
WS_DEBUG_PRINTLN("[SD] Opening new log file");
817+
if (!file.open(_log_filename, O_RDWR | O_CREAT | O_AT_END)) {
818+
WS_DEBUG_PRINTLN("[SD] Error: Unable to create new log file on SD card!");
817819
return false;
820+
}
818821
WS_DEBUG_PRINT("[SD] Created new log file on SD card: ");
819822
WS_DEBUG_PRINTLN(_log_filename);
820823
_sd_cur_log_files++;

0 commit comments

Comments
 (0)