Blaster OLEDs - how do they work?

I just checked and yes, that line is there, so I think I’m on the right version.

Not sure if there’s something else I needed to do. The steps I took were:

  • Un-comment-out the blaster effect files in ssd1306, around lines 25 and 580;

  • Un-comment-out the blaster effect files in hybrid_font, around lines 35 and 158;

  • Included the following in my config:

#define BLASTER_DEFAULT_MODE MODE_KILL
#define ENABLE_BLASTER_AUTO
#define OLED_USE_BLASTER_IMAGES
#define BLASTER_SHOTS_UNTIL_EMPTY 10
#define BLASTER_JAM_PERCENTAGE 10
#endif

#ifdef CONFIG_PROP
#include "../props/blaster.h"
#endif

I also changed lines 1513 and 1514 in ProffieOS.ino to accommodate my different shaped screen thus:

StandardDisplayController<64, uint32_t> display_controller;
SSD1306Template<64, uint32_t, DISPLAY_POWER_PINS> display(&display_controller);

I did notice that I got a compile error unless I left this line in ssd1306 commented out:

     case EFFECT_DESTRUCT:
       ShowFileWithSoundLength(&IMG_destruct, font_config.ProffieOSDestructImageDuration);
       break;

But I didn’t think it was especially relevant to boot effects or anything.

Is there anything else I should have tweaked that I’ve forgotten?

Destruct isn’t in saberbase yet, so that’s understandable. I had mentioned that originally.

I would watch serial monitor for messages showing when it’s playing the on, font, boot images.

You can temporarily add this delay to ProffieOS.ino at line 1628 to let serial monitor catch up and actually show the first boot stuff.

  Looper::DoSetup();
  // temp boot delay to allow serial monitor to show boot
    delay(3000);
    STDOUT << "***************** Booting up! *******************\n";
  // Time to identify the blade.
  prop.FindBlade(true);
  SaberBase::DoBoot();
#if defined(ENABLE_SD)
  if (!sd_card_found) ProffieOSErrors::sd_card_not_found();
#endif  // ENABLE_SD
}

Ah, that’s a useful hack Brian!Thanks for that.

So I tried it and bizarrely it says it’s playing the boot bitmap, even though it doesn’t show on the screen. But there are three lines below that statement that I don’t know what they mean. Relevant?

11:22:02.062 -> ***************** Booting up! *******************
11:22:02.062 -> blade = 0
11:22:02.062 -> WS2811 Blade with 32 leds.
11:22:02.062 -> Simple Blade
11:22:02.062 -> Style RAM = 348
11:22:02.062 -> Style RAM = 212
11:22:02.062 -> Style RAM = 36
11:22:02.062 -> Scanning sound font: E-11
11:22:02.129 -> done
11:22:02.129 -> Scanning sound font: oled
11:22:02.129 -> done
11:22:02.129 -> Activating hybrid font.
11:22:02.129 -> Ignition.
11:22:02.167 -> unit = 0 vol = 0.50, Playing E-11/boot/boot1.wav
11:22:02.167 -> channels: 1 rate: 44100 bits: 16
11:22:02.167 -> Playing oled/boot.bmp
11:22:02.167 -> TurnOn 0.00@012
11:22:02.167 -> TurnOn2 0.00@012
11:22:02.167 -> TurnOn3 0.00@012
11:22:02.167 -> No sounds found: poweron
11:22:02.167 -> unit = 1 vol = 0.04, Playing oled/on.bmp
11:22:02.167 -> Welcome to ProffieOS ProffieOS GitHub. Sabersense Blaster for JQ. V1.
11:22:02.167 -> For available serial commands, see:
11:22:02.167 -> https://pod.hubbe.net/tools/serial-monitor-commands.html
11:22:02.167 -> No sounds found: hum
11:22:02.167 -> Audio underflows: 1
11:22:03.164 -> I2C init..
11:22:03.164 -> Motion chip ... 105 found.
11:22:03.164 -> Display initialized.
11:22:03.200 -> Amplifier off.
11:22:07.155 -> Playing oled/on.bmp

Switching font, I can’t quite tell what’s going on, but there doesn’t seem to be a mention of a font ident display:

11:27:11.254 -> Battery voltage: 0.19
11:27:13.763 -> Playing oled/on.bmp
11:27:16.931 -> Saving Current Preset preset = 1 savedir =
11:27:16.931 -> Turning off 0.00@012
11:27:16.931 -> Turning off 0.00@012
11:27:16.931 -> Turning off 0.00@012
11:27:16.931 -> Turning off 0.00@012
11:27:16.931 -> Turning off 0.00@012
11:27:16.931 -> TurnOff 0.00@012
11:27:16.931 -> TurnOff 0.00@012
11:27:16.931 -> TurnOff 0.00@012
11:27:16.964 -> Style RAM = 288
11:27:16.964 -> Style RAM = 288
11:27:16.964 -> Style RAM = 36
11:27:16.964 -> Scanning sound font: EE-3
11:27:16.964 -> done
11:27:16.964 -> Scanning sound font: oled
11:27:16.964 -> done
11:27:17.002 -> Activating hybrid font.
11:27:17.002 -> Ignition.
11:27:17.002 -> Current Preset: ee-3
11:27:17.002 -> unit = 0 vol = 0.50, Playing EE-3/font.wav
11:27:17.002 -> channels: 1 rate: 44100 bits: 16
11:27:17.002 -> TurnOn 0.00@012
11:27:17.002 -> TurnOn2 0.00@012
11:27:17.002 -> TurnOn3 0.00@012
11:27:17.002 -> No sounds found: poweron
11:27:17.002 -> unit = 1 vol = 0.04, Playing oled/on.bmp
11:27:17.002 -> No sounds found: hum
11:27:17.002 -> Audio underflows: 1
11:27:18.494 -> Amplifier off.
11:27:20.992 -> Playing oled/on.bmp

Could it be something to do with the fact that my oled screen isn’t the standard 128 x 32. It’s 64 x 32, but the only time I reference that size is on lines 1513 / 14 of ProffieOS.ino. Is there anywhere else I need to specify it?

TurnOn lines can be ignored. They’re diagnostic for EffectLocation implementation and should be moved to PVLOG_DEBUG level at some point.

Showing “Playing oled/boot.bmp” but not showing on the display means it is actually showing it but then immediately playing on.bmp. Look at the timestamps, they both occur at 11:22:02.167.
That is what the recent addition should address, so I’m not quite sure why on.bmp is jumping in so soon. It should be waiting until your duration time of boot image has expired. Weird.

So some questions:
What do you have in the font config.ini for duration times?
What length sound do you have for boot.wav?

I have:

# Boot image duration
# Default -1.0
ProffieOSBootImageDuration=4000.0

# Font image duration
# Default 3000.0
ProffieOSFontImageDuration=0.0

So the way it works is as follows. (formatted here to use some indentation)

At bootup, if you have a boot.bmp image, 
  the config.ini value for ProffieOSBootImageDuration gets checked.
  If it exists, that time is used.
  If that time is set to 0.0, the boot.wav sound length time is used.
  If ProffieOSBootImageDuration is not specified in config.ini (commented out or missing) ,
    then the ProffieOSFontImageDuration is checked instead.
    If it exists, that time is used.
    If that time is set to 0.0, the font.wav sound's length time is used.
    If ProffieOSFontImageDuration is not specified in config.ini (commented out or missing) ,
      then a default of 3000 is used.

If no boot.bmp exists,  then the default message
  "p-os VERSION" would show using the same logic as above for boot.bmp, 
  except it checks ProffieOSTextMessageDuration, 
    which falls back to ProffieOSFontImageDuration, 
      which defaults to 3500.

So if you have nothing set in config.ini, at minimum you should see boot.bmp for 3 seconds.
Maybe try intentional long time like 7000 just to double test the logic of the handling code?
Pretty sure it’s all good, but something is eluding us here.
Also, maybe zip up your ProffieOS folder and include the font folders you are trying to use and send them to me so I can test?

I’ve tried it with a config file in with the bitmaps, and without, but it makes no difference. I also tried changing the boot time in hybrid_font from -1.0f to 5000.0, but weirdly, that threw an error when I tried to compile. Which means it only seems to work with -1.0f as the duration, but we seem to be unclear what that means.

A clue perhaps?

The boot.bmp is just a basic single frame. It works because if I rename it blast or on, then it displays, so formatting is all correct. I’ve also tried the pbm file that came with the font, but no difference.

It must be some tiny, silly little thing I have or haven’t done, but I just can’t find it.

Anyway I’ll pm you the files.

Thanks again for all your help - will definitely be buying you a bucket of coffee for all this! :smiley:

Don’t change boot time in hybrid_font. It’s meant to work with the font config.ini.

I tried it again tonight, all works fine.
Send me what you have.

Ahem. Ermm… rather embarrassingly the boot bitmap has started working. But I don’t know how.
I put the config.ini back in the oled folder and it just started working. But I had tried that same file in and out countless times, so I’m not sure what’s changed.

The only things that aren’t showing now is the font ident, and I’ve also observed that the blast.bmp only shows in kill mode (I think), or at any rate only one of the three modes available. But I’m not up on blaster lore, so I suspect that’s probably logical and correct.

Hmm. Good that boot works now, although I do wish we knew what was wrong.

I have yet to look at what you sent, will get to it momentarily.

blast.bmp isn’t a thing. I added it on my end just because.
If images for shots fired in all 3 modes are something users may want, I can propose adding them. (stun.bmp, auto.bmp, and blast.bmp…which I wish were fire.bmp, but they are counterparts to the sound files, for which Kill mode’s shot is blast.wav.)

Could also toss in images for when modes are switched, mode.bmp, stunmode.bmp, killmode.bmp, automode.bmp.

By this do you mean the text message from the “name” argument at the end of the preset?
It should also be working the same as font.
Do you have a duration in config.ini for ProffieOSTextMessageDuration?
You shouldn’t need to, but I’m curious.

Brian, you’ve cracked it! There was no ProffieOSTextMessageDuration set in my oled folder config file, and hybrid_font listed it as -1.0f, the same as ProffieOSBootImageDuration! Adding the TextMessage duration to my config sorted it.

So it seems like -1.0f as a parameter isn’t doing quite what we expect it to! But other than that, I think we’re there for this particular project.

Sincere thanks again, and sorry it was a bit uphill to get this far. :pray:

Interesting. I need to review the fall back sequence regarding these durations. At quick glance, it’ll also seems that if it’s set to zero so that the sound is supposed to determine the length, that it won’t actually.
@profezzorn if you get a second can you confirm that there’s some hiccups in the logic for these durations?

This is github master, right?

1 Like

Well that’s the version we’re discussing with the latest additions to stave off on.bmp from playing until boot, font, or text message have had a chance.
However, the logic in place before that (in OS7.14) that deals with checking if config.ini contains an entry for duration, comparing it to hybrid_font defaults, and specifically how it handles falling back to another duration (like text or boot will use font as fall back) seems weird. @Sabersense had no text shown without an entry specified in config.ini.
This is likely due to the new added line (staving off on.bmp) checking time elapsed based on the wrong thing. (I think I wrote it assuming there’s a duration preset, not accounting for -1.0 defaul, so the check if time < -1.0 will never be true)

I’m doing some edits on my end for how i think it’s supposed to work.
Example:

  • No font.bmp in font, so let’s display the “name” argument from the preset.
  • Check if user has an entry in config.ini for a text message duration by seeing if the default of -1.0 is true or not.
  • If they do, then check if it’s = 0. If yes, use font.wav sound length, if not 0, use the specified duration.
  • If not entry found, fall back to using font duration.
  • so check for font duration entry existing, handle the same way, but falling back to a default set to 3000 (or 3500 whatever)

Note to self. Test things more thoroughly. All scenarios, even unlikely ones.

ok @Sabersense try now.
All should work correctly.

Mnay thanks Brian.
Yep, just tried it, and everything seems correct. :smiley: Modified durations in config.ini are also working correctly, so no need to do any edits in hybrid_font any more, other than activating the blaster effects.
Sincere thanks again. :pray: