I’ve solved my compiling issues, so I will use this thread to present the prop.
My objective is to replace blaster.h
. As such, I’m not adding any bells and whistles like menus, edition nor anything of that. But I want to give a reasonable level of customizability without having to touch the code, and take advantage of everything we have defined already. First, I will talk about what is my view for the user:
Functionality:
-------------------------------------------------------------------------------
* PROP DEFINES *
Optional #defines that customize the blaster's behavior.
-------------------------------------------------------------------------------
Optional defines:
#define ENABLE_BLASTER_AUTO - DEPRECATED. Enable Autofire/rapid fire mode.
#define BLASTER_ENABLE_AUTO - Enable Autofire/rapid fire mode.
#define BLASTER_ENABLE_AUTO_ON_HOLD - Enable Autofire/rapid fire mode when holding the FIRE button. Implicit BLASTER_ENABLE_AUTO.
#define BLASTER_DEFAULT_MODE - Sets the mode at startup MODE_STUN|MODE_KILL|MODE_AUTO.
#define BLASTER_DEFAULT_POWERON - Sets the state at startup as ON.
#define BLASTER_DEFAULT_POWEROFF - Sets the state at startup as OFF.
#define BLASTER_RANGE_LEVELS - Sets the steps of Range/Power levels, also used to define PLI steps. Should be 1 to 64. Defaults to 6.
#define BLASTER_RANGE_LEVELS_BY_FONT - Sets the steps of Range/Power levels according to each fonts number of rangexx.wavs.
#define BLASTER_SHOTS_UNTIL_EMPTY 15 - Whatever number, not defined = unlimited shots.
#define BLASTER_AUTO_LIMITED_ROUNDS - When enabled, AUTO mode respects the round limit set by BLASTER_SHOTS_UNTIL_EMPTY.
#define BLASTER_JAM_PERCENTAGE - If this is not defined, random from 0-100%.
#define BLASTER_SINGLE_POWER_BUTTON - Only Power Button will turn on/off the blaster.
#define BLASTER_SINGLE_RELOAD_BUTTON - Only Reload Button will reload the blaster.
#define BLASTER_RELOAD_THROUGH_CLIP - Only Clip Out then Clip In will reload the blaster.
#define BLASTER_CLIP_OUT_BLOCK - Clip Out will block blaster even without BLASTER_SHOTS_UNTIL_EMPTY.
-------------------------------------------------------------------------------
* PROP BUTTONS *
This prop manages up to six different buttons.
-------------------------------------------------------------------------------
*Single Button Mode*
-Buttons: FIRE
This case quite limited since you can only fire and reload. Weapon will always
be on the default mode (STUN is the defined in the prop, if you wish another
you will have to define BLASTER_DEFAULT_MODE). Blaster can be turned on or off.
And can be reloaded, which takes precedence over turning it on/off.
Default Mode: Fire or Stun
Fire - Click FIRE.
Power On / Off - Hold FIRE.
Reload - Hold FIRE until Reloaded. Takes priority over power on/off.
Unjam - Bang the blaster.
Default Mode: Auto *This mode is not compatible with clip capacity and really needs
an on/off switch on the power line.
Fire (Semi) - Click FIRE.
Fire (Auto) - Hold FIRE.
Power On - Hold FIRE. You can't power off.
Unjam - Bang the blaster.
*Dual Buttons Mode*
-Buttons: FIRE and MODE
This is the "stock" configuration.
-Weapon will always start on the default mode (define with BLASTER_DEFAULT_MODE,
STUN is default).
Default is to powered on if it finds poweron.wav file present or off otherwise.
Use BLASTER_DEFAULT_POWERON or BLASTER_DEFAULT_POWEROFF to define a different
default.
Fire - Click FIRE.
Cycle Modes - Click MODE.
Next Preset - Long click and release MODE.
Previous Preset - Double click and hold MODE, release after a second.
Reload - Hold MODE until Reloaded.
Start/Stop Track - Double click MODE.
Unjam - Bang the blaster.
*Extra Buttons*
-Button: POWER
Power On / Off - Click POWER.
-Button: RELOAD
You can make this the only button to reload by defining BLASTER_SINGLE_RELOAD_BUTTON.
Reload - Hold RELOAD until Reloaded.
-Button: CLIP
You can make that shooting will be blocked when the clip is out by defining
define BLASTER_CLIP_OUT_BLOCK.
You can make that you only reload through the clip by defining
BLASTER_RELOAD_THROUGH_CLIP (takes precedence over BLASTER_SINGLE_RELOAD_BUTTON).
Clip In - Latch CLIP
Clip Out - Unlatch CLIP
-Button: RANGE
You have to define the number of levels by
Increase Range - Click RANGE.
Decrease Range - Long click RANGE.
Also, I want actually use the PLI. So I’m proposing that when I increase range, the PLI will increase, and when I decrease it, it will decrease. If we define some effects that can be seen from the styles, a simple WS2812 can do as PLI. Optionally it could be done on the OLED. But that might go for the future.
DONE:
- Define initial power state.
- Define initial blaster mode.
- Consolidate all defines as
BLASTER_XX
defines. - Single Button semi-auto mode.
- Single Button auto mode.
- Allowing for a single Power and Reload buttons.
- Option for Clip out to block all firing modes.
- Option for Clip in to reload.
- Option for reload only through Clip Out/In.
- Initial range support.
- Setting range notification fall back options.
- Adding the option of letting the amount of
rangeXX.wavs
determine the range levels. - Adding the option of differentiated sounds for STUN
reload
,clipin
andclipout
. (NoSloppy had solved it, thanks NoSloppy!)
TODO list:
- Actually making use of the
full.wav
sound and effect. - Enabling that Autofire respects the clip limitation. (NoSloppy had solved it)
- Enable Auto fire from blaster by holding the FIRE button.
- Allow for Range to change firing volume/speed.
- Allow for Range on hold and multishot.
- Enable Save preset.
- Enable Save state.
- Adding a simple function so a Style can act as the PLI.
- Clean Up OLED support.
- Allow OLED to work as PLI.
- Dividing everything in pieces so it can be merged back.