application: add gm1351 decoding
This commit is contained in:
parent
56d540a04c
commit
93d85322d5
|
@ -477,16 +477,18 @@ void main(void)
|
|||
if (sensor_gm1351_received_flag) { // meter data has been received
|
||||
action = true; // action has been performed
|
||||
sensor_gm1351_received_flag = false; // reset flag
|
||||
led_toggle(); // notify user about activity
|
||||
gm1351_last = rtc_get_counter_val(); // remember we got a value
|
||||
char measurement[10 + 1]; // to store the string with the measurement value
|
||||
snprintf(measurement, LENGTH(measurement), "%u.%u dBa\n", sensor_gm1351_decidba / 10, sensor_gm1351_decidba % 10); // generate string
|
||||
if (gm1351_show) {
|
||||
puts(measurement); // display measurement to user
|
||||
}
|
||||
// sen measurement to Bluetooth module
|
||||
for (uint8_t i = 0; i < LENGTH(measurement) && measurement[i] != '\0'; i++) {
|
||||
spp_tx_putchar_nonblocking( measurement[i]);
|
||||
if (sensor_gm1351_decode()) { // decode received value
|
||||
led_toggle(); // notify user about activity
|
||||
gm1351_last = rtc_get_counter_val(); // remember we got a value
|
||||
char measurement[10 + 1]; // to store the string with the measurement value
|
||||
snprintf(measurement, LENGTH(measurement), "%u.%u dBa\n", sensor_gm1351_decidba / 10, sensor_gm1351_decidba % 10); // generate string
|
||||
if (gm1351_show) {
|
||||
puts(measurement); // display measurement to user
|
||||
}
|
||||
// sen measurement to Bluetooth module
|
||||
for (uint8_t i = 0; i < LENGTH(measurement) && measurement[i] != '\0'; i++) {
|
||||
spp_tx_putchar_nonblocking( measurement[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (action) { // go to sleep if nothing had to be done, else recheck for activity
|
||||
|
|
Loading…
Reference in New Issue