Skip to content

Commit d582b26

Browse files
a8jantschak909
authored andcommitted
[coco] fix network_json_parse and network_json_query
- missing channel mode json in network_json_parse - call network_read() in network_json_query
1 parent c33fcfa commit d582b26

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

coco/src/fn_network/network_json_parse.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ uint8_t network_json_parse(const char *devicespec)
1818

1919
jp.opcode = OP_NET;
2020
jp.unit = network_unit(devicespec);
21+
jp.cmd = 0xFC; // CMD_SET_CHANNEL_MODE;
22+
jp.aux1 = 1; // CHANNELMODE_JSON
23+
jp.aux2 = 0;
24+
25+
bus_ready();
26+
dwwrite((uint8_t *)&jp, sizeof(jp));
27+
2128
jp.cmd = 'P';
2229
jp.aux1 = jp.aux2 = 0;
2330

2431
bus_ready();
2532
dwwrite((uint8_t *)&jp, sizeof(jp));
26-
bus_ready(); // we want to be sure parse completes.
2733

2834
return network_get_error(jp.unit);
2935
}

coco/src/fn_network/network_json_query.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ int16_t network_json_query(const char *devicespec, const char *query, char *s)
3232

3333
network_status(devicespec, &bw, &c, &err);
3434

35-
if (bw)
36-
network_get_response(unit, (uint8_t *)s, bw);
37-
38-
return network_get_error(unit);
35+
if (!bw)
36+
return 0;
37+
38+
return network_read(devicespec, (uint8_t *)s, bw);
3939
}

0 commit comments

Comments
 (0)