From 909038c4d245213aad290c2223f17ddaecaf1914 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Wed, 22 Jul 2020 15:38:50 -0600 Subject: renamed cfg-default.h to config-default.h, cleaned up some comments, organized definitions --- spaghetti-monster/anduril/anduril.c | 15 ++-- spaghetti-monster/anduril/cfg-default.h | 108 ------------------------- spaghetti-monster/anduril/config-default.h | 123 +++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+), 113 deletions(-) delete mode 100644 spaghetti-monster/anduril/cfg-default.h create mode 100644 spaghetti-monster/anduril/config-default.h diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c index 23f14d5..e568b5e 100644 --- a/spaghetti-monster/anduril/anduril.c +++ b/spaghetti-monster/anduril/anduril.c @@ -38,15 +38,19 @@ // - Library-level configuration headers // - Library code (FSM itself) // - App headers -// - App code (all of it) +// - App code (all of it, inline) // // Don't do this in regular programs. It's weird and kind of gross. -// But in this case it gives us a bunch of much-needed space, so... +// But in this case it gives us a bunch of much-needed space, so... woot. +// +// Also, there are a ton of compile-time flags because it needs to build +// a bunch of different versions and each one needs to be trimmed as small +// as possible. These are mostly "USE" flags. /********* User-configurable options *********/ -#include "cfg-default.h" +#include "config-default.h" -/***** specific settings for known driver types *****/ +/********* specific settings for known driver types *********/ // Anduril config file name (set it here or define it at the gcc command line) //#define CONFIGFILE cfg-blf-q8.h @@ -56,7 +60,7 @@ /********* Include headers which need to be before FSM *********/ -// enable FSM features needed by strobe modes +// enable FSM features needed by basic ramping functions #include "ramping-fsm.h" #ifdef USE_FACTORY_RESET @@ -72,6 +76,7 @@ // figure out how many bytes of eeprom are needed, // based on which UI features are enabled +// (include this one last) #include "load-save-config-fsm.h" diff --git a/spaghetti-monster/anduril/cfg-default.h b/spaghetti-monster/anduril/cfg-default.h deleted file mode 100644 index ee76c6e..0000000 --- a/spaghetti-monster/anduril/cfg-default.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * cfg-default.h: Default configuration 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 CFG_DEFAULT_H -#define CFG_DEFAULT_H - -/********* User-configurable options *********/ -#define USE_LVP - -// parameters for this defined below or per-driver -#define USE_THERMAL_REGULATION -#define DEFAULT_THERM_CEIL 45 // try not to get hotter than this - -#define USE_FACTORY_RESET -//#define USE_SOFT_FACTORY_RESET // only needed on models which can't use hold-button-at-boot - -// dual-switch support (second switch is a tail clicky) -// (currently incompatible with factory reset) -//#define START_AT_MEMORIZED_LEVEL - -// include a function to blink out the firmware version -#define USE_VERSION_CHECK - -// short blip when crossing from "click" to "hold" from off -// (helps the user hit moon mode exactly, instead of holding too long -// or too short) -#define MOON_TIMING_HINT // only applies if B_TIMING_ON == B_PRESS_T -// short blips while ramping -#define BLINK_AT_RAMP_MIDDLE -//#define BLINK_AT_RAMP_FLOOR -#define BLINK_AT_RAMP_CEIL -//#define BLINK_AT_STEPS // whenever a discrete ramp mode is passed in smooth mode - -// ramp down via regular button hold if a ramp-up ended <1s ago -// ("hold, release, hold" ramps down instead of up) -#define USE_REVERSING - -// add a runtime option to switch between automatic memory (default) -// and manual memory (only available if compiled in) -// (manual memory makes 1-click-from-off start at the same level each time) -// (the level can be set explicitly with 5 clicks from on, -// or the user can go back to automatic with click-click-click-click-hold) -#define USE_MANUAL_MEMORY - -// enable the battery check mode (shows remaining charge) -#define USE_BATTCHECK_MODE -// battery readout style (pick one) -#define BATTCHECK_VpT -//#define BATTCHECK_8bars // FIXME: breaks build -//#define BATTCHECK_4bars // FIXME: breaks build - -// enable a mode for locking the light for safe carry -#define USE_LOCKOUT_MODE - -// enable/disable various strobe modes -#define USE_BIKE_FLASHER_MODE -#define USE_PARTY_STROBE_MODE -#define USE_TACTICAL_STROBE_MODE -#define USE_LIGHTNING_MODE -#define USE_CANDLE_MODE - -// enable sunset (goodnight) mode -#define USE_GOODNIGHT_MODE -#define GOODNIGHT_TIME 60 // minutes (approximately) -#define GOODNIGHT_LEVEL 24 // ~11 lm - -// enable beacon mode -#define USE_BEACON_MODE - -// enable momentary mode -#define USE_MOMENTARY_MODE - -// Include a simplified UI for non-enthusiasts? -#define USE_SIMPLE_UI - -// make the ramps configurable by the user -#define USE_RAMP_CONFIG - -// boring strobes nobody really likes, but sometimes flashlight companies want -// (these replace the fun strobe group, -// so don't enable them at the same time as any of the above strobes) -//#define USE_POLICE_STROBE_MODE -//#define USE_SOS_MODE -//#define USE_SOS_MODE_IN_FF_GROUP // put SOS in the "boring strobes" mode -//#define USE_SOS_MODE_IN_BLINKY_GROUP // put SOS in the blinkies mode group - -// cut clock speed at very low modes for better efficiency -// (defined here so config files can override it) -#define USE_DYNAMIC_UNDERCLOCKING - - -#endif diff --git a/spaghetti-monster/anduril/config-default.h b/spaghetti-monster/anduril/config-default.h new file mode 100644 index 0000000..3576566 --- /dev/null +++ b/spaghetti-monster/anduril/config-default.h @@ -0,0 +1,123 @@ +/* + * config-default.h: Default configuration 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 CONFIG_DEFAULT_H +#define CONFIG_DEFAULT_H + +/* + * This file specifies the default settings for Anduril. + * + * These settings can be overridden per build target, in cfg-*.h files... + * ... but most are not. So changing one here will make it change in + * almost every build target. + */ + +/********* User-configurable options *********/ +// low voltage protection (also required for battery check mode) +#define USE_LVP + +// overheat protection +#define USE_THERMAL_REGULATION +#define DEFAULT_THERM_CEIL 45 // try not to get hotter than this (in C) + +// factory reset function erases user's runtime configuration in eeprom +#define USE_FACTORY_RESET +//#define USE_SOFT_FACTORY_RESET // only needed on models which can't use hold-button-at-boot + +// dual-switch support (second switch is a tail clicky) +// (currently incompatible with factory reset) +//#define START_AT_MEMORIZED_LEVEL + +// include a function to blink out the firmware version +#define USE_VERSION_CHECK + +// short blip when crossing from "click" to "hold" from off +// (helps the user hit moon mode exactly, instead of holding too long +// or too short) +#define MOON_TIMING_HINT // only applies if B_TIMING_ON == B_PRESS_T +// short blips while ramping +#define BLINK_AT_RAMP_MIDDLE +//#define BLINK_AT_RAMP_FLOOR +#define BLINK_AT_RAMP_CEIL +//#define BLINK_AT_STEPS // whenever a discrete ramp mode is passed in smooth mode + +// ramp down via regular button hold if a ramp-up ended <1s ago +// ("hold, release, hold" ramps down instead of up) +// TODO: remove this setting; nobody ever changes it) +#define USE_REVERSING + +// Include a simplified UI for non-enthusiasts? +#define USE_SIMPLE_UI + +// make the ramps configurable by the user +#define USE_RAMP_CONFIG + +// adds a runtime option to switch between automatic memory (default) +// and manual memory (only available if compiled in) +// (manual memory makes 1-click-from-off start at the same level each time) +// (the level can be set explicitly with 5 clicks from on, +// or the user can go back to automatic with click-click-click-click-hold) +// TODO: remap to a shorter button sequence? +#define USE_MANUAL_MEMORY + +// enable the battery check mode (shows remaining charge) (requires USE_LVP) +#define USE_BATTCHECK_MODE +// battery readout style (pick one) +// TODO: allow VpT and 4-bar simultaneously, +// so one can be in "simple mode" and the other in "advanced mode" +#define BATTCHECK_VpT +//#define BATTCHECK_8bars // FIXME: breaks build +//#define BATTCHECK_4bars // FIXME: breaks build + +// enable beacon mode +#define USE_BEACON_MODE + +// enable sunset (goodnight) mode +// TODO: replace goodnight mode with a sunset timer in the regular ramp +#define USE_GOODNIGHT_MODE +#define GOODNIGHT_TIME 60 // minutes (approximately) +#define GOODNIGHT_LEVEL 24 // ~11 lm + +// enable/disable various strobe modes +#define USE_BIKE_FLASHER_MODE +#define USE_PARTY_STROBE_MODE +#define USE_TACTICAL_STROBE_MODE +#define USE_LIGHTNING_MODE +#define USE_CANDLE_MODE + +// boring strobes nobody really likes, but sometimes flashlight companies want +// (these replace the fun strobe group, +// so don't enable them at the same time as any of the above strobes) +//#define USE_POLICE_STROBE_MODE +//#define USE_SOS_MODE +//#define USE_SOS_MODE_IN_FF_GROUP // put SOS in the "boring strobes" mode +//#define USE_SOS_MODE_IN_BLINKY_GROUP // put SOS in the blinkies mode group + +// enable a mode for locking the light for safe carry +#define USE_LOCKOUT_MODE + +// enable momentary mode +#define USE_MOMENTARY_MODE + +// cut clock speed at very low modes for better efficiency +// (defined here so config files can override it) +#define USE_DYNAMIC_UNDERCLOCKING + + +#endif -- cgit v1.2.3