Skip to content

Commit 967b2ae

Browse files
committed
wip(offline): log component name+address, support nested type
1 parent f33cf3f commit 967b2ae

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/provisioning/sdcard/ws_sdcard.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,17 @@ bool ws_sdcard::ParseI2cDeviceAddReplace(
673673
msg_i2c_add.i2c_device_sensor_types_count = 0;
674674
for (JsonObject components_0_i2cDeviceSensorType :
675675
component["i2cDeviceSensorTypes"].as<JsonArray>()) {
676-
msg_i2c_add
677-
.i2c_device_sensor_types[msg_i2c_add.i2c_device_sensor_types_count] =
678-
ParseSensorType(components_0_i2cDeviceSensorType["type"]);
676+
if (components_0_i2cDeviceSensorType["type"].is<JsonString>()) {
677+
msg_i2c_add
678+
.i2c_device_sensor_types[msg_i2c_add.i2c_device_sensor_types_count] =
679+
ParseSensorType(components_0_i2cDeviceSensorType["type"]);
680+
} else {
681+
msg_i2c_add
682+
.i2c_device_sensor_types[msg_i2c_add.i2c_device_sensor_types_count] =
683+
ParseSensorType(
684+
components_0_i2cDeviceSensorType["type"]["sensorType"] |
685+
"UNSPECIFIED");
686+
}
679687
msg_i2c_add.i2c_device_sensor_types_count++;
680688
}
681689

@@ -997,7 +1005,11 @@ bool ws_sdcard::ParseComponents(JsonArray &components) {
9971005
msg_signal_b2d.payload.ds18x20_add = msg_add;
9981006
}
9991007
} else if (strcmp(component_api_type, "i2c") == 0) {
1000-
WS_DEBUG_PRINTLN("[SD] I2C component found in cfg");
1008+
WS_DEBUG_PRINT("[SD] I2C component (");
1009+
WS_DEBUG_PRINT(component["name"] | UNKNOWN_VALUE);
1010+
WS_DEBUG_PRINT(" @ ");
1011+
WS_DEBUG_PRINT(component["i2cDeviceAddress"] | "0x??");
1012+
WS_DEBUG_PRINTLN(") found in cfg");
10011013
// Init for use=yes || use=auto
10021014
wippersnapper_i2c_I2cDeviceAddOrReplace msg_add =
10031015
wippersnapper_i2c_I2cDeviceAddOrReplace_init_default;

0 commit comments

Comments
 (0)