From cff87234c496f0a4522cd2ac57941f14c729b6ad Mon Sep 17 00:00:00 2001 From: fctom1215 <fctom1215@outlook.com> Date: 星期五, 28 八月 2020 01:05:09 +0800 Subject: [PATCH] 坐标 --- lib/src/main/cpp/test_common/car_sensor.cpp | 65 ++++++++++++++++---------------- 1 files changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/src/main/cpp/test_common/car_sensor.cpp b/lib/src/main/cpp/test_common/car_sensor.cpp index b3a524c..d6f2a86 100644 --- a/lib/src/main/cpp/test_common/car_sensor.cpp +++ b/lib/src/main/cpp/test_common/car_sensor.cpp @@ -76,6 +76,7 @@ memset(SensorConfig, 0, sizeof(SensorConfig)); memset(CarStatus, 0, sizeof(CarStatus)); + CarStatus[DOOR] = DOOR_CLOSE; memset(&Sensor, 0, sizeof(Sensor)); @@ -88,36 +89,36 @@ void SetSensorCfg(int (*sensor)[3], int sensorNum) { - DEBUG("鍔犲叆浼犳劅鍣ㄩ厤缃� sensorNum %d", sensorNum); - - pthread_mutex_lock(&sonser_mutex); - - SensorNum = sensorNum; - for (int i = 0; i < sensorNum; ++i) { - DEBUG(" 閰嶇疆<%d>: id %d - fun %d - lvl %d", i, sensor[i][0], sensor[i][1], sensor[i][2]); - - SensorConfig[i].gpioId = sensor[i][0]; - SensorConfig[i].funId = sensor[i][1]; - if (sensor[i][2] > 0) { - SensorConfig[i].validLvl = 1; - } else { - SensorConfig[i].validLvl = 0; - } - - int level = 0; - - if (gpioStore & BV(SensorConfig[i].gpioId)) { - level = 1; - } - - if (level == SensorConfig[i].validLvl) { - SensorChanged(SensorConfig[i].funId, 1); - } else { - SensorChanged(SensorConfig[i].funId, 0); - } - } - - pthread_mutex_unlock(&sonser_mutex); +// DEBUG("鍔犲叆浼犳劅鍣ㄩ厤缃� sensorNum %d", sensorNum); +// +// pthread_mutex_lock(&sonser_mutex); +// +// SensorNum = sensorNum; +// for (int i = 0; i < sensorNum; ++i) { +// DEBUG(" 閰嶇疆<%d>: id %d - fun %d - lvl %d", i, sensor[i][0], sensor[i][1], sensor[i][2]); +// +// SensorConfig[i].gpioId = sensor[i][0]; +// SensorConfig[i].funId = sensor[i][1]; +// if (sensor[i][2] > 0) { +// SensorConfig[i].validLvl = 1; +// } else { +// SensorConfig[i].validLvl = 0; +// } +// +// int level = 0; +// +// if (gpioStore & BV(SensorConfig[i].gpioId)) { +// level = 1; +// } +// +// if (level == SensorConfig[i].validLvl) { +// SensorChanged(SensorConfig[i].funId, 1); +// } else { +// SensorChanged(SensorConfig[i].funId, 0); +// } +// } +// +// pthread_mutex_unlock(&sonser_mutex); } void UpdateSensor(uint16_t gpio, uint16_t speed, uint16_t rpm) @@ -187,8 +188,8 @@ if (s->handBreak != Sensor.handBreak && s->handBreak != '#') { SensorChanged(SENSOR_HANDBREAK, BX(s->handBreak)); } - if (s->lock != Sensor.lock && s->lock != '#') { - SensorChanged(SENSOR_DOOR, BX(s->lock)); + if (s->door != Sensor.door && s->door != '#') { + SensorChanged(SENSOR_DOOR, BX(s->door)); } if (s->surround1 != Sensor.surround1 && s->surround1 != '#') { SensorChanged(SENSOR_SURROUND_CAR_1, BX(s->surround1)); -- Gitblit v1.8.0