aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2016-05-15 21:06:23 +0200
committerjaseg <code@jaseg.net>2016-05-15 21:06:23 +0200
commit3b03fda10b1f339b9ff2572c8d1c9e1c4b8f9f98 (patch)
tree5edae783a3f3865b41123c1727bc82786182a45b
parent74cb6d127bbb7602ea22a66e61e510cb902601a8 (diff)
downloadcccb-klingel-3b03fda10b1f339b9ff2572c8d1c9e1c4b8f9f98.tar.gz
cccb-klingel-3b03fda10b1f339b9ff2572c8d1c9e1c4b8f9f98.tar.bz2
cccb-klingel-3b03fda10b1f339b9ff2572c8d1c9e1c4b8f9f98.zip
Timing fixup
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 77fdc77..0247056 100644
--- a/main.c
+++ b/main.c
@@ -5,15 +5,15 @@
#include <avr/interrupt.h>
#include <string.h>
-#define HZ 15625UL
+#define HZ 15625ULL
#define TIMEOUT_SEC 4
-#define MIN_PULSE_WIDTH_MS 50
+#define MIN_PULSE_WIDTH_MS 10
#define RING_DURATION_SEC 20
#define OPEN_DURATION_SEC 3
#define THURSDAY_TIMEOUT_MIN 300UL
-#define PRESSED_MIN_MS 250UL
-#define RELEASED_MIN_MS 250UL
+#define PRESSED_MIN_MS 50UL
+#define RELEASED_MIN_MS 50UL
static uint8_t global_thursday_mode = 0;
static uint16_t global_thursday_timectr_sec = 0;
@@ -175,7 +175,7 @@ int main(void) {
open();
} else if (st == (pidx&1)) {
uint16_t val = TCNT1;
- if (val > HZ/1000*MIN_PULSE_WIDTH_MS) {
+ if (val > HZ*MIN_PULSE_WIDTH_MS/1000ULL) {
pattern[pidx++] = val;
TCNT1 = 0;
if (pidx == sizeof(pattern)/sizeof(pattern[0])-1) {