From 2dec055dc5303ec8f66b4adbac366454c2147920 Mon Sep 17 00:00:00 2001
From: Selene ToyKeeper
Date: Wed, 22 Jul 2020 15:43:53 -0600
Subject: renamed beacon.* -> beacon-mode.*
---
spaghetti-monster/anduril/anduril.c | 4 +-
spaghetti-monster/anduril/beacon-mode.c | 72 +++++++++++++++++++++++++++++++++
spaghetti-monster/anduril/beacon-mode.h | 31 ++++++++++++++
spaghetti-monster/anduril/beacon.c | 72 ---------------------------------
spaghetti-monster/anduril/beacon.h | 31 --------------
5 files changed, 105 insertions(+), 105 deletions(-)
create mode 100644 spaghetti-monster/anduril/beacon-mode.c
create mode 100644 spaghetti-monster/anduril/beacon-mode.h
delete mode 100644 spaghetti-monster/anduril/beacon.c
delete mode 100644 spaghetti-monster/anduril/beacon.h
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index e568b5e..11bfa4a 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -107,7 +107,7 @@
#endif
#ifdef USE_BEACON_MODE
-#include "beacon.h"
+#include "beacon-mode.h"
#endif
#ifdef USE_THERMAL_REGULATION
@@ -223,7 +223,7 @@ uint8_t rgb_led_lockout_mode = RGB_LED_LOCKOUT_DEFAULT;
#endif
#ifdef USE_BEACON_MODE
-#include "beacon.c"
+#include "beacon-mode.c"
#endif
#ifdef USE_THERMAL_REGULATION
diff --git a/spaghetti-monster/anduril/beacon-mode.c b/spaghetti-monster/anduril/beacon-mode.c
new file mode 100644
index 0000000..28ff0bd
--- /dev/null
+++ b/spaghetti-monster/anduril/beacon-mode.c
@@ -0,0 +1,72 @@
+/*
+ * beacon-mode.c: Beacon mode for Anduril.
+ *
+ * Copyright (C) 2017 Selene ToyKeeper
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef BEACON_MODE_C
+#define BEACON_MODE_C
+
+#include "beacon-mode.h"
+
+inline void beacon_mode_iter() {
+ // one iteration of main loop()
+ if (! button_last_state) {
+ set_level(memorized_level);
+ nice_delay_ms(100);
+ set_level(0);
+ nice_delay_ms(((beacon_seconds) * 1000) - 100);
+ }
+}
+
+uint8_t beacon_state(Event event, uint16_t arg) {
+ // 1 click: off
+ if (event == EV_1click) {
+ set_state(off_state, 0);
+ return MISCHIEF_MANAGED;
+ }
+ // TODO: use sleep ticks to measure time between pulses,
+ // to save power
+ // 2 clicks: next mode
+ else if (event == EV_2clicks) {
+ #ifdef USE_SOS_MODE_IN_BLINKY_GROUP
+ set_state(sos_state, 0);
+ #elif defined(USE_THERMAL_REGULATION)
+ set_state(tempcheck_state, 0);
+ #elif defined(USE_BATTCHECK)
+ set_state(battcheck_state, 0);
+ #endif
+ return MISCHIEF_MANAGED;
+ }
+ // hold: configure beacon timing
+ else if (event == EV_click1_hold) {
+ if (0 == (arg % TICKS_PER_SECOND)) {
+ blink_confirm(1);
+ }
+ return MISCHIEF_MANAGED;
+ }
+ // release hold: save new timing
+ else if (event == EV_click1_hold_release) {
+ beacon_seconds = 1 + (arg / TICKS_PER_SECOND);
+ save_config();
+ return MISCHIEF_MANAGED;
+ }
+ return EVENT_NOT_HANDLED;
+}
+
+
+#endif
+
diff --git a/spaghetti-monster/anduril/beacon-mode.h b/spaghetti-monster/anduril/beacon-mode.h
new file mode 100644
index 0000000..752918e
--- /dev/null
+++ b/spaghetti-monster/anduril/beacon-mode.h
@@ -0,0 +1,31 @@
+/*
+ * beacon-mode.h: Beacon mode for Anduril.
+ *
+ * Copyright (C) 2017 Selene ToyKeeper
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef BEACON_MODE_H
+#define BEACON_MODE_H
+
+// beacon timing
+uint8_t beacon_seconds = 2;
+
+// beacon mode
+uint8_t beacon_state(Event event, uint16_t arg);
+inline void beacon_mode_iter();
+
+
+#endif
diff --git a/spaghetti-monster/anduril/beacon.c b/spaghetti-monster/anduril/beacon.c
deleted file mode 100644
index ac56632..0000000
--- a/spaghetti-monster/anduril/beacon.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * beacon.c: Beacon mode for Anduril.
- *
- * Copyright (C) 2017 Selene ToyKeeper
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef BEACON_C
-#define BEACON_C
-
-#include "beacon.h"
-
-inline void beacon_mode_iter() {
- // one iteration of main loop()
- if (! button_last_state) {
- set_level(memorized_level);
- nice_delay_ms(100);
- set_level(0);
- nice_delay_ms(((beacon_seconds) * 1000) - 100);
- }
-}
-
-uint8_t beacon_state(Event event, uint16_t arg) {
- // 1 click: off
- if (event == EV_1click) {
- set_state(off_state, 0);
- return MISCHIEF_MANAGED;
- }
- // TODO: use sleep ticks to measure time between pulses,
- // to save power
- // 2 clicks: next mode
- else if (event == EV_2clicks) {
- #ifdef USE_SOS_MODE_IN_BLINKY_GROUP
- set_state(sos_state, 0);
- #elif defined(USE_THERMAL_REGULATION)
- set_state(tempcheck_state, 0);
- #elif defined(USE_BATTCHECK)
- set_state(battcheck_state, 0);
- #endif
- return MISCHIEF_MANAGED;
- }
- // hold: configure beacon timing
- else if (event == EV_click1_hold) {
- if (0 == (arg % TICKS_PER_SECOND)) {
- blink_confirm(1);
- }
- return MISCHIEF_MANAGED;
- }
- // release hold: save new timing
- else if (event == EV_click1_hold_release) {
- beacon_seconds = 1 + (arg / TICKS_PER_SECOND);
- save_config();
- return MISCHIEF_MANAGED;
- }
- return EVENT_NOT_HANDLED;
-}
-
-
-#endif
-
diff --git a/spaghetti-monster/anduril/beacon.h b/spaghetti-monster/anduril/beacon.h
deleted file mode 100644
index ba885c7..0000000
--- a/spaghetti-monster/anduril/beacon.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * beacon.h: Beacon mode for Anduril.
- *
- * Copyright (C) 2017 Selene ToyKeeper
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#ifndef BEACON_H
-#define BEACON_H
-
-// beacon timing
-volatile uint8_t beacon_seconds = 2;
-
-// beacon mode
-uint8_t beacon_state(Event event, uint16_t arg);
-inline void beacon_mode_iter();
-
-
-#endif
--
cgit v1.2.3