@@ -260,6 +260,22 @@ COLOUR CHANGE FUNCTIONS WITH BLADE ON
260260 but makes accidental blasts more likely when double-
261261 clicking POWER for Quotes or Force Effect.
262262
263+ #define SABERSENSE_HOT_SKIP_DOWN 23
264+ #define SABERSENSE_HOT_SKIP_LEVEL 9
265+ Hot Skipping is distinct from Font Skipping in that
266+ it skips directly to a given preset, rather than
267+ skipping forwards or backwards x number of presets.
268+ These defines override the Skip-to-Last/Middle
269+ Preset feature, so system skips to user-defined
270+ preset. Note that Skip-to-First preset is fixed
271+ and not user-definable.
272+
273+ #define SABERSENSE_DISABLE_FONT_SKIPPING
274+ Completely disables all preset skipping, meaning
275+ presets may only be cycled through one at a time.
276+ Suitable for installs with small numbers of fonts
277+ and presets.
278+
263279#define SABERSENSE_BUTTON_CLICKER
264280 Button Clicker to play press/release wav files when
265281 buttons are pressed. Intended for Scavenger hilt
@@ -368,8 +384,13 @@ class SaveArrayStateFile : public ConfigFile {
368384#define BUTTON_HELD_MEDIUM_TIMEOUT 1000
369385#endif
370386
371- #ifndef BUTTON_HELD_LONG_TIMEOUT
372- #define BUTTON_HELD_LONG_TIMEOUT 2000
387+ // Hot Skip values are placeholders only.
388+ #ifndef SABERSENSE_HOT_SKIP_DOWN
389+ #define SABERSENSE_HOT_SKIP_DOWN 0
390+ #endif
391+
392+ #ifndef SABERSENSE_HOT_SKIP_LEVEL
393+ #define SABERSENSE_HOT_SKIP_LEVEL 0
373394#endif
374395
375396EFFECT (dim); // for EFFECT_POWERSAVE
@@ -829,29 +850,44 @@ bool Event2(enum BUTTON button, EVENT event, uint32_t modifiers) override {
829850 return true ;
830851#endif
831852
832- // Skips to first preset (up) or last preset (down)
833- // or middle preset if horizontal:
853+ // Skips to first preset (up), last or user-defined preset (down),
854+ // or middle or user-defined preset ( horizontal [level]) :
834855#if NUM_BUTTONS == 2
835856 case EVENTID (BUTTON_AUX, EVENT_FIRST_HELD_LONG, MODE_OFF):
836857#endif
837- case EVENTID (BUTTON_POWER, EVENT_FIRST_HELD_LONG, MODE_OFF):
838- #define DEGREES_TO_RADIANS (M_PI / 180 )
839- if (fusor.angle1 () > 45 * DEGREES_TO_RADIANS) {
840- // If pointing up
841- SetPreset (0 , true );
842- } else if (fusor.angle1 () < -45 * DEGREES_TO_RADIANS) {
843- // If pointing down
844- SetPreset (-1 , true );
858+ case EVENTID (BUTTON_POWER, EVENT_FIRST_HELD_LONG, MODE_OFF): {
859+ CurrentPreset tmp;
860+ tmp.SetPreset (-1 );
861+ int num_presets = tmp.preset_num + 1 ;
862+
863+ int target_preset;
864+ float angle = fusor.angle1 ();
865+
866+ if (angle > M_PI / 6 ) {
867+ target_preset = 0 ;
868+ } else if (angle < -M_PI / 6 ) {
869+ // Get and check user values. Clamp to last preset if invalid.
870+ int hot_skip_down = (SABERSENSE_HOT_SKIP_DOWN > 0 ) ? (SABERSENSE_HOT_SKIP_DOWN - 1 ) : -1 ;
871+ if (hot_skip_down >= num_presets || hot_skip_down < 0 ) {
872+ hot_skip_down = num_presets - 1 ;
873+ }
874+
875+ target_preset = hot_skip_down;
845876 } else {
846- // If horizontal
847- CurrentPreset tmp;
848- tmp.SetPreset (-1 );
849- SetPreset (tmp.preset_num / 2 , true );
877+ int hot_skip_level = (SABERSENSE_HOT_SKIP_LEVEL > 0 ) ? (SABERSENSE_HOT_SKIP_LEVEL - 1 ) : -1 ;
878+ if (hot_skip_level >= num_presets || hot_skip_level < 0 ) {
879+ hot_skip_level = num_presets / 2 ;
880+ }
881+
882+ target_preset = hot_skip_level;
850883 }
884+
851885#ifdef SAVE_PRESET
852- SaveState (current_preset_. preset_num );
886+ SaveState (target_preset );
853887#endif
854- return true ;
888+ SetPreset (target_preset, true );
889+ break ;
890+ }
855891
856892 // BLADE ID OPTIONS AND ARRAY NAVIGATION
857893 // Blade ID on-demand scanning with BladeID audio idents.
0 commit comments