From 55541be4a505da3df7d1a2b8bf3b5295b0af58f7 Mon Sep 17 00:00:00 2001
From: Selene ToyKeeper
Date: Thu, 13 Apr 2023 20:38:25 -0600
Subject: refactor progress checkpoint ... got Sofirn LT1S Pro and Emisar D4v2
working with the new channel mode system ... but there's a lot more left to
do
---
spaghetti-monster/fsm-main.c | 1 +
1 file changed, 1 insertion(+)
(limited to 'spaghetti-monster/fsm-main.c')
diff --git a/spaghetti-monster/fsm-main.c b/spaghetti-monster/fsm-main.c
index 30b8a67..fca1e83 100644
--- a/spaghetti-monster/fsm-main.c
+++ b/spaghetti-monster/fsm-main.c
@@ -39,6 +39,7 @@ ISR(TIMER1_COMPA_vect) {
}
#endif
+// FIXME: hw_setup() shouldn't be here ... move it entirely to hwdef files
#if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85)
static inline void hw_setup() {
// configure PWM channels
--
cgit v1.2.3
From 583854e37efde7f461e073e735a1736b02d28c70 Mon Sep 17 00:00:00 2001
From: Selene ToyKeeper
Date: Mon, 17 Apr 2023 00:08:32 -0600
Subject: switched the rest of FSM + Anduril to use SPDX license headers
instead of full GPL headers (or all too often, nothing at all)
There are a few "FIXME" entries where I'm not sure about the correct copyright.
---
spaghetti-monster/fsm-main.c | 27 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
(limited to 'spaghetti-monster/fsm-main.c')
diff --git a/spaghetti-monster/fsm-main.c b/spaghetti-monster/fsm-main.c
index fca1e83..4116d3f 100644
--- a/spaghetti-monster/fsm-main.c
+++ b/spaghetti-monster/fsm-main.c
@@ -1,24 +1,8 @@
-/*
- * fsm-main.c: main() function for SpaghettiMonster.
- *
- * 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 FSM_MAIN_C
-#define FSM_MAIN_C
+// fsm-main.c: main() function for SpaghettiMonster.
+// Copyright (C) 2017-2023 Selene ToyKeeper
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#pragma once
#include "fsm-main.h"
@@ -221,4 +205,3 @@ void handle_deferred_interrupts() {
}
}
-#endif
--
cgit v1.2.3
From 6c7c99b1be9a684e3a6ccc533f46979b39f7a529 Mon Sep 17 00:00:00 2001
From: Selene ToyKeeper
Date: Tue, 18 Jul 2023 14:44:40 -0600
Subject: converted Emisar D4 and BLF Q8 to multi-channel, and enabled
previously-removed tactical mode on the Q8 since there seems to be enough
space now (also lowercased their hwdef files)
---
spaghetti-monster/fsm-main.c | 88 +++++++++++++++++++++++---------------------
1 file changed, 46 insertions(+), 42 deletions(-)
(limited to 'spaghetti-monster/fsm-main.c')
diff --git a/spaghetti-monster/fsm-main.c b/spaghetti-monster/fsm-main.c
index 4116d3f..066188c 100644
--- a/spaghetti-monster/fsm-main.c
+++ b/spaghetti-monster/fsm-main.c
@@ -26,48 +26,52 @@ ISR(TIMER1_COMPA_vect) {
// FIXME: hw_setup() shouldn't be here ... move it entirely to hwdef files
#if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85)
static inline void hw_setup() {
- // configure PWM channels
- #if PWM_CHANNELS >= 1
- DDRB |= (1 << PWM1_PIN);
- TCCR0B = 0x01; // pre-scaler for timer (1 => 1, 2 => 8, 3 => 64...)
- TCCR0A = PHASE;
- #if (PWM1_PIN == PB4) // Second PWM counter is ... weird
- TCCR1 = _BV (CS10);
- GTCCR = _BV (COM1B1) | _BV (PWM1B);
- OCR1C = 255; // Set ceiling value to maximum
- #endif
- #endif
- // tint ramping needs second channel enabled,
- // despite PWM_CHANNELS being only 1
- #if (PWM_CHANNELS >= 2) || defined(USE_TINT_RAMPING)
- DDRB |= (1 << PWM2_PIN);
- #if (PWM2_PIN == PB4) // Second PWM counter is ... weird
- TCCR1 = _BV (CS10);
- GTCCR = _BV (COM1B1) | _BV (PWM1B);
- OCR1C = 255; // Set ceiling value to maximum
- #endif
- #endif
- #if PWM_CHANNELS >= 3
- DDRB |= (1 << PWM3_PIN);
- #if (PWM3_PIN == PB4) // Second PWM counter is ... weird
- TCCR1 = _BV (CS10);
- GTCCR = _BV (COM1B1) | _BV (PWM1B);
- OCR1C = 255; // Set ceiling value to maximum
- #endif
- #endif
- #if PWM_CHANNELS >= 4
- // 4th PWM channel is ... not actually supported in hardware :(
- DDRB |= (1 << PWM4_PIN);
- //OCR1C = 255; // Set ceiling value to maximum
- TCCR1 = 1<= 1
+ DDRB |= (1 << PWM1_PIN);
+ TCCR0B = 0x01; // pre-scaler for timer (1 => 1, 2 => 8, 3 => 64...)
+ TCCR0A = PHASE;
+ #if (PWM1_PIN == PB4) // Second PWM counter is ... weird
+ TCCR1 = _BV (CS10);
+ GTCCR = _BV (COM1B1) | _BV (PWM1B);
+ OCR1C = 255; // Set ceiling value to maximum
+ #endif
+ #endif
+ // tint ramping needs second channel enabled,
+ // despite PWM_CHANNELS being only 1
+ #if (PWM_CHANNELS >= 2) || defined(USE_TINT_RAMPING)
+ DDRB |= (1 << PWM2_PIN);
+ #if (PWM2_PIN == PB4) // Second PWM counter is ... weird
+ TCCR1 = _BV (CS10);
+ GTCCR = _BV (COM1B1) | _BV (PWM1B);
+ OCR1C = 255; // Set ceiling value to maximum
+ #endif
+ #endif
+ #if PWM_CHANNELS >= 3
+ DDRB |= (1 << PWM3_PIN);
+ #if (PWM3_PIN == PB4) // Second PWM counter is ... weird
+ TCCR1 = _BV (CS10);
+ GTCCR = _BV (COM1B1) | _BV (PWM1B);
+ OCR1C = 255; // Set ceiling value to maximum
+ #endif
+ #endif
+ #if PWM_CHANNELS >= 4
+ // 4th PWM channel is ... not actually supported in hardware :(
+ DDRB |= (1 << PWM4_PIN);
+ //OCR1C = 255; // Set ceiling value to maximum
+ TCCR1 = 1<