OLED Blaster Config

I managed to modify the code to diplay the blaster mode on the OLED.
Also reformatted the output to display nicely on a 128x64 OLED.
Also altered the battery charge graphics.
Have installed into a General Grievious Nerf Blaster :slight_smile: Cut out is a bit rough but I will print a new bezel to cover gaps :slight_smile:
Need to do some more work on the code so that it reformats correctly dependant on display size.

7 Likes

Hello Adrian, nice Work! Would you like to share how you managed to make the display to show the blaster modes (Auto, Kill, Stun)?

What do I need to change in the code and which config files need to be targeted? How does the .bmp file be named. I have so many questions.

I would apreciate it very much.

Best Wishes

At the moment, there’s no support for kill, stun, or auto images (would display when mode is changed).
Not hard to do though.

I modified a couple of the files in the proffieOS. ‘blaster.h’ in /props and ‘ssd1306.h’ in /display.
When I get home, i’ll find the modified files, and share them.

1 Like

I would appreciate it very much :smile: Thank you!

NoSloppy, yes I know thats currently not supported but I had the idea to code it by myself. Before I start coding I would like to have a clear idea on how to do it, because I dont want to destroy the existing code. I had no time to try it by my own yet but here is what I think needs to be changed by reading threads and trying to understand the Github files:

-add blaster modes in ssd1306.h as:

IMAGE_FILESET(mdkill);
IMAGE_FILESET(mdstun);
IMAGE_FILESET(mdauto);

-add in #ifdef OLED_USE_BLASTER_IMAGES however I dont know if case should be EFFECT_MDKILL or EFFECT_MODE, as you cannot find mdkill and so on in the style editor:

case EFFECT_MDKILL:
ShowFileWithSoundLength(&IMG_mdkill, font_config.ProffieOSmdkillDuration);
break;
-----------------------and so on for the other modes---------------

-add in #ifdef OLED_USE_BLASTER_IMAGES add:

CONFIG_VARIABLE2(ProffieOSMdkillImageDuration, 1000.0f);
---------and so on for the other modes----------

-add in #ifdef OLED_USE_BLASTER_IMAGES:

#ifdef OLED_USE_BLASTER_IMAGES
float ProffieOSMdkillImageDuration;
---------and so on for the other modes------------

Then make a new config.ini or extending it and set the specific timings for ProffieOSMdkillImageDuration and so on for the other modes.

However, I think thats not all and I thinks its not even the correct approach and as Adrian has stated, there needs to be something changed in the prop file blaster.h but I dont know if its needed here.

I would appreciate further hints. Ideally would be if, Adrian explain his code to me. Thanks.

The trick is having the display show the correct image, because there’s already an EFFECT_MODE in Saberbase. That’s the event.
Which mode it’s cycling to, and which sound it plays is determined in the prop file.

I’m wondering if maybe this should be handled in the prop file.
SImilar to how we do custom sound effects.
Might not be as simple as sounds though, because there could be more than one display…

Hmm thanks but unfortunately this does not enlighten me. There is EFFECT_MODE already in Saberbase, the prop file is taking care of which mode it is cycling to. This is what I understood from your reply and also what I can see in the files. But I still do not understand what needs to be changed in baster.h. What do you think about my initial thoughts on what lines needs to be added/changed?

I don’t think we need EFFECT_MDKILL.
Just use EFFECT_MODE and call prop_GetBlasterMode() to find out which mode actually is in effect.

Hey Adrian, I just cant figure it out. Would you like to share your work and leave a few words about it?

@Profezzorn, can we call things in a prop to tell ssd1306 to do stuff directly (as in not having SaberBase do it per-se in the background?
Like I had thought about having the display show the PLI when the prop does SaberBase::DoEffect(EFFECT_BATTERY_LEVEL, 0);
by calling something like ssd1306.SetScreenNow(SCREEN_PLI);

If yes, could we just add a thing in the blaster prop’s NextBlasterMode() when the modes are triggered, something like:

  virtual void NextBlasterMode() {
    switch(blaster_mode) {
      case MODE_STUN:
        SetBlasterMode(MODE_KILL);
        ssd1306.ShowFileWithSoundLength(&IMG_mdkill, font_config.ProffieOSModeImageDuration);
        return;

Kinda spitballing here. My brain’s involved in something else at the moment.

I mean, is it possible? - yes
Is it how I imagine things to work? - no

What it would prefer is for the blaster to have a display controller implementation. This controller can inherit from the standard display controller and add things like blaster modes. Then when you set up your display, you specify which controller you want to use. Controllers are also capable of doing special screens, like bullet counts, but that’s a bit more complicated.