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-events.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'spaghetti-monster/fsm-events.c') diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c index 3279c14..ffa93d1 100644 --- a/spaghetti-monster/fsm-events.c +++ b/spaghetti-monster/fsm-events.c @@ -1,24 +1,8 @@ -/* - * fsm-events.c: Event-handling functions 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_EVENTS_C -#define FSM_EVENTS_C +// fsm-events.c: Event-handling functions for SpaghettiMonster. +// Copyright (C) 2017-2023 Selene ToyKeeper +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once #include @@ -212,4 +196,3 @@ uint8_t nice_delay_s() { } */ -#endif -- cgit v1.2.3 From bcaf2686d9f0570dfbc508ddcac95ee55d501f48 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 29 Oct 2023 13:05:38 -0600 Subject: converted noctigon-dm11-boost to use PWM+DSM, and recalibrated timing for delays + smooth steps Anduril has gradually gotten faster over the years, apparently, so it needed longer delays to get accurate-ish timing for beacon and other modes. Adding DSM also changes the timing perceptibly, so I made it possible to calibrate the delay fudge factor on a per-build basis. --- spaghetti-monster/fsm-events.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spaghetti-monster/fsm-events.c') diff --git a/spaghetti-monster/fsm-events.c b/spaghetti-monster/fsm-events.c index ffa93d1..6987ae2 100644 --- a/spaghetti-monster/fsm-events.c +++ b/spaghetti-monster/fsm-events.c @@ -127,7 +127,7 @@ uint8_t nice_delay_ms(uint16_t ms) { uint8_t level = actual_level; // volatile, avoid repeat access if (level < QUARTERSPEED_LEVEL) { clock_prescale_set(clock_div_4); - _delay_loop_2(BOGOMIPS*90/100/4); + _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100/4); } //else if (level < HALFSPEED_LEVEL) { // clock_prescale_set(clock_div_2); @@ -135,7 +135,7 @@ uint8_t nice_delay_ms(uint16_t ms) { //} else { clock_prescale_set(clock_div_1); - _delay_loop_2(BOGOMIPS*90/100); + _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100); } // restore regular clock speed clock_prescale_set(clock_div_1); @@ -143,13 +143,13 @@ uint8_t nice_delay_ms(uint16_t ms) { // underclock MCU to save power clock_prescale_set(clock_div_4); // wait - _delay_loop_2(BOGOMIPS*90/100/4); + _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100/4); // restore regular clock speed clock_prescale_set(clock_div_1); #endif // ifdef USE_RAMPING #else // wait - _delay_loop_2(BOGOMIPS*90/100); + _delay_loop_2(BOGOMIPS*DELAY_FACTOR/100); #endif // ifdef USE_DYNAMIC_UNDERCLOCKING // run pending system processes while we wait -- cgit v1.2.3