MCPcopy Create free account
hub / github.com/cptkirki/PrintSphere / cJSON_ArrayForEach

Function cJSON_ArrayForEach

main/src/bambu_cloud_client.cpp:1563–1577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1561
1562 const cJSON* item = nullptr;
1563 cJSON_ArrayForEach(item, info_array) {
1564 const int id = json_int_local(item, "id", -1);
1565 if (id != 0) continue;
1566 const cJSON* snow_item = cJSON_GetObjectItemCaseSensitive(item, "snow");
1567 if (snow_item == nullptr || !cJSON_IsNumber(snow_item)) return -1;
1568
1569 const int snow = snow_item->valueint;
1570 const int ams_id = (snow >> 8) & 0xFF;
1571 const int slot_id = snow & 0xFF;
1572 ESP_LOGI(kTag, "[DIAG] cloud extruder snow: raw=%d ams_id=%d slot_id=%d", snow, ams_id, slot_id);
1573
1574 if (ams_id == 255) return 254;
1575 if (ams_id >= 128) return ams_id;
1576 return ams_id * 4 + slot_id;
1577 }
1578 return -1;
1579}
1580

Callers

nothing calls this directly

Calls 1

json_int_localFunction · 0.70

Tested by

no test coverage detected