Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: nRF51822
Diff: Source/main.cpp
- Revision:
- 42:213f9b0cabe4
- Parent:
- 41:80f618bb53a4
- Child:
- 46:b85be1ccf179
--- a/Source/main.cpp Thu Mar 19 19:10:42 2020 +0000
+++ b/Source/main.cpp Fri Mar 20 17:25:47 2020 +0000
@@ -119,22 +119,26 @@
cap_sense_led = 0;
vdd_enable = 0;
- if(on_reading > off_reading+CAP_THRESHOLD)
+ if(off_reading<CAP_MAX_OFF_READING)
+ { // reading only valid if above is true
+ if(on_reading > off_reading+CAP_THRESHOLD)
#else
- if(capon)
-#endif
{
- is_cap_off = 0;
- #if ENABLE_LED
- led = 0;
- #endif
- }
- else
- {
- is_cap_off = 1;
- #if ENABLE_LED
- led = 1;
- #endif
+ if(capon)
+#endif
+ {
+ is_cap_off = 0;
+ #if ENABLE_LED
+ led = 0;
+ #endif
+ }
+ else
+ {
+ is_cap_off = 1;
+ #if ENABLE_LED
+ led = 1;
+ #endif
+ }
}
}