fiduciary

Author Topic: TeensySaber Software Discussion  (Read 67312 times)

0 Members and 3 Guests are viewing this topic.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: MTP folders
« Reply #165 on: December 11, 2017, 10:25:26 AM »
Hmm, I thought I did some testing with windows 7, but that was a while ago, so I don't remember the results.
I'm going to try it again, but it may take a while since I'll be travelling over the holidays.
Tried MTP with Windows 10 this morning. Worked. I could see all files in all folders, even 2 sub folders deep.
So it's a Windows 7 issue. I can work around this as I have access to some Windows 10 computers.

BTW, I'm enjoying building my own saber and tinkering with the code (mostly just configuration and presets). Cobbled the parts together over the weekend and (after some troubleshooting) saw the PL9823 blade "extend" for the first time and it was a thrill. Thank you for your documentation and excellent firmware.

One suggestion: It would be nice if you described the basic functions. Things like how to do a lock, blaster, force and drag - with 0, 1 or 2 buttons. How to change presets (with saber off, hold down the power button and tap the blade). Some of these were not obvious to me. I deduced some things from the code, but not all. You've added so many cool features over the firmware releases, it'd be a shame if people didn't know how to use them.

Sounds like an excellent idea, and something I can work on while I'm travelling over the holidays. :)

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #166 on: December 15, 2017, 12:14:04 PM »
Hello,

I went to update the code on the saber and when i put the new software on the power on/off button doesn't work... I load the old software I have and the button works fine... I looked through code and I didn't see anything that stood out as to being the culprit.. Any ideas?

Nice to see a Bluetooth addition to the TEENSY SABER. In the future, with this new module, will there a way to code the saber over bluetooth with this new module rather then taking it apart?

Regards,

GMcIvor
« Last Edit: December 15, 2017, 12:26:54 PM by gmcivor »

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #167 on: December 15, 2017, 02:16:02 PM »
Hello,

I went to update the code on the saber and when i put the new software on the power on/off button doesn't work... I load the old software I have and the button works fine... I looked through code and I didn't see anything that stood out as to being the culprit.. Any ideas?

Nice to see a Bluetooth addition to the TEENSY SABER. In the future, with this new module, will there a way to code the saber over bluetooth with this new module rather then taking it apart?

Regards,

GMcIvor

You probably need to update your configuration file, as the button configuration has changed. Check out the CONFIG_BUTTONS section in the example configuration files.
It's possible that programming over bluetooth will happen at some point in the future, but I don't know when.
Basically it will be a two-step process: Upload the new firmware to the SD card over bluetooth, then reboot. The teensy would then re-program itself from the sd card. (somehow)
It's not going to happen in the immediate future though. However, I plan to implement support for reading more of the configuration from the sd card, and manipulating the config files over bluetooth is significantly easier. This would at least make it so that you wouldn't have to re-program the teensy quite so often.


Offline TTFRAZ

  • No Force
  • *
  • Posts: 17
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #168 on: December 16, 2017, 08:31:29 AM »
Hey guys just a heads up... I’m new to all this. I’ve tinkered around with many different thing but when is comes to programming things I’m still very new. But thankfulll profezzorn you have done an excellent job with your Teensy saber. Just a few questions. Is it possible to use rgbw leds? I was looking into some that a believe have a sk6812 chip to them and says they’re just an upgraded ws2812B strip. I think it’s all compatible and similar to the WS2811 but I was wondering if adding the white to the rgb would change the coding. My thought process is that with the white you can still reach a certain level of brightness even when choosing led colors that don’t utilize the full brightness of the led.
Another question I had is when it comes to sound fonts is how do you know what is polyphonic and what is mono? Is it determined by the sound file or simple depends on how you name the file. And also i see a lot of .lsu when I’m looking around for sound fonts. Can these be used? Or should they be converted to .wav?

Thanks for all you help in advance.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #169 on: December 16, 2017, 10:11:36 AM »
Hey guys just a heads up... I’m new to all this. I’ve tinkered around with many different thing but when is comes to programming things I’m still very new. But thankfulll profezzorn you have done an excellent job with your Teensy saber. Just a few questions. Is it possible to use rgbw leds? I was looking into some that a believe have a sk6812 chip to them and says they’re just an upgraded ws2812B strip. I think it’s all compatible and similar to the WS2811 but I was wondering if adding the white to the rgb would change the coding. My thought process is that with the white you can still reach a certain level of brightness even when choosing led colors that don’t utilize the full brightness of the led.
Another question I had is when it comes to sound fonts is how do you know what is polyphonic and what is mono? Is it determined by the sound file or simple depends on how you name the file. And also i see a lot of .lsu when I’m looking around for sound fonts. Can these be used? Or should they be converted to .wav?

Thanks for all you help in advance.

Short answer: Not without some fairly intricate programming.
RGBW LED stars are supported, but RGBW neopixels are not.
It's possible to implement support for it, but it's never been high on my priority list. RGBW neopixels can display white colors more efficiently, but are not really better at anything else. Most people like very saturated colors for their lightsabers, and white de-saturates colors.....

Teensysaber determines if the font is polyphonic or not by the names of the files. The file naming scheme is reasonably well documented on the teensysaber software page.
Teensysaber supports LSU files, but LSU fonts don't have a consistent naming scheme, so be prepared to rename the files, or teensysaber will not be able to find them.


Offline KanyonKris

  • Padawan Learner
  • **
  • Posts: 72
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #170 on: December 18, 2017, 09:57:22 AM »
When I include a "boot.wav" file it plays all garbled, but after the garbled boot all the sounds play perfectly. Perhaps audio is not properly initialized or ready to play the boot sound? Using firmware version 1.167 with a version 3 saber board.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #171 on: December 18, 2017, 12:10:04 PM »
When I include a "boot.wav" file it plays all garbled, but after the garbled boot all the sounds play perfectly. Perhaps audio is not properly initialized or ready to play the boot sound? Using firmware version 1.167 with a version 3 saber board.

That's weird. You sure it's not something wrong with the wav file?  (Try copying a file that works and name it boot.wav to make sure.)
I don't usually use a boot.wav file, so it's possible that there is a problem that I haven't noticed. However, I did try that fairly recently, so I think it ought to work.
Unfortunately I won't be able to test it myself until January.

Another possible reason for garbled sound is low voltage, maybe the booster hasn't quite gotten up to 5 volts yet?  (Can be measured with a multimeter.)
(I know this because I sometimes run my test board without the booster, and it still manages to play sounds, but they are quiet and distorted.)

Offline Fletch

  • No Force
  • *
  • Posts: 19
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #172 on: December 18, 2017, 02:24:26 PM »
We got some hardware working.  Yeah!!  However, we made some charging blades but we can't figure out how to add another blade.  We just changed BLADE_NUM to 2 instead of 1 and then we added the blade style for charging under the BladeConfig blades [] section.  When I do that I get this error....

Arduino: 1.8.5 (Windows 7), TD: 1.40, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

In file included from C:\Users\jeff.jones\Dropbox (Personal)\TeensySaber Software\lightsaber\lightsaber.ino:5984:0:

my_saber1.h:76: error: cannot convert 'const char*' to 'BladeStyle*' in initialization
 };

There is some more stuff but it all stems from the 'const char*' initialization error.  It worked when we just had one blade.

Thoughts????

Offline Fletch

  • No Force
  • *
  • Posts: 19
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #173 on: December 18, 2017, 02:51:32 PM »
We got some hardware working.  Yeah!!  However, we made some charging blades but we can't figure out how to add another blade.  We just changed BLADE_NUM to 2 instead of 1 and then we added the blade style for charging under the BladeConfig blades [] section.  When I do that I get this error....

Arduino: 1.8.5 (Windows 7), TD: 1.40, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

In file included from C:\Users\jeff.jones\Dropbox (Personal)\TeensySaber Software\lightsaber\lightsaber.ino:5984:0:

my_saber1.h:76: error: cannot convert 'const char*' to 'BladeStyle*' in initialization
 };

There is some more stuff but it all stems from the 'const char*' initialization error.  It worked when we just had one blade.

Thoughts????

We figured this out.  I guess the BLADE_NUM is not what we thought.  We switched it to 1 and it compiled.  However, this is what I have in the BladeConfig blades [] section...
{ 2600, WS2811BladePtr<maxLedsPerStrip, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(presets) },
{ 15000, WS2811BladePtr<1, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(charging_presets) },

If I comment out the charging blade, then the other works just fine.  When I uncomment the charging blade it thinks it is a charging blade even though it is a normal blade.  Here is the output from the serial console.
Sdcard found..
ID: 728 volts 2.35 resistance= 81162.16
blade= 1
WS2811 Blade with 1 leds
Charging Style
Scanning sound font: charging done
Welcome to TeensySaber, type 'help' for more info.
I2C pullups found, initializing...
Motion setup ... done.
Amplifier off.

So, we measured the resistance of the blade and it says it is 2.597kohms.  We are not sure how to make the software identify the right blade when it clearly isn't.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #174 on: December 18, 2017, 03:47:45 PM »
We got some hardware working.  Yeah!!  However, we made some charging blades but we can't figure out how to add another blade.  We just changed BLADE_NUM to 2 instead of 1 and then we added the blade style for charging under the BladeConfig blades [] section.  When I do that I get this error....

Arduino: 1.8.5 (Windows 7), TD: 1.40, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

In file included from C:\Users\jeff.jones\Dropbox (Personal)\TeensySaber Software\lightsaber\lightsaber.ino:5984:0:

my_saber1.h:76: error: cannot convert 'const char*' to 'BladeStyle*' in initialization
 };

There is some more stuff but it all stems from the 'const char*' initialization error.  It worked when we just had one blade.

Thoughts????

We figured this out.  I guess the BLADE_NUM is not what we thought.  We switched it to 1 and it compiled.  However, this is what I have in the BladeConfig blades [] section...
{ 2600, WS2811BladePtr<maxLedsPerStrip, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(presets) },
{ 15000, WS2811BladePtr<1, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(charging_presets) },

If I comment out the charging blade, then the other works just fine.  When I uncomment the charging blade it thinks it is a charging blade even though it is a normal blade.  Here is the output from the serial console.
Sdcard found..
ID: 728 volts 2.35 resistance= 81162.16
blade= 1
WS2811 Blade with 1 leds
Charging Style
Scanning sound font: charging done
Welcome to TeensySaber, type 'help' for more info.
I2C pullups found, initializing...
Motion setup ... done.
Amplifier off.

So, we measured the resistance of the blade and it says it is 2.597kohms.  We are not sure how to make the software identify the right blade when it clearly isn't.

BLADE_NUM is for when you have multiple *simultaneous* blades. If you change BLADE_NUM to two, then each entry in the blades[] array has two blades, and each entry in the preset arrays has two styles. It's not what you need.

There are basically two possibilities for why it's not able to identify the blade.
The first one is a quirk that I would love to fix, but don't know how: When you re-program the teensy, and it reboots without loosing power, the blade ID doesn't always work. It seems like once the neopixels have been powered, it just doesn't work anymore.

The other option is that it's not hooked up as expected, like maybe a short somewhere?  The good news is that even if there is something wrong with the circuit, as long as the charging blade and the neopixel blade produces different values, you can just adjust the blades[] array accordingly, move on and call it a day. :)

Offline Fletch

  • No Force
  • *
  • Posts: 19
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #175 on: December 18, 2017, 03:59:51 PM »
There are basically two possibilities for why it's not able to identify the blade.
The first one is a quirk that I would love to fix, but don't know how: When you re-program the teensy, and it reboots without loosing power, the blade ID doesn't always work. It seems like once the neopixels have been powered, it just doesn't work anymore.

Could we re-program with an external power supply without powering an actual blade?

The other option is that it's not hooked up as expected, like maybe a short somewhere?  The good news is that even if there is something wrong with the circuit, as long as the charging blade and the neopixel blade produces different values, you can just adjust the blades[] array accordingly, move on and call it a day. :)

I will try this out and see.  Thanks for the response!!

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #176 on: December 18, 2017, 09:51:31 PM »
There are basically two possibilities for why it's not able to identify the blade.
The first one is a quirk that I would love to fix, but don't know how: When you re-program the teensy, and it reboots without loosing power, the blade ID doesn't always work. It seems like once the neopixels have been powered, it just doesn't work anymore.

Could we re-program with an external power supply without powering an actual blade?


Doh!
I forgot to actually say what the workaround for this is: After re-programming, unplug the blade and plug it back in again.
After a cold reboot, reading the blade ID should work just fine.

Offline KanyonKris

  • Padawan Learner
  • **
  • Posts: 72
  • Um...Hello?
ENABLE_AUDIO
« Reply #177 on: December 19, 2017, 04:34:28 PM »
First, I got my saber working! I'll post video in the hardware thread.

During bring-up I disabled audio by commenting out "#define ENABLE_AUDIO" but found that the dynamic mixer was still called out in a few places so I added some #ifdef code to deal with it and allow the code to compile. Here's the code:

Code: [Select]
template<class A, class B>
class AudioFlicker {
public:
  void run(BladeBase* blade) {
    a_.run(blade);
    b_.run(blade);
#ifdef ENABLE_AUDIO
    mix_ = clampi32(dynamic_mixer.last_sum() >> 4, 0, 255);
#else
    mix_ = random(255);
#endif
  }
  OverDriveColor getColor(int led) {
    OverDriveColor a = a_.getColor(led);
    OverDriveColor b = b_.getColor(led);
    a.c = a.c.mix(b.c, mix_);
    return a;
  }
private:
  A a_;
  B b_;
  int mix_;
};

Code: [Select]
    if (!strcmp(cmd, "get_volume")) {
#ifdef ENABLE_AUDIO
      STDOUT.println(dynamic_mixer.get_volume());
#else
      STDOUT.println("No mixer, can't get volume");
#endif
      return true;
    }
    if (!strcmp(cmd, "set_volume") && arg) {
      int32_t volume = strtol(arg, NULL, 0);
      if (volume >= 0 && volume <= 3000)
#ifdef ENABLE_AUDIO
        dynamic_mixer.set_volume(volume);
#else
      STDOUT.println("No mixer, can't set volume");
#endif
      return true;
    }
« Last Edit: December 19, 2017, 11:16:29 PM by KanyonKris »

Offline KanyonKris

  • Padawan Learner
  • **
  • Posts: 72
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #178 on: December 19, 2017, 05:26:35 PM »
That's weird. You sure it's not something wrong with the wav file?  (Try copying a file that works and name it boot.wav to make sure.)
Bingo, it was a bad WAV file. Used Audacity to save as a 22050 Hz, WAV (Microsoft) signed 16-bit PCM file. Is that wrong?

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #179 on: December 19, 2017, 11:09:20 PM »
That's weird. You sure it's not something wrong with the wav file?  (Try copying a file that works and name it boot.wav to make sure.)
Bingo, it was a bad WAV file. Used Audacity to save as a 22050 Hz, WAV (Microsoft) signed 16-bit PCM file. Is that wrong?

Sounds right to me.

 

retrousse