rename: passtime_ms5 → passtime_ms
This commit is contained in:
@@ -100,7 +100,7 @@ typedef struct {
|
|||||||
uint32_t freq; // 频率 (3 bytes, little-endian)
|
uint32_t freq; // 频率 (3 bytes, little-endian)
|
||||||
uint16_t variation; // 变化量 (2 bytes, little-endian)
|
uint16_t variation; // 变化量 (2 bytes, little-endian)
|
||||||
union {
|
union {
|
||||||
uint32_t passtime_ms5; // 通过时间/车间距, 5ms单位 (misc_type=0)
|
uint32_t passtime_ms; // 通过时间/车间距, 5ms单位 (misc_type=0)
|
||||||
uint32_t cut_amount; // 线圈断开次数 (misc_type=1)
|
uint32_t cut_amount; // 线圈断开次数 (misc_type=1)
|
||||||
uint32_t flow_amount; // 车流量数 (misc_type=2)
|
uint32_t flow_amount; // 车流量数 (misc_type=2)
|
||||||
uint32_t relay_count; // 继电器输出次数 (misc_type=3)
|
uint32_t relay_count; // 继电器输出次数 (misc_type=3)
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ int lup_parse_sensor_report(const uint8_t *pkg, uint16_t len, LUP_SensorReport *
|
|||||||
|
|
||||||
cs->freq = c[2] | ((uint32_t)c[3] << 8) | ((uint32_t)c[4] << 16);
|
cs->freq = c[2] | ((uint32_t)c[3] << 8) | ((uint32_t)c[4] << 16);
|
||||||
cs->variation = c[5] | ((uint16_t)c[6] << 8);
|
cs->variation = c[5] | ((uint16_t)c[6] << 8);
|
||||||
cs->misc.passtime_ms5 = c[7] | ((uint32_t)c[8] << 8)
|
cs->misc.passtime_ms = c[7] | ((uint32_t)c[8] << 8)
|
||||||
| ((uint32_t)c[9] << 16) | ((uint32_t)c[10] << 24);
|
| ((uint32_t)c[9] << 16) | ((uint32_t)c[10] << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -949,8 +949,8 @@ static int format_sensor_json(char *buf, uint16_t buf_size, const LUP_SensorRepo
|
|||||||
switch (cs->misc_type) {
|
switch (cs->misc_type) {
|
||||||
case 0:
|
case 0:
|
||||||
// car_state=0(无车)→通过时间, car_state=1(有车)→车间距
|
// car_state=0(无车)→通过时间, car_state=1(有车)→车间距
|
||||||
misc_field = cs->car_state ? "\"gap_ms5\"" : "\"passtime_ms5\"";
|
misc_field = cs->car_state ? "\"gap_ms5\"" : "\"passtime_ms\"";
|
||||||
misc_val = cs->misc.passtime_ms5;
|
misc_val = cs->misc.passtime_ms;
|
||||||
break;
|
break;
|
||||||
case 1: misc_field = "\"cut_amount\""; misc_val = cs->misc.cut_amount; break;
|
case 1: misc_field = "\"cut_amount\""; misc_val = cs->misc.cut_amount; break;
|
||||||
case 2: misc_field = "\"flow_amount\""; misc_val = cs->misc.flow_amount; break;
|
case 2: misc_field = "\"flow_amount\""; misc_val = cs->misc.flow_amount; break;
|
||||||
|
|||||||
Reference in New Issue
Block a user