Blaster OLEDs - how do they work?

So I’m working on some simple graphics for a blaster scope oled, but I’m not having much luck. I’ve got it displaying correctly by changing the lines around 1410 in the .ino file to the new screen dimensions, but the only effects that I can make display are “boot” and “on”.

If I build other graphics and name them blst.bmp or whatever, they don’t display.

And if I have an on.bmp in a font folder, it seems to take precedence over everything and stops even the boot bmp displaying.

If I remove those bitmaps completely, I get the battery level and the first four characters of font idents when I switch fonts.

Trouble is I’ve not worked on a blaster before so I don’t relly know what’s supposed to happen. Should I be able to have different graphics for different effects, like I can with a saber? Or is the on.bmp the only real display available?

Any thoughts or helpful links to more info would be much appreciated.

:slight_smile:

The display works the same regardless of saber of blaster prop file used, so no concern there. However, names change just as the sounds do, so for example “blst.bmp” is for a saber blaster deflection. There’s not support at the moment for “blast” which is when the blaster fires a shot.
Look in the ssd1306.h file and you’ll see currently supported image names:

// Images/animations
IMAGE_FILESET(boot);
IMAGE_FILESET(font);
IMAGE_FILESET(blst);
IMAGE_FILESET(clsh);
IMAGE_FILESET(force);
IMAGE_FILESET(preon);
IMAGE_FILESET(out);
IMAGE_FILESET(in);
IMAGE_FILESET(pstoff);
IMAGE_FILESET(on);
IMAGE_FILESET(lock);
IMAGE_FILESET(idle);
/* To-Do, possibly differently
#ifdef OLED_USE_BLASTER_IMAGES
IMAGE_FILESET(reload);
IMAGE_FILESET(empty);
IMAGE_FILESET(jam);
IMAGE_FILESET(clipin);
IMAGE_FILESET(clipout);
IMAGE_FILESET(destruct);
#endif
*/
IMAGE_FILESET(lowbatt);

If you uncomment the section to use #define OLED_USE_BLASTER_IMAGES
in the display file and 2 sections in hybrid_font.h, those will also work.
Although, I don’t think we officially added destruct to saber_base.h yet.

To preemptively answer your next anticipated question, yes, you can manually add any effect by following these examples and modifying
display/ssd1306.h
sound/hybrid_font.h
common/saber_base.h

Thanks for this Brian.
Everything you’ve said makes perfect sense, but doesn’t seem to match any observations:

  1. When I uncomment that section in “hybrid_font”, I get compile errors along the lines of:
ProffieOS/sound/hybrid_font.h:34:22: error: 'ProffieOSReloadImageDuration' was not declared in this scope; did you mean 'ProffieOSFontImageDuration'?
   34 |     CONFIG_VARIABLE2(ProffieOSReloadImageDuration, 1000.0f);
  1. I cannot get any bitmap to display other than on.bmp. If that file is an animation, it loops successfully. If it’s just a single frame, the battery level takes over after a few seconds.

  2. If I try button commands like clipin, clipout, reload, nothing happens with the oled, even if there are bitmaps with the appropriate names in the folder.

There must be some simple little bit of blaster protocol that I don’t know about that’s torpedoing my efforts, but whatever it is, I can’t find it.

There are 2 sections in hybrid font. The CONFIG_VARIABLE2 declaration and also below that in the initialization section, such as

#ifdef OLED_USE_BLASTER_IMAGES
  // for OLED displays, the time a reload.bmp will play
  float ProffieOSReloadImageDuration;

Ah, OK. I’d completely missed that.

Unfortunately having now included the second reference, it compiles and uploads correctly but doesn’t seem to have made any difference to how the oled works. :confused:

did you add #define OLED_USE_BLASTER_IMAGES to your config?

Yes I did. However I noticed that in hybrid_font the two references to it are different - one says OLED_USE_BLASTER_IMAGES and the other says USE_OLED_BLASTER_IMAGES. I tried switching them around and every combination in between - one way it won’t compile, and every other way it compiles and ulpoads but doesn’t seem to make a difference, :confused:

ok. I used search and all references are exactly OLED_USE_BLASTER_IMAGES. Not sure where you found a different version.

However, doing so pointed out that there’s actually 2 sections in ssd1306.h as well.
The cases in the effect switch in SB_Effect2() are also commented out.
Without those being satisfied, you’ll get nothing.
example

   case EFFECT_RELOAD:
   ShowFileWithSoundLength(&IMG_reload, font_config.ProffieOSReloadImageDuration);

Aaahaaa! Thanks Brian! You’re a star! That has indeed kicked a few things into life.

So I now have ‘on’, ‘empty’ and ‘reload’ displays working.

However:

‘Boot’ still doesn’t seem to show up - it just goes straight to ‘on’. Is this because ‘boot’ isn’t listed as a blaster effect, only a saber effect? i.e. defining OLED_USE_BLASTER_IMAGES replaces the saber effects with blaster effects rather than adding to them?

There’s no font ident when you switch fonts unless I remove the ‘on’ oled file.

Likewise it never reverts to a battery level display as long as an ‘on’ file is present - although actually that’s probably how we want it. Basically ‘on’ seems to prioritize itself over most things.

I haven’t got as far as testing ‘jam’ yet, but I’ll have another play around with it this afternoon.

Sincere thanks as always for getting me this far Brian. Much appreciated as always.
:slight_smile:

Been doing a little more testing, and for some reason the jam function won’t work. I started at 50 percent chance of a jam in the config, and have gone up to 95 percent chance, but it never jams. No biggie, but would be nice to get it working.

But boots, font idents and battery are bigger priorities if it’s possible to those working. :slight_smile:

These are defines I have in my test blaster config

#define BLASTER_ENABLE_AUTO // was #define ENABLE_BLASTER_AUTO
#define BLASTER_SHOTS_UNTIL_EMPTY 15  // (whatever number)
#define BLASTER_JAM_PERCENTAGE 5     // if not defined, random.
#define BLASTER_DEFAULT_MODE MODE_KILL

jam definitely works, so we can look into that more, but let’s figure out your display images first.
So .

no. They’re in addition to. I suppose we could have that define disable the saber specific images at the same time, but at the moment (we’re dealing with back burner stuff here) it is just enabling the blaster specific images.

No font.bmp is likely due to the state of being ON all the time when a blaster.
I’m also seeing that next_preset_fast() will cause on.bmp to NOT play… so there’s definitely some ironing out to do.

boot.pbm is working for me, but I need to try a .bmp.
It might be your config.ini settings in the font?
I have

# Boot image duration
# Default -1.0
ProffieOSBootImageDuration=4000.0

but i think that’s not relavant with a non-looped or non-single frame image.
The text message from the preset’s name argument would fall under:

# Text Message duration
# Default -1.0
ProffieOSTextMessageDuration=3500.0

but I am foggy on how we had this working as it’s been a while.

@profezzorn do you remember why we’re setting the default duration with a -1?

CONFIG_VARIABLE2(ProffieOSBootImageDuration, -1.0f);

All is working as expected with blaster, except if on.bmp exists, it overrides boot and font images (and font text too) since saberbase is ON.
So I guess we could work on that.

As I recall, the -1 means we use some other variable to determine the time.

ok @Sabersense I got it working. Changes are pending PR on GitHub.
Here’s results:

1 Like

Oh wow! :open_mouth: Brian, you absolute legend! This is amazing! As always I’m in your debt! :pray:

So is this all part of the Github Master now, or do these mods still need to be added?

Either way, this is great news all round! Thank you so much! :pray: :pray: :pray:

Not yet. It’s submitted for review.

1 Like

Yes, now it is.

1 Like

Great news! :smiley: Thanks again Brian. :pray: Will try it out when I get home later today. :slight_smile:

OK, I finally had a chance to have a play around with this, and the good news is that Jam and Blast effects work a treat. Also if I have a font.bmp file, that gets displayed when I switch font.

But I still don’t seem to get a boot display or a font ident unless I remove the on.bmp.

BUT…

I think it’s partly to do with the fact I have a global oled folder for all fonts. If I ditch the global oled folder and put the bitmaps in individual font folders, then switching from a font folder WITH an on.bmp to a folder WITHOUT an on.bmp, then it works as it there’s no on.bmp in the folder I’m switching to. But even so, it still means that the presence of an on.bmp is stopping a boot file or font ident showing from the same folder.

If that made sense… :confused:

But it’s still a great step forward. Thanks so much for getting it this far. :slight_smile:

I tested it though and the video is that test. It shouldn’t matter whatsoever if you have a common folder using these images or not. Are you sure you’ve grabbed the latest update? You should see this now added to ssd1306.h: