ProffieOS V6 pre-alpha discussion

It grows during preon, shrinks back at retraction. Instead of 2 layers that are separately written I suppose, was trying to just have 1.
I was trying to avoid subjecting you to this, but maybe just looking at how I got it to do what I wanted (the workaround) would help clarify.

StylePtr<Layers<
  Black,
  AlphaL<Layers<
    AudioFlicker<GreenYellow,AlphaL<Black,Int<10000>>>,
    TransitionLoopL<TrConcat<TrInstant,Rgb<100,200,255>,TrDelay<50>,AlphaL<Black,Int<0>>,TrDelay<360>>>,
    TransitionLoopL<TrConcat<TrInstant,AlphaL<Green,SmoothStep<Int<30000>,Int<0>>>,TrDelay<180>,AlphaL<Green,SmoothStep<Int<2000>,Int<-1>>>,TrDelay<180>>>>,Ifon<Int<32768>,Int<0>>>,
  InOutTrL<TrSmoothFade<1200>,TrConcat<TrInstant,AlphaL<Mix<BlinkingF<Int<360>,Int<100>>,Sparkle<GreenYellow,Rgb<10,255,0>,3000,500>,Rgb<100,200,255>>,Bump<Int<16384>,Scale<Trigger<EFFECT_RETRACTION,Int<3000>,Int<1>,Int<3000>>,Int<65536>,Int<0>>>>,TrDelay<3000>>>,
  AlphaL<Layers<
    AlphaL<Sparkle<GreenYellow,Rgb<10,255,0>,3000,500>,Bump<Int<16384>,Scale<Trigger<EFFECT_PREON,Int<10000>,Int<1>,Int<3000>>,Int<0>,Int<50000>>>>,
    TransitionEffectL<TrWaveX<Sparkle<AlphaL<Black,Int<0>>,GreenYellow,3000,500>,Int<20000>,Int<200>,Int<20000>>,EFFECT_PREON>,
    AlphaL<Black,Scale<Trigger<EFFECT_PREON,Int<1>,Scale<Trigger<EFFECT_IGNITION,Int<500>,Int<1000>,Int<500>>,Int<10000>,Int<0>>,Int<500>>,Int<0>,Int<22000>>>,
    TransitionEffectL<TrConcat<TrInstant,GreenYellow,TrDelay<15>>,EFFECT_PREON>>,Int<32768>>>>()

I’m afraid I can’t figure out what the intention is from this code.
There seems to be a lot of drawing on top of black layers with transparent black colors, and I’m not sure why. It kind of seems to me that two separate layers might be the right way to implement this, but maybe that’s just because I don’t quite understand it.

1 Like

Not important. Thanks.

1 Like

I would gladly help out here, as I have been updating the WebUSB app quite a lot lately. (My latest addition was rawHID support for Teensy-based sabers)

Let me know if there is anything I can do to make that easier. Maybe we should start a thread specifically for discussing the webapp… (Still need a better name for it…)

Some of the things Fett263 is working isn’t checked in yet, and some may require some additional commands to work over serial, which I can help with if needed.

1 Like

I saw a button that functions like a 4 way joystick. You could move around menu options with ease

Seems like it would take a lot of digital inputs.
But with a little charliplexing and/or resistors we might be able to reduce that.
ProffieOS already has events for UP/DOWN/LEFT/RIGHT, but no real bindings for those events.
It’s too bad left/right and up/down have a separate common, because it would be a really easy 3-state thing with hooking left up to 3v and right to GND and then check if the pin is high, low or floating.

1 Like

I have re-written all the I2C communication in ProffieOS to use interrupts. This makes it much faster. It should mean faster display updates and also many more motion events per second. ProffieOS always asked for 1600 updates per second from the motion chip, but rarely actually used them. Now it usually does.

This is a fairly large change in how motion events are handled, so there is a half-decent chance that it breaks something, so lots of testing would be helpful. The updated code also does some filtering in the fusor which should hopefully help with the spurious swing-on problems we’ve been having.

I may still need to do some tweaking to slow things down a bit when the saber is mostly idle. (Like waiting for a swing-on) but it seems to be working pretty well, so I checked it in.

1 Like

Amazing!! Looking forward to display rate improvement.
Is there any documentation to peek at yet for things such as WavLen or other newer adds and their usage?
I’ve been carrying over edits that make customizations work, but if I can leave it behind, I’ll load up the master as test, but most of my configs might not jive.

As usual, styles are supposed to be documented in the file they are in. I know some of them might not have it or it might be poorly documented. When that happens, please ask and I will improve the documentation.

Unfortunately, my experience has been worse with the motion chip. It actually did a push as well. log below.
Also, I had my OLED sporadically showing the image 2x side by side.
Restarting didn’t fix, second reset cleared it up.

This is sitting idle on a bench as opposed to the usual EVENT occuring on prev/next preset:

20:57:58.676 -> Playing Portal/hum/hum05.wav
20:57:58.676 -> channels: 1 rate: 44100 bits: 16
20:58:07.267 -> Battery voltage: 0.00
20:58:09.905 -> Motion disable.
20:58:09.905 -> I2C init..
20:58:09.905 -> Motion setup ... done.
20:58:09.941 -> EVENT: Swing ON millis=342710
20:58:09.941 -> unit = 1 vol = 0.50, Playing Portal/slsh/slsh02.wav
20:58:09.941 -> channels: 1 rate: 44100 bits: 16
20:58:09.978 -> unit = 3 vol = 0.00, Playing Portal/swingl/swingl04.wav
20:58:10.015 -> channels: 1 rate: 44100 bits: 16
20:58:10.015 -> unit = 2 vol = 0.02, Playing Portal/swingh/swingh04.wav
20:58:10.015 -> channels: 1 rate: 44100 bits: 16
20:58:10.015 -> EVENT: Push ON millis=342805
20:58:10.015 -> unit = 4 vol = 0.50, Playing Portal/push01.wav
20:58:10.053 -> channels: 1 rate: 44100 bits: 16
20:58:10.053 -> EVENT: Push ON millis=342838
20:58:10.053 -> EVENT: Push ON millis=342844
20:58:10.091 -> EVENT: Push ON millis=342855
20:58:11.915 -> I2C sleeping..
20:58:12.651 -> Playing Portal/swingl/swingl04.wav
20:58:12.651 -> channels: 1 rate: 44100 bits: 16
20:58:13.477 -> Playing Portal/swingh/swingh04.wav
20:58:13.477 -> channels: 1 rate: 44100 bits: 16
20:58:16.085 -> Motion disable.
20:58:16.085 -> I2C init..
20:58:16.085 -> Motion setup ... done.
20:58:16.123 -> EVENT: Swing ON millis=348887
20:58:16.123 -> unit = 1 vol = 0.50, Playing Portal/slsh/slsh01.wav
20:58:16.123 -> channels: 1 rate: 44100 bits: 16
20:58:16.161 -> unit = 3 vol = 0.00, Playing Portal/swingl/swingl01.wav
20:58:16.161 -> channels: 1 rate: 44100 bits: 16
20:58:16.161 -> unit = 2 vol = 0.48, Playing Portal/swingh/swingh01.wav
20:58:16.161 -> channels: 1 rate: 44100 bits: 16
20:58:18.072 -> I2C sleeping..
20:58:18.697 -> Motion disable.
20:58:18.697 -> I2C init..
20:58:18.697 -> Motion setup ... done.
20:58:18.697 -> EVENT: Swing ON millis=351485
20:58:18.697 -> unit = 1 vol = 0.50, Playing Portal/slsh/slsh02.wav
20:58:18.734 -> channels: 1 rate: 44100 bits: 16
20:58:18.734 -> unit = 3 vol = 0.00, Playing Portal/swingl/swingl01.wav
20:58:18.734 -> channels: 1 rate: 44100 bits: 16
20:58:18.734 -> unit = 2 vol = 0.06, Playing Portal/swingh/swingh01.wav
20:58:18.770 -> channels: 1 rate: 44100 bits: 16
20:58:20.675 -> I2C sleeping..
20:58:21.270 -> Motion disable.
20:58:21.270 -> I2C init..
20:58:21.270 -> Motion setup ... done.
20:58:21.306 -> unit = 1 vol = 0.50, Playing Portal/slsh/slsh01.wav
20:58:21.306 -> channels: 1 rate: 44100 bits: 16
20:58:21.306 -> EVENT: Swing ON millis=354101
20:58:21.344 -> unit = 3 vol = 0.00, Playing Portal/swingl/swingl05.wav
20:58:21.344 -> channels: 1 rate: 44100 bits: 16
20:58:21.344 -> unit = 2 vol = 0.01, Playing Portal/swingh/swingh05.wav
20:58:21.382 -> channels: 1 rate: 44100 bits: 16
20:58:23.286 -> I2C sleeping..
20:58:23.550 -> Playing Portal/swingh/swingh05.wav
20:58:23.550 -> channels: 1 rate: 44100 bits: 16
20:58:27.288 -> Battery voltage: 0.00

Not just straight L/R split either. Weird misalignment:

Additionally, it would seem that memory usage has gone up substantially. Many less presets fitting. I did add the ENABLE ALL defines.

Some new things definitely uses more memory, but I’m curious if this is a case of many small things adding up or if there is one thing that is using up lots of mory.

Could you add a call to fusor.dump() where it detects the push?
The faster reads would produce more noise, but I thought for sure I had compensated for that.

However, there is a chance that I simply messed up and it’s getting weird data.
The shifted display could be caused by me messing up too.

Memory use - adding one at a time.
default_proffieboard_config on master branch, NUM_BLADES 1 compiled at 66%
#define ENABLE_OLED cost 8,408
#define FILTER_CUTOFF_FREQUENCY and #define FILTER_ORDER only 864
#define SAVE_STATE cost 1224
#define ENABLE_ALL_MENU_OPTIONS cost 1536

Added a typical generic blade style from Fett263’s Library, uncustomized. 9056
Same style with all bells and whistles. = 14944 - up to 80% here
My Portal blade style (essentially 2 in one) = 29200 - 92%

Maybe I should add it to swing too? This is straight off upload, waiting for SD card to mount/unmount from computer.

00:31:04.591 -> Welcome to ProffieOS, type 'help' for more info.
00:31:09.033 -> Motion disable.
00:31:09.033 -> I2C init..
00:31:09.033 -> Motion setup ... done.
00:31:09.070 -> EVENT: Swing millis=29217
00:31:09.070 -> EVENT: Swing millis=29228
00:31:11.047 -> I2C sleeping..
00:31:11.644 -> Motion disable.
00:31:11.644 -> I2C init..
00:31:11.644 -> Motion setup ... done.
00:31:11.682 -> EVENT: Swing millis=31823
00:31:11.682 -> EVENT: Swing millis=31833
00:31:12.899 -> Motion disable.
00:31:12.899 -> Motion setup ... done.
00:31:12.936 -> EVENT: Swing millis=33072
00:31:14.901 -> I2C sleeping..
00:31:15.491 -> Motion disable.
00:31:15.491 -> I2C init..
00:31:15.491 -> Motion setup ... done.
00:31:15.528 -> EVENT: Swing millis=35678
00:31:17.500 -> I2C sleeping..
00:31:18.090 -> Motion disable.
00:31:18.090 -> I2C init..
00:31:18.090 -> Motion setup ... done.
00:31:18.127 -> EVENT: Swing millis=38273
00:31:18.127 -> EVENT: Swing millis=38283
00:31:19.837 -> Battery voltage: 0.13
00:31:20.098 -> I2C sleeping..
00:31:20.694 -> Motion disable.
00:31:20.694 -> I2C init..
00:31:20.694 -> Motion setup ... done.
00:31:20.729 -> EVENT: Swing millis=40886
00:31:22.701 -> I2C sleeping..
00:31:39.863 -> Battery voltage: 0.12

Here’s while ON. Mostly the random swing events, but eventually got a push:

Well, it looks like I’ve messed up the dump function.
Fixing…

Ok, I fixed fusor.dump(), try it now. (And yes, you might want to add it to the swing detection function too.)

Running now. But I don’t see anything for swing reported. I edited like this:

// EVENT_SWING - Swing On gesture control to allow fine tuning of speed needed to ignite
      if (millis() - saber_off_time_ < MOTION_TIMEOUT) {
        SaberBase::RequestMotion();
        if (swinging_ && fusor.swing_speed() < 90) {
          swinging_ = false;
        }
        if (!swinging_ && fusor.swing_speed() > BC_SWING_ON_SPEED) {
          
          fusor.dump();                                               // BC test
          swinging_ = true;
          Event(BUTTON_NONE, EVENT_SWING);
        }
      }

Here’s new dump from on to off: