Is this the “default” for a saber ? I am not seeing/finding an equivalent for a blaster.
Papples!
This won’t work because of papples.
EFFECT_BLAST and SaberBase::LOCKUP_AUTOFIRE are two completely different types of numbers, and mixing them up is like mixing Apples and Pears, which makes papples. ![]()
You can’t put SaberBase::LOCKUP_AUTOFIRE in the same switch() statement as EFFECT_FIRE and EFFECT_STUN. Even if that compiles, (which it shouldn’t) the result will not work as you would like.
Yes, this is the default.
What we need to do is to make this function virtual, and then override it in BladeterDisplayController, something like this:
void ShowDefault(bool ignore_lockup = false) override {
if (SaberBase::IsOn() &&
SaberBase::LockUp() == SaberBase::LOCKUP_AUTOFIRE &&
img_.IMG_auto &&
!ignore_lockup) {
SetFile(&img_.IMG_auto, 3600000.0);
return;
}
StandardDisplayController<Width, col_t, PREFIX>::ShowDefault(ignore_lockup);
}
We don’t actually need to add any calls to this function, because StandarDisplayController already handles that when EFFECT_LOCKUP_BEGIN and EFFECT_LOCKUP_END occurs.
That is too bad, I love a good sour apples and sweet juicy pears pie. ![]()
But joke aside, I think I understand what I need to do. Thanks @profezzorn
@orntar, I’ll do the code changes this afternoon/evening (EU time), will you be able to test them for me ? I’ll PM you the changed files once they are ready.
@profezzorn, do I need to change anything in layer_controller.h ? I did find lots of tabs and a few other minor rogue spaces in it. Clean-up PR submitted.
I have added your code to
template<int Width, class col_t, typename PREFIX = ByteArray<>>
class BlasterDisplayController : public StandardDisplayController<Width, col_t, PREFIX> {
public:
I also added virtual to void ShowDefault in ssd1306.h
Do we also want to add display “auto” on color screens ? IMHO, we may as well.
In which case, I need to add virtual to void ShowDefault in layer_controller.h
and add this code:
void ShowDefault(bool ignore_lockup = false) override {
if (SaberBase::IsOn() &&
SaberBase::LockUp() == SaberBase::LOCKUP_AUTOFIRE &&
SCR_auto &&
!ignore_lockup) {
SetFile(&SCR_auto, 3600000.0);
return;
}
StandardColorDisplayController<W, H, PREFIX>::ShowDefault(ignore_lockup);
}
to
template<int W, int H, typename PREFIX = ConcatByteArrays<typename NumberToByteArray<W>::type, ByteArray<'x'>, typename NumberToByteArray<H>::type>>
class BlasterColorDisplayController : public StandarColorDisplayController<W, H, PREFIX> {
public:
Is this correct ? And did I get the “spelling” correct ?
Edit: do I need to add X(auto) in #define ONCE_PER_BLASTER_EFFECT(X) ?
Hey @profezzorn,
Both @orntar and I are trying to solve the “auto.bmp” conundrum.
This is the config we are using:
E11_oled.h (2.7 KB)
This is the blaster.h I came up (based on latest Github master) with the help of your code above:
blaster.h (21.4 KB)
We are both getting this error:
In file included from ProffieOS\config\E11_oled.h:26,
from ProffieOS\ProffieOS.ino:1725:
ProffieOS\props\blaster.h: In member function 'void BlasterDisplayController<Width, col_t, PREFIX>::ShowDefault(bool)':
ProffieOS\props\blaster.h:591:20: error: 'LockUp' is not a member of 'SaberBase'
591 | SaberBase::LockUp() == SaberBase::LOCKUP_AUTOFIRE &&
| ^~~~~~
ProffieOS\props\blaster.h: In member function 'void BlasterColorDisplayController<W, H, PREFIX>::ShowDefault(bool)':
ProffieOS\props\blaster.h:651:20: error: 'LockUp' is not a member of 'SaberBase'
651 | SaberBase::LockUp() == SaberBase::LOCKUP_AUTOFIRE &&
| ^~~~~~
ProffieOS\props\blaster.h:654:7: error: there are no arguments to 'SetFile' that depend on a template parameter, so a declaration of 'SetFile' must be available [-fpermissive]
654 | SetFile(&SCR_auto, 3600000.0);
| ^~~~~~~
ProffieOS\props\blaster.h:654:7: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
ProffieOS\props\blaster.h:657:5: error: 'StandardColorDisplayController' was not declared in this scope; did you mean 'StandarColorDisplayController'?
657 | StandardColorDisplayController<W, H, PREFIX>::ShowDefault(ignore_lockup);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| StandarColorDisplayController
ProffieOS\props\blaster.h:657:48: error: expected primary-expression before '>' token
657 | StandardColorDisplayController<W, H, PREFIX>::ShowDefault(ignore_lockup);
| ^
ProffieOS\props\blaster.h:657:51: error: '::ShowDefault' has not been declared
657 | StandardColorDisplayController<W, H, PREFIX>::ShowDefault(ignore_lockup);
| ^~~~~~~~~~~
ProffieOS\props\blaster.h: In instantiation of 'void BlasterDisplayController<Width, col_t, PREFIX>::ShowDefault(bool) [with int Width = 64; col_t = long unsigned int; PREFIX = ByteArray<>]':
ProffieOS\props\blaster.h:589:8: required from here
589 | void ShowDefault(bool ignore_lockup = false) override {
| ^~~~~~~~~~~
ProffieOS\props\blaster.h:594:14: error: 'SetFile' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
594 | SetFile(&img_.IMG_auto, 3600000.0);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ProffieOS\props\blaster.h:594:14: note: declarations in dependent base 'StandardDisplayController<64, long unsigned int, ByteArray<> >' are not found by unqualified lookup
ProffieOS\props\blaster.h:594:14: note: use 'this->SetFile' instead
exit status 1
Compilation error: 'LockUp' is not a member of 'SaberBase'
Any idea ? Thanks
Yes
BlasterColorDisplayController doesn’t have a SetFile function. use scr_,Play(&SCR_auto); instead.
Ops, I guess it’s just SaberBase::Lockup() (no capitalized U)
Wow, I don’t know how long I starred at that and couldn’t see the capital U!
Almost but not quite, I think it should be scr_.Play(&SCR_auto); with a “.” instead of “,”
It compiles with less errors, but there were still some:
I found another “typo”, maybe ? Well at least, I mixed them up (adding a “d” where there shouldn’t be):
- ssd1306.h uses StandardDisplayController (with a “d” at the end of Standard)
- layer_controller.h uses StandarColorDisplayController (without a “d” at the end of Standar)
Do I add the “d” in layer_controller.h (and everywhere that has it) for harmonization, or not ? Could it “break” somebody’s already established config ? And the instructions in the POD about ColorDisplays would need to be changed to reflect the added “d”.
I will omit it for now and stick to StandarColorDisplayController for all ColorDisplays and StandardDisplayController for all “regular” displays. But I can change in POS if you want ? It only appears in 3 files:
I also had to add this-> to scr_.Play(&SCR_auto); and SetFile(&img_.IMG_auto, 3600000.0);
Now it compiles, “HUZA”!
I’ll send a copy to @orntar for testing and upon confirmation, I’ll submit the PR.
yes
layer_controller.h is in OS8.x, which is still in beta, so breaking configuration compatibility is allowed.
I already prepared the PR for adding “auto.bmp” to blaster.h but waiting on @orntar to confirm it’s working before submitting.
May I add the "d"s in the same PR since at least one will need to be added in blaster.h or do you prefer a separate one ?
Either will work.
Generally smaller, separate PRs are better, but this is small enough that it doesn’t really matter either way.
Cool thanks. I’ll get working on it right away.
@orntar, please hold on the testing of my previous blaster.h so you only need to test it once.
PR for “auto” on OLED & color OLED submitted.
I also fixed the missing "d"s and a few other things like tabs, typo, extra spaces, extra empty lines, …
Circling back to this now the other items have settled…
Do you mean config.ini? I could find no references to font.ini.
I created a config.ini and placed it in the font directory, and it doesn’t change the displayed image duration. Here it is
# Blaster config.ini
# The volume of all effect sounds. Can be 0-16, where 0 is muted.
# Default 16
volEff=16
# For OLED displays. This specifies the frame rate of animations.
# If not specified (or set to zero) the frame rate will be 24 frames
# per second for non-looped animations. For looped animations, the
# frame rate will be set so that the loop takes one second.
ProffieOSAnimationFrameRate=0.0
# For OLED displays, the time a style's "message",
# static BMP, or loop animation will play when changing presets.
ProffieOSFontImageDuration=5000.0
# For OLED displays, the time an on.bmp will play
ProffieOSOnImageDuration=5000.0
# For OLED displays, the time a blst.bmp will play
ProffieOSBlastImageDuration=1000.0
# For OLED displays, the time a clsh.bmp will play
ProffieOSClashImageDuration=500.0
# For OLED displays, the time a force.bmp will play
ProffieOSForceImageDuration=1000.0
# For OLED displays, the time a stun.bmp will play
ProffieOSStunImageDuration=1000.0
# For OLED displays, the time a blast.bmp will play
ProffieOSFireImageDuration=500.0
# For OLED displays, the time a reload.bmp will play
ProffieOSReloadImageDuration=1000.0
# For OLED displays, the time a empty.bmp will play
ProffieOSEmptyImageDuration=1000.0
# For OLED displays, the time a jam.bmp will play
ProffieOSJamImageDuration=1000.0
# For OLED displays, the time a clipin.bmp will play
ProffieOSClipinImageDuration=1000.0
# For OLED displays, the time a clipout.bmp will play
ProffieOSClipoutImageDuration=1000.0
# For OLED displays, the time a Destruct.bmp will play
ProffieOSDestructImageDuration=10000.0
Does this look correct? I will try out font.ini and see if that does anything.
I did also see your comment about changing the duration in the blaster prop, but it seems more flexible if there is a way outside of the os.
My mistake, it is working as intended.
I just didn’t make the time small enough. I set blast and stun to 100.0 and it just flashes which is what I wanted.
btw, It is “config.ini”, font,.ini didn’t do anything.