fiduciary

Author Topic: TeensySaber Software Discussion  (Read 67094 times)

0 Members and 1 Guest are viewing this topic.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #120 on: November 10, 2017, 10:23:39 AM »
I've got a  interesting question. When. I had a Teensy installed I had a tap and hold lock up. I did not have it programmed to do blaster blocks. However I would love to have it do localized Blaster Blocks. But I really loved having just the one button.

Can I perform this function without having a second auxiliary button?

The way it's configured today, you cannot. However, the input configuration is relatively easy to change if you wanted to change things around.
For instance, you could make long-click do blaster block instead of force push, however, that wouldn't let you do Lukes iconic triple-block.

Another option would be to change how the saber is turned off. That way short clicks would be freed up for blaster blocks.
Maybe long-click would be used for turning it off?  That could be pretty confusing for new users though.

Offline Darth Brooks

  • Experienced Force User
  • ****
  • Posts: 430
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #121 on: November 10, 2017, 11:22:35 AM »
Thanks cause I really like the one button feature... I also really want to be able to keep lock up and still have blaster blocks.

So a quick push could do blaster blocks

A tap hold could do lock up.

And a long press to turn it off?

I'm a long way from programming this thing myself but gotta get my feet wet some time!

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #122 on: November 10, 2017, 12:32:05 PM »
Thanks cause I really like the one button feature... I also really want to be able to keep lock up and still have blaster blocks.

So a quick push could do blaster blocks

A tap hold could do lock up.

And a long press to turn it off?

I'm a long way from programming this thing myself but gotta get my feet wet some time!

Lockup is currently activated by holding the button, then doing a clash. I think this works quite well.
I would prefer not to have more than two different lengths of button presses as that can be very difficult to use.

One potential option would be to have long press change what short clicks do.
start with short click turning the saber off
long press: short clicks now do blaster blocks
long press: short clicks now do force push
long press: short clicks now turns it off again

Might be annoying if you're trying to turn it off though.

Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #123 on: November 16, 2017, 04:39:46 PM »
I keep getting the "Bank open failure" error, and I'm not sure why. SD card is inserted before boot, and the SD reads fine over MTP. Tried a few different fonts on the card already.

EDIT: Ah, here I was mis-understanding, thinking the firmware can auto-scan directories looking for the font. Renamed the folder to "font01" to match the config file, and things are booting up. I'll keep tinkering.
« Last Edit: November 16, 2017, 04:44:50 PM by Kouri »

Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #124 on: November 21, 2017, 06:36:24 AM »
After playing around with it a bit, I think I've noticed a small issue. On NEC-format fonts, it sounds like the hum doesn't start playing until after the ignition sound finishes, when there should actually be some overlap. Not sure if there's a configuration line I've missed, or if it's something I'll need to edit in the audio engine. No problems with swings/clashes playing over the hum though.


Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #125 on: November 21, 2017, 10:15:49 AM »
After playing around with it a bit, I think I've noticed a small issue. On NEC-format fonts, it sounds like the hum doesn't start playing until after the ignition sound finishes, when there should actually be some overlap. Not sure if there's a configuration line I've missed, or if it's something I'll need to edit in the audio engine. No problems with swings/clashes playing over the hum though.

What font are you using?
NEC fonts come with a config file called "config.ini". That config file should contain a variable called "humstart" which specifies how many milliseconds before the end of the ignition sound the hum should start.  Teensysaber starts fading the sound in at that time. However, it's possible that teensysaber does this slightly differently than an actual NEC board. (I don't have any NEC boards to compare to.)

Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #126 on: November 21, 2017, 10:26:07 AM »
It's Lord Blako's TFA Crossguard font. I'll double check the files when I'm back home - it's entirely possible the zip didn't include a config file, at which point I'll generate one with the Igniter app.

Also nice to know that TeensySaber reads these files.

Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #127 on: November 22, 2017, 06:30:04 AM »
Yeah, font was missing the config files. Copied one over from the default package, and that about sorted things out.

Looking through the provided configs and lightsaber.ino, am I right in assuming FireBlade is the only pattern that supports delayed ignition of second/third blades?

Also curious if there's any technical reason both crossguards (four strips) can't operate from one data pin while still being on separate grounds. Would be nice to have the third data line open for a pixel crystal since I have that last FET available anyway. Won't be doing it on *this* build, but I've got another crossguard I'm planning on building out. Think I've got it figured out code-wise from the dual-blade example, but thought I'd ask before possibly messing something up.
« Last Edit: November 22, 2017, 07:43:49 AM by Kouri »

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #128 on: November 22, 2017, 10:42:22 AM »
Yeah, font was missing the config files. Copied one over from the default package, and that about sorted things out.

Great

Quote
Looking through the provided configs and lightsaber.ino, am I right in assuming FireBlade is the only pattern that supports delayed ignition of second/third blades?

Yep, that is currently the case.
However, that would be relatively easy to fix, maybe I can work on it this weekend.

Quote
Also curious if there's any technical reason both crossguards (four strips) can't operate from one data pin while still being on separate grounds. Would be nice to have the third data line open for a pixel crystal since I have that last FET available anyway. Won't be doing it on *this* build, but I've got another crossguard I'm planning on building out. Think I've got it figured out code-wise from the dual-blade example, but thought I'd ask before possibly messing something up.

That is entirely doable, and would be configured exactly as if the grounds were hooked up together, something like:
   
WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5> >()

The only drawback is that you can't control the crossguards individually.


Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #129 on: November 27, 2017, 12:13:54 AM »
New TeensySaber software released: 1.167

Only one new feature, but it's a pretty cool one: Bluetooth support.
It requires an external chip, but lets you change presets, volume and monitor battery status from your phone.

Full instructions here: TeensySaber Bluetooth Control

Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #130 on: November 27, 2017, 08:06:04 AM »
Haven't edited any code yet, but I thought I'd mention a couple of issues with the configurator at Teensy Saber Electronics V3

Typos on the last two styles on NeoPixel Crossguard. Configurator outputs ">style_pov," and ">style_charging," instead of "&style_pov," and "&style_charging,".

Also, the wiring diagram for the second momentary switch shows the lead going to Aux2, but the switch didn't function for me until I wired it to Aux. The third switch drop-down leads to the Aux port, so I'm assuming the drop downs or graphics are just accidentally swapped around.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #131 on: November 27, 2017, 10:48:50 AM »
Haven't edited any code yet, but I thought I'd mention a couple of issues with the configurator at Teensy Saber Electronics V3

Typos on the last two styles on NeoPixel Crossguard. Configurator outputs ">style_pov," and ">style_charging," instead of "&style_pov," and "&style_charging,".

Also, the wiring diagram for the second momentary switch shows the lead going to Aux2, but the switch didn't function for me until I wired it to Aux. The third switch drop-down leads to the Aux port, so I'm assuming the drop downs or graphics are just accidentally swapped around.

These problems should hopefully be fixed now.
Thanks for reporting them!

Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #132 on: November 27, 2017, 12:18:31 PM »
So looking over the code, I think I can see where clashes are triggered, and it looks like re-defining CLASH_THRESHOLD_G at a higher value (2.0-3.0) should make clashes require more force. My next thoughts are tweaking swings and adding slashes.

I *think* in that SB_Motion section down around line 3254, I just need to change the line
Code: [Select]
if (speed > 250.0) {
by reducing that 250 to a lower value, and that should make swings more sensitive?

And if so, I might be able to nest another if statement with a higher value to trigger a slash sound instead?

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #133 on: November 27, 2017, 02:30:35 PM »
So looking over the code, I think I can see where clashes are triggered, and it looks like re-defining CLASH_THRESHOLD_G at a higher value (2.0-3.0) should make clashes require more force.

Correct.

Quote
My next thoughts are tweaking swings and adding slashes.

I *think* in that SB_Motion section down around line 3254, I just need to change the line
Code: [Select]
if (speed > 250.0) {
by reducing that 250 to a lower value, and that should make swings more sensitive?

And if so, I might be able to nest another if statement with a higher value to trigger a slash sound instead?


Yes, well, sort of...
The problem is that it's going to trigger a swing sound first, and then a slash sound.
If that's not a problem, then go ahead. :)

It might be better to look at the gradient instead, something like:

Code: [Select]
   if  (speed > 200) {
      if (speed_gradient > N)
         slash();
      else
         swing();
   }

In it's simplest form, the speed gradient could be calculated by subtractig the prevoius speed from speed, but that would be
rather noisy and unpredicatable. A better way would be to do something like:

Code: [Select]
float average_speed = 0.0;  // this should be a global variable

    average_speed = (average_speed * 10 + speed) / 11;
    if (speed > 200) {
       if (speed - average_speed > 15)
          slash();
        else
          swing();
    }

Note that all values are made up and needs to be tuned. :)


Offline Kouri

  • No Force
  • *
  • Posts: 39
  • ~
Re: TeensySaber Software Discussion
« Reply #134 on: November 28, 2017, 10:06:25 AM »
Haven't tinkered with slashes yet, but I just changed both Mono/Poly speed lines to:
Code: [Select]
if (speed > SWING_THRESHOLD) {
and popped this line in my config:
Code: [Select]
#define SWING_THRESHOLD 200.0 //default 250.0
It's definitely a nice improvement. I'll keep playing with the values until I'm happy

Also, updated my power-saving calculator with standard RGB values. Designed to make the brightest color possible while keeping power consumption down to ~2.5A per strip. Useful for me so I'm not constantly swapping batteries at conventions:

Low-Power Color Selector

I've had good experience using this cool white as a FoC color against a Red <255, 0, 0> main, but it should also work well for a Silver main blade:
Code: [Select]
Rgb<65, 95, 95>
« Last Edit: November 28, 2017, 11:05:45 AM by Kouri »

 

retrousse