FX-Sabers.com

Ahch-To: Instructional Section related to constructing your own Lightsaber => Open Source Sound Cards => Topic started by: profezzorn on May 29, 2017, 03:34:13 PM

Title: TeensySaber Software Discussion
Post by: profezzorn on May 29, 2017, 03:34:13 PM
The original TeensySaber thread is getting a little long in the tooth, so I'm starting a new thread specifically to discuss the TeensySaber software. (http://fredrik.hubbe.net/lightsaber/teensy_saber.html).

I will update this post with useful information for new people as we go.

For people who want to see the full history and keep up to date on untested changes to the TeensySaber software, I recommend the TeensySaber GitHub repository (https://github.com/profezzorn/TeensySaber).
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 29, 2017, 03:36:25 PM
I just uploaded version 1.110, changes include:
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 29, 2017, 04:30:46 PM
So lockup sounds and effects will only work with two button sabers ?

For single it could be while on hold power and clash then when power released it stops. Or would that be to close to  the force sound being played while holding and releasing the power button ?

Guess my next saber will have to have two buttons... Maybe Graflex 2.0 :)

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 29, 2017, 06:59:49 PM
Actually, let me rephrase that:

It's the button you used to turn it on that enables the lockup mode.
So if you turned it on with AUX, it's AUX, if you turn it on with POWER, then it's POWER.
So it should work just fine with a single-button saber.

(I just happened to be using AUX when I was testing it...)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 29, 2017, 07:04:55 PM
That's good! I will upload and see tomorrow.

Still thinking of building the graflex one of these days.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 08:17:38 AM
Well, the random boot sound works! The lockup works! and the audio flicker is cool!

I noticed on some sound fonts since the volume increased that I cannot tell the distinction between hum and swing they either blend together or sounds like it doesn't trigger is this what you were talking about when you increase the volume?. But the sound is louder overall, especially on the boot sounds, font sounds, and the sound tracks.

Any suggestions?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 30, 2017, 08:55:32 AM
Well, the random boot sound works! The lockup works! and the audio flicker is cool!

I noticed on some sound fonts since the volume increased that I cannot tell the distinction between hum and swing they either blend together or sounds like it doesn't trigger is this what you were talking about when you increase the volume?. But the sound is louder overall, especially on the boot sounds, font sounds, and the sound tracks.

Any suggestions?

Regards,

GMcIvor


That could be the bug I found last night. I pushed a fix to github, but I haven't uploaded it to my site yet. (Will do that later today.)

There is at least one more audio bug, it just doesn't trigger often enough to be easy to find...
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 09:08:49 AM
Quote
That could be the bug I found last night. I pushed a fix to github, but I haven't uploaded it to my site yet. (Will do that later today.)

There is at least one more audio bug, it just doesn't trigger often enough to be easy to find...

Oh okay, thanks for the update. Well I will be on the look out for anything else.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 09:39:57 AM
Is the other issue audio failing to play? When I have plugged my blade it sometimes it wont play audio and everything else works happens once in awhile. Other when I triggered a clash the audio will stop then I trigger it and it will play. That happens once and awhile too.

I wonder if this is the other bug you were talking about.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 30, 2017, 10:01:39 AM
Yep, that's the one I haven't found yet.
Will be hunting some more tonight.
Let me know if you find any clues or some reliable way to trigger the bug.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 10:06:34 AM
Yep, that's the one I haven't found yet.
Will be hunting some more tonight.
Let me know if you find any clues or some reliable way to trigger the bug.

Will do! I will play around and see if I can maybe get a student to try and trigger it and I watch their actions to see why happened.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 11:25:00 AM
Yep, that's the one I haven't found yet.
Will be hunting some more tonight.
Let me know if you find any clues or some reliable way to trigger the bug.

One that I encountered for sure every time is when you initiate lock up and you move the saber around (detects swing) it will play the swing sound audio will cut to hum, but the lockup effect will still go on. Once you let go of the button to cease the lockup it will play the lockup end sound.

I don't know if this is related or something new. I will keep looking.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 30, 2017, 11:58:00 AM
Yep, that's the one I haven't found yet.
Will be hunting some more tonight.
Let me know if you find any clues or some reliable way to trigger the bug.

One that I encountered for sure every time is when you initiate lock up and you move the saber around (detects swing) it will play the swing sound audio will cut to hum, but the lockup effect will still go on. Once you let go of the button to cease the lockup it will play the lockup end sound.

I don't know if this is related or something new. I will keep looking.

Regards,

GMcIvor

I'm guessing that's with a monophonic font, is that correct?
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 12:03:02 PM
I will have to check which font, but I believe it is and that probably explains it.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 30, 2017, 12:09:17 PM
It does explain it, but it really shouldn't behave that way.
I will work on fixing it.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 01:22:43 PM
Alright,

Thank you!
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 08:15:42 PM
I don't have a specific event that always triggers the no sound. Sometimes after charging the battery I plug in my blade and would get no sound. Also when I plug in my blade near the bottom section it would flicker different colors and then show the charge status but no sound. I would unplug it and plug it back in and then i would get sound. I wonder why I am getting the flickering of colors and sometimes that causing the no sound?

Anyways I will keep investigating, unless you found it.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 30, 2017, 08:24:06 PM
Hmm, I usually see flickering because it's decided to use the wrong blade type for some reason.

Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 08:27:04 PM
yeah, it flickers different colors. And then when I start the cyan blade it would be a darker blue then id clash and it would turn back to cyan. This just started happening and it only happens with my main blade (pl9823). I wonder if the data pin is loose somewhere...

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 30, 2017, 08:30:45 PM
Obvious question: Did you make changes to blades[] (or something else) that you did not copy over when you switched to a new version of the software?

Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 30, 2017, 08:33:22 PM
No, all I copied over the the blade arrays and the blade presets. It pretty much the same as the last version expect I used the audio flicker into the yellow blade. But my default preset after the teensy boots up is charge indicator.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 31, 2017, 09:26:25 AM
I still haven't found a way to always trigger the audio bug. But I will still search. I still have the rainbow effect on the blade when I plug it in sometimes. It usually happens when I tighten the blade retention screw and i guess it moves the connector to one side or something...

On another note if I wanted to add more colors into the code where would I enter the RGB values. I found this:
Code: [Select]

typedef Rgb<255,0,0> RED;
typedef Rgb<0,255,0> GREEN;
typedef Rgb<0,0,255> BLUE;
typedef Rgb<255,255,0> YELLOW;
typedef Rgb<0,255,255> CYAN;
typedef Rgb<255,0,255> MAGENTA;
typedef Rgb<255,255,255> WHITE;
typedef Rgb<0,0,0> BLACK;


Is this wehere I would define those RGB values to create the macro to use?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 31, 2017, 10:27:03 AM
Yes, or you can use Rgb<red, green,blue> directly.
Note that unlike screen RGB values, RGB values in the teensysaber code are linear.
If you have an RGB value from a computer that you wish to use, you should do this to each value:
Code: [Select]
   ((V/255)^2.2) * 255

For example, the css color "hotpink" which is rgb(244, 105, 180) would become: Rgb<255, 36, 118>

Note that the color will still not come out exactly the same as on the screen, because the actual red, green and blues are not the same as the pixels on your screen. (This is a good thing though, as most screens are not nearly as vibrant.)

Probably I should just run through the list of CSS colors and add typedefs for all 140 of them. :)

Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 31, 2017, 10:53:02 AM
Yes, or you can use Rgb<red, green,blue> directly.
Note that unlike screen RGB values, RGB values in the teensysaber code are linear.
If you have an RGB value from a computer that you wish to use, you should do this to each value:
Code: [Select]
   ((V/255)^2.2) * 255

For example, the css color "hotpink" which is rgb(244, 105, 180) would become: Rgb<255, 36, 118>

Note that the color will still not come out exactly the same as on the screen, because the actual red, green and blues are not the same as the pixels on your screen. (This is a good thing though, as most screens are not nearly as vibrant.)

Probably I should just run through the list of CSS colors and add typedefs for all 140 of them. :)

Okay that makes sense!

And you could :) but that would be some work on your part on the off chance people will use those colors! But I would sure be greatfull! :)

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 31, 2017, 02:50:08 PM
And you could :) but that would be some work on your part on the off chance people will use those colors! But I would sure be greatfull! :)

Not that much work:

Code: [Select]
typedef Rgb<223, 239, 255> AliceBlue;
typedef Rgb<244, 213, 175> AntiqueWhite;
typedef Rgb<0, 255, 255> Aqua;
typedef Rgb<55, 255, 169> Aquamarine;
typedef Rgb<223, 255, 255> Azure;
typedef Rgb<233, 233, 184> Beige;
typedef Rgb<255, 199, 142> Bisque;
typedef Rgb<0, 0, 0> Black;
typedef Rgb<255, 213, 157> BlanchedAlmond;
typedef Rgb<0, 0, 255> Blue;
typedef Rgb<66, 5, 195> BlueViolet;
typedef Rgb<97, 4, 4> Brown;
typedef Rgb<187, 124, 62> BurlyWood;
typedef Rgb<29, 88, 91> CadetBlue;
typedef Rgb<55, 255, 0> Chartreuse;
typedef Rgb<166, 36, 2> Chocolate;
typedef Rgb<255, 55, 19> Coral;
typedef Rgb<32, 78, 217> CornflowerBlue;
typedef Rgb<255, 239, 184> Cornsilk;
typedef Rgb<184, 0, 10> Crimson;
typedef Rgb<0, 255, 255> Cyan;
typedef Rgb<0, 0, 67> DarkBlue;
typedef Rgb<0, 67, 67> DarkCyan;
typedef Rgb<124, 61, 0> DarkGoldenRod;
typedef Rgb<103, 103, 103> DarkGray;
typedef Rgb<103, 103, 103> DarkGrey;
typedef Rgb<0, 32, 0> DarkGreen;
typedef Rgb<131, 122, 37> DarkKhaki;
typedef Rgb<67, 0, 67> DarkMagenta;
typedef Rgb<22, 37, 6> DarkOliveGreen;
typedef Rgb<255, 68, 0> DarkOrange;
typedef Rgb<82, 7, 156> DarkOrchid;
typedef Rgb<67, 0, 0> DarkRed;
typedef Rgb<209, 79, 50> DarkSalmon;
typedef Rgb<71, 130, 71> DarkSeaGreen;
typedef Rgb<15, 10, 67> DarkSlateBlue;
typedef Rgb<6, 19, 19> DarkSlateGray;
typedef Rgb<6, 19, 19> DarkSlateGrey;
typedef Rgb<0, 159, 164> DarkTurquoise;
typedef Rgb<77, 0, 168> DarkViolet;
typedef Rgb<255, 0, 75> DeepPink;
typedef Rgb<0, 135, 255> DeepSkyBlue;
typedef Rgb<36, 36, 36> DimGray;
typedef Rgb<36, 36, 36> DimGrey;
typedef Rgb<2, 72, 255> DodgerBlue;
typedef Rgb<115, 3, 3> FireBrick;
typedef Rgb<255, 244, 223> FloralWhite;
typedef Rgb<3, 67, 3> ForestGreen;
typedef Rgb<255, 0, 255> Fuchsia;
typedef Rgb<184, 184, 184> Gainsboro;
typedef Rgb<239, 239, 255> GhostWhite;
typedef Rgb<255, 175, 0> Gold;
typedef Rgb<180, 97, 2> GoldenRod;
typedef Rgb<55, 55, 55> Gray;
typedef Rgb<55, 55, 55> Grey;
typedef Rgb<0, 55, 0> Green;
typedef Rgb<108, 255, 6> GreenYellow;
typedef Rgb<223, 255, 223> HoneyDew;
typedef Rgb<255, 36, 118> HotPink;
typedef Rgb<255, 255, 223> Ivory;
typedef Rgb<223, 203, 68> Khaki;
typedef Rgb<203, 203, 244> Lavender;
typedef Rgb<255, 223, 233> LavenderBlush;
typedef Rgb<52, 248, 0> LawnGreen;
typedef Rgb<255, 244, 157> LemonChiffon;
typedef Rgb<108, 176, 203> LightBlue;
typedef Rgb<223, 55, 55> LightCoral;
typedef Rgb<191, 255, 255> LightCyan;
typedef Rgb<244, 244, 166> LightGoldenRodYellow;
typedef Rgb<168, 168, 168> LightGray;
typedef Rgb<168, 168, 168> LightGrey;
typedef Rgb<72, 219, 72> LightGreen;
typedef Rgb<255, 121, 138> LightPink;
typedef Rgb<255, 91, 50> LightSalmon;
typedef Rgb<2, 115, 104> LightSeaGreen;
typedef Rgb<62, 159, 244> LightSkyBlue;
typedef Rgb<47, 63, 82> LightSlateGray;
typedef Rgb<47, 63, 82> LightSlateGrey;
typedef Rgb<112, 142, 187> LightSteelBlue;
typedef Rgb<255, 255, 191> LightYellow;
typedef Rgb<0, 255, 0> Lime;
typedef Rgb<7, 157, 7> LimeGreen;
typedef Rgb<244, 223, 203> Linen;
typedef Rgb<255, 0, 255> Magenta;
typedef Rgb<55, 0, 0> Maroon;
typedef Rgb<33, 157, 104> MediumAquaMarine;
typedef Rgb<0, 0, 157> MediumBlue;
typedef Rgb<127, 22, 168> MediumOrchid;
typedef Rgb<75, 41, 182> MediumPurple;
typedef Rgb<10, 117, 42> MediumSeaGreen;
typedef Rgb<51, 35, 219> MediumSlateBlue;
typedef Rgb<0, 244, 84> MediumSpringGreen;
typedef Rgb<15, 164, 156> MediumTurquoise;
typedef Rgb<147, 1, 60> MediumVioletRed;
typedef Rgb<1, 1, 41> MidnightBlue;
typedef Rgb<233, 255, 244> MintCream;
typedef Rgb<255, 199, 193> MistyRose;
typedef Rgb<255, 199, 119> Moccasin;
typedef Rgb<255, 187, 108> NavajoWhite;
typedef Rgb<0, 0, 55> Navy;
typedef Rgb<250, 233, 203> OldLace;
typedef Rgb<55, 55, 0> Olive;
typedef Rgb<37, 70, 3> OliveDrab;
typedef Rgb<255, 97, 0> Orange;
typedef Rgb<255, 14, 0> OrangeRed;
typedef Rgb<180, 41, 173> Orchid;
typedef Rgb<219, 207, 104> PaleGoldenRod;
typedef Rgb<81, 246, 81> PaleGreen;
typedef Rgb<111, 219, 219> PaleTurquoise;
typedef Rgb<182, 41, 75> PaleVioletRed;
typedef Rgb<255, 221, 171> PapayaWhip;
typedef Rgb<255, 180, 125> PeachPuff;
typedef Rgb<157, 60, 11> Peru;
typedef Rgb<255, 136, 154> Pink;
typedef Rgb<186, 91, 186> Plum;
typedef Rgb<112, 191, 203> PowderBlue;
typedef Rgb<55, 0, 55> Purple;
typedef Rgb<33, 7, 82> RebeccaPurple;
typedef Rgb<255, 0, 0> Red;
typedef Rgb<130, 71, 71> RosyBrown;
typedef Rgb<12, 36, 193> RoyalBlue;
typedef Rgb<67, 14, 0> SaddleBrown;
typedef Rgb<244, 55, 43> Salmon;
typedef Rgb<231, 96, 29> SandyBrown;
typedef Rgb<5, 67, 23> SeaGreen;
typedef Rgb<255, 233, 219> SeaShell;
typedef Rgb<91, 21, 5> Sienna;
typedef Rgb<136, 136, 136> Silver;
typedef Rgb<62, 159, 213> SkyBlue;
typedef Rgb<36, 25, 157> SlateBlue;
typedef Rgb<41, 55, 72> SlateGray;
typedef Rgb<41, 55, 72> SlateGrey;
typedef Rgb<255, 244, 244> Snow;
typedef Rgb<0, 255, 55> SpringGreen;
typedef Rgb<14, 57, 118> SteelBlue;
typedef Rgb<166, 118, 68> Tan;
typedef Rgb<0, 55, 55> Teal;
typedef Rgb<176, 135, 176> Thistle;
typedef Rgb<255, 31, 15> Tomato;
typedef Rgb<12, 191, 162> Turquoise;
typedef Rgb<219, 57, 219> Violet;
typedef Rgb<233, 187, 117> Wheat;
typedef Rgb<255, 255, 255> White;
typedef Rgb<233, 233, 233> WhiteSmoke;
typedef Rgb<255, 255, 0> Yellow;
typedef Rgb<84, 157, 7> YellowGreen;

Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 31, 2017, 02:59:12 PM
And you could :) but that would be some work on your part on the off chance people will use those colors! But I would sure be greatfull! :)

Not that much work:

Code: [Select]
typedef Rgb<223, 239, 255> AliceBlue;
typedef Rgb<244, 213, 175> AntiqueWhite;
typedef Rgb<0, 255, 255> Aqua;
typedef Rgb<55, 255, 169> Aquamarine;
typedef Rgb<223, 255, 255> Azure;
typedef Rgb<233, 233, 184> Beige;
typedef Rgb<255, 199, 142> Bisque;
typedef Rgb<0, 0, 0> Black;
typedef Rgb<255, 213, 157> BlanchedAlmond;
typedef Rgb<0, 0, 255> Blue;
typedef Rgb<66, 5, 195> BlueViolet;
typedef Rgb<97, 4, 4> Brown;
typedef Rgb<187, 124, 62> BurlyWood;
typedef Rgb<29, 88, 91> CadetBlue;
typedef Rgb<55, 255, 0> Chartreuse;
typedef Rgb<166, 36, 2> Chocolate;
typedef Rgb<255, 55, 19> Coral;
typedef Rgb<32, 78, 217> CornflowerBlue;
typedef Rgb<255, 239, 184> Cornsilk;
typedef Rgb<184, 0, 10> Crimson;
typedef Rgb<0, 255, 255> Cyan;
typedef Rgb<0, 0, 67> DarkBlue;
typedef Rgb<0, 67, 67> DarkCyan;
typedef Rgb<124, 61, 0> DarkGoldenRod;
typedef Rgb<103, 103, 103> DarkGray;
typedef Rgb<103, 103, 103> DarkGrey;
typedef Rgb<0, 32, 0> DarkGreen;
typedef Rgb<131, 122, 37> DarkKhaki;
typedef Rgb<67, 0, 67> DarkMagenta;
typedef Rgb<22, 37, 6> DarkOliveGreen;
typedef Rgb<255, 68, 0> DarkOrange;
typedef Rgb<82, 7, 156> DarkOrchid;
typedef Rgb<67, 0, 0> DarkRed;
typedef Rgb<209, 79, 50> DarkSalmon;
typedef Rgb<71, 130, 71> DarkSeaGreen;
typedef Rgb<15, 10, 67> DarkSlateBlue;
typedef Rgb<6, 19, 19> DarkSlateGray;
typedef Rgb<6, 19, 19> DarkSlateGrey;
typedef Rgb<0, 159, 164> DarkTurquoise;
typedef Rgb<77, 0, 168> DarkViolet;
typedef Rgb<255, 0, 75> DeepPink;
typedef Rgb<0, 135, 255> DeepSkyBlue;
typedef Rgb<36, 36, 36> DimGray;
typedef Rgb<36, 36, 36> DimGrey;
typedef Rgb<2, 72, 255> DodgerBlue;
typedef Rgb<115, 3, 3> FireBrick;
typedef Rgb<255, 244, 223> FloralWhite;
typedef Rgb<3, 67, 3> ForestGreen;
typedef Rgb<255, 0, 255> Fuchsia;
typedef Rgb<184, 184, 184> Gainsboro;
typedef Rgb<239, 239, 255> GhostWhite;
typedef Rgb<255, 175, 0> Gold;
typedef Rgb<180, 97, 2> GoldenRod;
typedef Rgb<55, 55, 55> Gray;
typedef Rgb<55, 55, 55> Grey;
typedef Rgb<0, 55, 0> Green;
typedef Rgb<108, 255, 6> GreenYellow;
typedef Rgb<223, 255, 223> HoneyDew;
typedef Rgb<255, 36, 118> HotPink;
typedef Rgb<255, 255, 223> Ivory;
typedef Rgb<223, 203, 68> Khaki;
typedef Rgb<203, 203, 244> Lavender;
typedef Rgb<255, 223, 233> LavenderBlush;
typedef Rgb<52, 248, 0> LawnGreen;
typedef Rgb<255, 244, 157> LemonChiffon;
typedef Rgb<108, 176, 203> LightBlue;
typedef Rgb<223, 55, 55> LightCoral;
typedef Rgb<191, 255, 255> LightCyan;
typedef Rgb<244, 244, 166> LightGoldenRodYellow;
typedef Rgb<168, 168, 168> LightGray;
typedef Rgb<168, 168, 168> LightGrey;
typedef Rgb<72, 219, 72> LightGreen;
typedef Rgb<255, 121, 138> LightPink;
typedef Rgb<255, 91, 50> LightSalmon;
typedef Rgb<2, 115, 104> LightSeaGreen;
typedef Rgb<62, 159, 244> LightSkyBlue;
typedef Rgb<47, 63, 82> LightSlateGray;
typedef Rgb<47, 63, 82> LightSlateGrey;
typedef Rgb<112, 142, 187> LightSteelBlue;
typedef Rgb<255, 255, 191> LightYellow;
typedef Rgb<0, 255, 0> Lime;
typedef Rgb<7, 157, 7> LimeGreen;
typedef Rgb<244, 223, 203> Linen;
typedef Rgb<255, 0, 255> Magenta;
typedef Rgb<55, 0, 0> Maroon;
typedef Rgb<33, 157, 104> MediumAquaMarine;
typedef Rgb<0, 0, 157> MediumBlue;
typedef Rgb<127, 22, 168> MediumOrchid;
typedef Rgb<75, 41, 182> MediumPurple;
typedef Rgb<10, 117, 42> MediumSeaGreen;
typedef Rgb<51, 35, 219> MediumSlateBlue;
typedef Rgb<0, 244, 84> MediumSpringGreen;
typedef Rgb<15, 164, 156> MediumTurquoise;
typedef Rgb<147, 1, 60> MediumVioletRed;
typedef Rgb<1, 1, 41> MidnightBlue;
typedef Rgb<233, 255, 244> MintCream;
typedef Rgb<255, 199, 193> MistyRose;
typedef Rgb<255, 199, 119> Moccasin;
typedef Rgb<255, 187, 108> NavajoWhite;
typedef Rgb<0, 0, 55> Navy;
typedef Rgb<250, 233, 203> OldLace;
typedef Rgb<55, 55, 0> Olive;
typedef Rgb<37, 70, 3> OliveDrab;
typedef Rgb<255, 97, 0> Orange;
typedef Rgb<255, 14, 0> OrangeRed;
typedef Rgb<180, 41, 173> Orchid;
typedef Rgb<219, 207, 104> PaleGoldenRod;
typedef Rgb<81, 246, 81> PaleGreen;
typedef Rgb<111, 219, 219> PaleTurquoise;
typedef Rgb<182, 41, 75> PaleVioletRed;
typedef Rgb<255, 221, 171> PapayaWhip;
typedef Rgb<255, 180, 125> PeachPuff;
typedef Rgb<157, 60, 11> Peru;
typedef Rgb<255, 136, 154> Pink;
typedef Rgb<186, 91, 186> Plum;
typedef Rgb<112, 191, 203> PowderBlue;
typedef Rgb<55, 0, 55> Purple;
typedef Rgb<33, 7, 82> RebeccaPurple;
typedef Rgb<255, 0, 0> Red;
typedef Rgb<130, 71, 71> RosyBrown;
typedef Rgb<12, 36, 193> RoyalBlue;
typedef Rgb<67, 14, 0> SaddleBrown;
typedef Rgb<244, 55, 43> Salmon;
typedef Rgb<231, 96, 29> SandyBrown;
typedef Rgb<5, 67, 23> SeaGreen;
typedef Rgb<255, 233, 219> SeaShell;
typedef Rgb<91, 21, 5> Sienna;
typedef Rgb<136, 136, 136> Silver;
typedef Rgb<62, 159, 213> SkyBlue;
typedef Rgb<36, 25, 157> SlateBlue;
typedef Rgb<41, 55, 72> SlateGray;
typedef Rgb<41, 55, 72> SlateGrey;
typedef Rgb<255, 244, 244> Snow;
typedef Rgb<0, 255, 55> SpringGreen;
typedef Rgb<14, 57, 118> SteelBlue;
typedef Rgb<166, 118, 68> Tan;
typedef Rgb<0, 55, 55> Teal;
typedef Rgb<176, 135, 176> Thistle;
typedef Rgb<255, 31, 15> Tomato;
typedef Rgb<12, 191, 162> Turquoise;
typedef Rgb<219, 57, 219> Violet;
typedef Rgb<233, 187, 117> Wheat;
typedef Rgb<255, 255, 255> White;
typedef Rgb<233, 233, 233> WhiteSmoke;
typedef Rgb<255, 255, 0> Yellow;
typedef Rgb<84, 157, 7> YellowGreen;

Oh wow, thank you,

I`ll copy and paste that in and see. So many color choices and blade possibilities :) This will be fun.

The macros you already have are all capitals, do these ones have to be or not ?

Regards,

GMcIvor 
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 31, 2017, 03:04:08 PM

The macros you already have are all capitals, do these ones have to be or not ?


They can be named any way you (we) want, as long as they don't collide with other names in the file. Also, there seems to be some duplicates, they will need to be removed, or it will cause compilation errors.

Also, pretty much all colors that don' thave a 255 (or close to it) in them are just kind of useless, so I might remove them from the list before I add it to the code.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 31, 2017, 06:59:06 PM

Quote
They can be named any way you (we) want, as long as they don't collide with other names in the file. Also, there seems to be some duplicates, they will need to be removed, or it will cause compilation errors.

Also, pretty much all colors that don' thave a 255 (or close to it) in them are just kind of useless, so I might remove them from the list before I add it to the code.

Okay that is good to know, and yeah I saw some duplicates in there and thought it might cause a compile error if left.

Are they useless because the color wouldn't show nicely? Since the value isn't close to a 255?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on May 31, 2017, 09:00:32 PM
They are "useless" because they don't use the full brightness possible for a given color.
(I mean, why would you want it to be less than full brightness?)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on May 31, 2017, 09:04:42 PM
They are "useless" because they don't use the full brightness possible for a given color.
(I mean, why would you want it to be less than full brightness?)

I didn't think about it that way. You are right, bright as possible.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 01, 2017, 01:27:44 AM
I think I found the audio bug.
I've uploaded the fix to github, will upload to my site after some more testing.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 01, 2017, 07:33:49 AM
I think I found the audio bug.
I've uploaded the fix to github, will upload to my site after some more testing.

How did you find it reliable? I'm glad you found it. I was having trouble triggering it in a certain way for me to be confident.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 01, 2017, 09:04:13 AM
I think I found the audio bug.
I've uploaded the fix to github, will upload to my site after some more testing.

How did you find it reliable? I'm glad you found it. I was having trouble triggering it in a certain way for me to be confident.

Regards,

GMcIvor

I programmed my saber to clash 10 times per second, unless the sound was out.
Eventually I found that if FillBuffer is called at exactly the wrong time (when a new sound is starting) it would think it was at the end of the file, when in fact it was at the beginning of the file.

I also found and fixed a memory leak.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 01, 2017, 09:42:45 AM
I think I found the audio bug.
I've uploaded the fix to github, will upload to my site after some more testing.

How did you find it reliable? I'm glad you found it. I was having trouble triggering it in a certain way for me to be confident.

Regards,

GMcIvor

I programmed my saber to clash 10 times per second, unless the sound was out.
Eventually I found that if FillBuffer is called at exactly the wrong time (when a new sound is starting) it would think it was at the end of the file, when in fact it was at the beginning of the file.

I also found and fixed a memory leak.

Okay that makes sense, since when I clashed it several times in a row the audio cut out...

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 04, 2017, 04:52:58 PM
Ok, I did a bunch of testing (and fixing) using my sporty new OWK, and version 1.119 is now available for download from my site. Assuming this version works as well as I think it does. I'm going to consider removing the BETA version warning from my site. However, I thought I'd ask people what features they think are important and not yet implemented first.

Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 04, 2017, 05:05:40 PM
Ok, I did a bunch of testing (and fixing) using my sporty new OWK, and version 1.119 is now available for download from my site. Assuming this version works as well as I think it does. I'm going to consider removing the BETA version warning from my site. However, I thought I'd ask people what features they think are important and not yet implemented first.

Saw the build pictures of the OWK, and it is super nice! What blade did you use in the pictures you added of it? I will upload the new software shortly and do some testing on mine. I still need to figure out the data line issue, I believe its in the blade....
It says on your website it defaults to V2.3. Is that for the V2 board? What do I have to change to make it work with my V1 setup?

Also I'm changing the button configuration for my saber (one button) and the default is touch button. Before I could take out the sensitivity and change TouchButton power_; to Button power_; and it worked out great.

Now it says
Code: [Select]
#ifdef POWER_TOUCHBUTTON
            power_(powerButtonPin, 1700, "pow"),
#else
            power_(powerButtonPin, "pow"),
Which makes perfect sense. If it is a touch button use it and if not then use button.

And when I go to change  TouchButton power_; it says

Code: [Select]

#ifdef POWER_TOUCHBUTTON
  TouchButton power_;
#else
  Button power_;


I understand the coding logic here but where I am defining touch button or button?

Would it be here?
Code: [Select]

#if VERSION_MAJOR >= 2
#define V2
#else
#define POWER_TOUCHBUTTON
#endif


Thank you for all the progress and work. I'll ask my students, tomorrow, who are making it, or own a different saber, what features they would like to see.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 04, 2017, 06:08:01 PM
Saw the build pictures of the OWK, and it is super nice! What blade did you use in the pictures you added of it?

It's my 97 x PL9823 blade.

Quote
I will upload the new software shortly and do some testing on mine. I still need to figure out the data line issue, I believe its in the blade....
It says on your website it defaults to V2.3. Is that for the V2 board? What do I have to change to make it work with my V1 setup?

Yep, it's for the V2 board. Just change the BOARD_MAJOR to 1 and BOARD_MINOR to 0 (it's near the beginning of the file.)

V1 and V2 are pretty similar, but uses different motion chips and a few pins differ, so if you use the wrong one, it doesn't work.

Quote
Also I'm changing the button configuration for my saber (one button) and the default is touch button. Before I could take out the sensitivity and change TouchButton power_; to Button power_; and it worked out great.

Now it says
Code: [Select]
#ifdef POWER_TOUCHBUTTON
            power_(powerButtonPin, 1700, "pow"),
#else
            power_(powerButtonPin, "pow"),
Which makes perfect sense. If it is a touch button use it and if not then use button.

And when I go to change  TouchButton power_; it says

Code: [Select]

#ifdef POWER_TOUCHBUTTON
  TouchButton power_;
#else
  Button power_;


I understand the coding logic here but where I am defining touch button or button?

Would it be here?
Code: [Select]

#if VERSION_MAJOR >= 2
#define V2
#else
#define POWER_TOUCHBUTTON
#endif



I made the defaults to match my sabers. I really ought to make it easier to configure and keep
the configurations separate though. Anyways, you can do exactly what you did before, or you can just
comment out the line that says "#define POWER_TOUCHBUTTON".

Quote
Thank you for all the progress and work. I'll ask my students, tomorrow, who are making it, or own a different saber, what features they would like to see.

Your students already have lightsabers? Where do you teach? Jedi Academy?
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 04, 2017, 06:23:14 PM
Quote
It's my 97 x PL9823 blade.

How long is your blade? When I built mine for a 36 in blade I was only able to fit 73.

Quote
Yep, it's for the V2 board. Just change the BOARD_MAJOR to 1 and BOARD_MINOR to 0 (it's near the beginning of the file.)

V1 and V2 are pretty similar, but uses different motion chips and a few pins differ, so if you use the wrong one, it doesn't work.

Ah okay, thanks. I will hope to get more V2 boards. The one I bought I am giving to the student. I was fixing a piece for her and ended up breaking the USB off the teensy. So I felt bad and said I would give it to her...
Quote
I made the defaults to match my sabers. I really ought to make it easier to configure and keep
the configurations separate though. Anyways, you can do exactly what you did before, or you can just
comment out the line that says "#define POWER_TOUCHBUTTON".

Alright, couldnt I also change it to" #define POWER_BUTTON".

Quote
Your students already have lightsabers? Where do you teach? Jedi Academy?

Yes, some of them bought the ones from EB Games/Gamestop. One bought one from Saberforge I believe. And another bought one from Ultrasabers maybe? I teach at D.W Poppy Secondary. And I wish that would be the career of a life time :)

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 04, 2017, 06:29:19 PM
How long is your blade? When I built mine for a 36 in blade I was only able to fit 73.

40"

Quote
Ah okay, thanks. I will hope to get more V2 boards. The one I bought I am giving to the student. I was fixing a piece for her and ended up breaking the USB off the teensy. So I felt bad and said I would give it to her...

I'll send you an extra one next time you order.

Quote
Alright, couldn't I also change it to" #define POWER_BUTTON".

Yes, that would work, but could be confusing as the only purpose of that define is to NOT be equal to POWER_TOUCHBUTTON.
(If someone sent me a code review like that I would tell them not to do that.)

Quote
Quote
Your students already have lightsabers? Where do you teach? Jedi Academy?

Yes, some of them bought the ones from EB Games/Gamestop. One bought one from Saberforge I believe. And another bought one from Ultrasabers maybe? I teach at D.W Poppy Secondary. And I wish that would be the career of a life time :)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 04, 2017, 06:51:12 PM
Quote
40"
That makes a lot of sense.

Quote
I'll send you an extra one next time you order.
Thank you :) But you don't have to I'm happy to support your work and your future developments.

Quote
Yes, that would work, but could be confusing as the only purpose of that define is to NOT be equal to POWER_TOUCHBUTTON.
(If someone sent me a code review like that I would tell them not to do that.)

That answer my question.

Quote
Your students already have lightsabers? Where do you teach? Jedi Academy?


Yes, some of them bought the ones from EB Games/Gamestop. One bought one from Saberforge I believe. And another bought one from Ultrasabers maybe? I teach at D.W Poppy Secondary. And I wish that would be the career of a life time :)
Yes, I'm hoping to get more student's building the Teensysaber though. It starts with one and will only go up from there.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on June 05, 2017, 05:36:10 AM
I found really tiny and cute oled i2c displays, but realised that this pullup detection will not work  if i hook it up on the same i2c bus. Maybe we need some other machanics for safe use of the motion controller. Or better use the other i2c bus which is hard to get if you solder the teensy above the extension board.
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on June 05, 2017, 05:41:15 AM
Btw havent followed the complete development, i decided to pull and merge latest commits from last week, and got really funky sound effect in the background
https://goo.gl/photos/MgFJeSp29F6PNvQQ9 (https://goo.gl/photos/MgFJeSp29F6PNvQQ9) :D
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 05, 2017, 09:13:38 AM
I found really tiny and cute oled i2c displays, but realised that this pullup detection will not work  if i hook it up on the same i2c bus. Maybe we need some other machanics for safe use of the motion controller. Or better use the other i2c bus which is hard to get if you solder the teensy above the extension board.

Wait, why won't the pullup detection work?
Also, the pullup detection is only there to make it more user-friendly, it's not actually *required*, so you could just comment it out.
Using the other port would pretty much guarantee that the different modules don't interfere with each other, but it shouldn't be needed.

Btw havent followed the complete development, i decided to pull and merge latest commits from last week, and got really funky sound effect in the background
http://goo.gl/photos/MgFJeSp29F6PNvQQ9 (http://goo.gl/photos/MgFJeSp29F6PNvQQ9) :D

It's probably the audio bug I introduced in 1.115 (bf23ac7930e4b6dda7ae20ca11119a00d645f86d) and fixed in 1.118 (f6fcac389a9a5bbd5046f2d6f24447de9ee1b820), just pull the latest changes and see if that fixes the problem.
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on June 06, 2017, 01:02:29 AM
Hmm I thought you need the pullup detection for something related specific to the motion sensor . Nevermind, still will be beter to use the other line as the motion chip will hold the bus occupied :)

Yay the latest commits fixed the audio issue. But now i notice a clipping effect / maybe its due to the high clash sensitivity.

There really should be some mechanism to make clashes more realistic (I doubt just filtering will be enough - i remember a stress hit causes a high and low peaks that can be detected)

Btw as I tend to solder the extention board above. So i solder the program button externally. Do you know any other way to invoke the teensy programming mode, that can be actually done via the software?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 06, 2017, 10:57:16 AM
Hmm I thought you need the pullup detection for something related specific to the motion sensor . Nevermind, still will be beter to use the other line as the motion chip will hold the bus occupied :)

The bus is really not occupied that much, but you're right, separate it still better.

Quote
Yay the latest commits fixed the audio issue. But now i notice a clipping effect / maybe its due to the high clash sensitivity.

Could be. Is the clipping just on the clash sounds?
Normally the clipping should be pretty much unnoticable.

Quote
There really should be some mechanism to make clashes more realistic (I doubt just filtering will be enough - i remember a stress hit causes a high and low peaks that can be detected)

Realistic? What does that even mean in this context?

Quote
Btw as I tend to solder the extention board above. So i solder the program button externally. Do you know any other way to invoke the teensy programming mode, that can be actually done via the software?

Normally you don't need the programming button, it should only be required in emergencies. (Like after a bad programming.)  The teensyduino USB code has some secret handshake stuff that is used to put the chip in programming mode, so normally you can upload a program by just pushing "upload" in the arduino IDE.

Both my finished sabers have programming buttons which are pretty hard to reach, but I have not needed them yet.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 06, 2017, 03:29:17 PM
Got a batch of 20 teensysaber boards today. :)
Sales will begin as soon as I have time to test them.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 06, 2017, 03:42:24 PM
Got a batch of 20 teensysaber boards today. :)
Sales will begin as soon as I have time to test them.

Wahoo:)!
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 09, 2017, 12:43:59 AM
So I upgraded a toy saber with a 6-segment LED string today. (Started yesterday.)
The thing only has one button, and I use that as a kill switch, so I had to add support for twist-on/off. (Currently only active if you define NUM_BUTTONS as 0)
Also, it was starting to feel cumbersome to not be able to have separate set of configurations for each saber, so I broke out most of the configuration stuff into a separate file, of which there are three right now. (One of each of my sabers.)
I've uploaded my changes to github and will upload to my site after some testing as usual.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 12, 2017, 10:44:58 AM
So I upgraded a toy saber with a 6-segment LED string today. (Started yesterday.)
The thing only has one button, and I use that as a kill switch, so I had to add support for twist-on/off. (Currently only active if you define NUM_BUTTONS as 0)
Also, it was starting to feel cumbersome to not be able to have separate set of configurations for each saber, so I broke out most of the configuration stuff into a separate file, of which there are three right now. (One of each of my sabers.)
I've uploaded my changes to github and will upload to my site after some testing as usual.
I saw the toy saber and that is pretty sweet. Putting new life into something is always nice. That is interesting... So a couple quick twists to the left or right and it will turn on or off. That is pretty nice idea.

Breaking out the config files will greatly help is changing code. And make it easier for students to tailor the code for their saber set up. Nicely done :)

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: BATMAnakin Skywalker on June 13, 2017, 03:07:38 AM
Wow, it's nice to see all the work you've done on this! I plan on making a teensysaber soon, as I've already got my blade made and a teensy I bought ages ago when I wanted to try making a saber with it, and then wanted to make one even more when I saw what you've done. The programming aspect sort of scares me away from finishing stuff like this, but I'm slowly getting there.

As for features that would be cool, I would want are bluetooth connectivity to a basic app for controlling the neopixels and typing in new parameters to the board from a phone. Also I think it would be amazing if there was something for controlling a power level indicator/accent LEDs/crystals- which leads me to my next thing: if you've got boards made (of which I'm interested in one of), I imagine the space saved is quite a bit, so that there would be room for a crystal chamber in this build now? I would love to take a crack at it if it can be done!
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 13, 2017, 09:02:05 AM
Wow, it's nice to see all the work you've done on this! I plan on making a teensysaber soon, as I've already got my blade made and a teensy I bought ages ago when I wanted to try making a saber with it, and then wanted to make one even more when I saw what you've done. The programming aspect sort of scares me away from finishing stuff like this, but I'm slowly getting there.

The programming is not so bad, at least if you start with one of the existing lightsaber code bases for teensys.

Quote
As for features that would be cool, I would want are bluetooth connectivity to a basic app for controlling the neopixels and typing in new parameters to the board from a phone.

Probably the right way to do that is to get a bluetooth le chip and hook it up to the RX3/TX3 on the teensy. Right now, all the neopixel stuff is controlled by code, not by parameters, so that would take some work, but is totally doable though.

Quote
Also I think it would be amazing if there was something for controlling a power level indicator/accent LEDs/crystals- which leads me to my next thing: if you've got boards made (of which I'm interested in one of), I imagine the space saved is quite a bit, so that there would be room for a crystal chamber in this build now? I would love to take a crack at it if it can be done!
It does save a lot of space. There might be enough space for a crystal chamber, it depends on the hilt and your skill.

I have some teensysaber V2 boards for sale here: TeensySaber V2 for sale (https://www.fx-sabers.com/forum/index.php?topic=51903.0)
The teensysaber V2 has room for three extra FETs on the bottom, which can be used to drive three accent LEDs (or one RGB led.)

A PLI indicator could be made in a few different ways. One way is to use a few small LEDs, another is to use a small neopixel strip, and finally, you could just hook up a small LCD, oled or e-ink display...

Basically I think everything you want is doable, but some is a lot more work than others... :)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 14, 2017, 04:49:28 PM

As for features that would be cool, I would want are bluetooth connectivity to a basic app for controlling the neopixels and typing in new parameters to the board from a phone.

Probably the right way to do that is to get a bluetooth le chip and hook it up to the RX3/TX3 on the teensy. Right now, all the neopixel stuff is controlled by code, not by parameters, so that would take some work, but is totally doable though.

A bluetooth board like this might work if you have enough space in the hilt:
SparkFun Bluetooth Mate Gold - WRL-12580 - SparkFun Electronics (https://www.sparkfun.com/products/12580)
Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 14, 2017, 06:35:26 PM
Just an idea for a slight change/improvement to the Teensy Saber software.  I think it would be great to have an option to use a double-tap of the "pow" or "aux" button (instead of a single press) to turn on and off the blade.  This would help avoid accidentally turning off (or on) the blade while handling the saber.

Let me know what you think.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 14, 2017, 07:11:45 PM
Just an idea for a slight change/improvement to the Teensy Saber software.  I think it would be great to have an option to use a double-tap of the "pow" or "aux" button (instead of a single press) to turn on and off the blade.  This would help avoid accidentally turning off (or on) the blade while handling the saber.

Let me know what you think.

Might be a good idea, especially when using touchbuttons. Originally I didn't implement double-clicks because it would require a delay on single clicks, but if single clicks don't do anything, then that is not a problem...
Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 15, 2017, 05:13:52 PM
Just another quick question... There's no issue with shortening the LED strip blade by reducing the number of LEDs, correct?  All I would need to do is reflect the matching number of LEDs in the BladeConfig blades[] section, correct?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 15, 2017, 05:20:34 PM
Just another quick question... There's no issue with shortening the LED strip blade by reducing the number of LEDs, correct?  All I would need to do is reflect the matching number of LEDs in the BladeConfig blades[] section, correct?

Correct.
Title: Re: TeensySaber Software Discussion
Post by: BATMAnakin Skywalker on June 16, 2017, 02:28:36 AM

As for features that would be cool, I would want are bluetooth connectivity to a basic app for controlling the neopixels and typing in new parameters to the board from a phone.

Probably the right way to do that is to get a bluetooth le chip and hook it up to the RX3/TX3 on the teensy. Right now, all the neopixel stuff is controlled by code, not by parameters, so that would take some work, but is totally doable though.

A bluetooth board like this might work if you have enough space in the hilt:
SparkFun Bluetooth Mate Gold - WRL-12580 - SparkFun Electronics (https://www.sparkfun.com/products/12580)


Awesome! I shall get one of these when I start the build.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 16, 2017, 12:30:33 PM
I wonder if there is a smaller version of this somewhere:

NeoPixel Stick - 8 x 5050 RGB LED with Integrated Drivers ID: 1426 - .95 : (https://www.adafruit.com/product/1426)

It would make a wonderful PLI thingy if it wasn't quote so big.
Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 17, 2017, 06:46:22 PM
I am trying to compile v1.119 for the Teensy 3.5 and I'm getting the following errors...

lightsaber-1.119.ino: In constructor 'TouchButton::TouchButton(int, int, const char*)':
lightsaber-1.119.ino:9473:9: error: 'pin2tsi' was not declared in this scope
     if (pin2tsi[pin_] == 255) {
         ^
lightsaber-1.119.ino: In member function 'virtual void TouchButton::Loop()':
lightsaber-1.119.ino:9522:22: error: 'pin2tsi' was not declared in this scope
         int32_t ch = pin2tsi[pin_];
                      ^
lightsaber-1.119.ino:9527:9: error: 'TSI0_GENCS' was not declared in this scope
         TSI0_GENCS = 0;
         ^
lightsaber-1.119.ino:9528:9: error: 'TSI0_PEN' was not declared in this scope
         TSI0_PEN = (1 << ch);
         ^
lightsaber-1.119.ino:9529:9: error: 'TSI0_SCANC' was not declared in this scope
         TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);
         ^
lightsaber-1.119.ino:9529:41: error: 'TSI_SCANC_REFCHRG' was not declared in this scope
         TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);
                                         ^
lightsaber-1.119.ino:9529:63: error: 'CURRENT' was not declared in this scope
         TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);
                                                               ^
lightsaber-1.119.ino:9529:70: error: 'TSI_SCANC_EXTCHRG' was not declared in this scope
         TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);
                                                                      ^
lightsaber-1.119.ino:9530:37: error: 'NSCAN' was not declared in this scope
         TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;
                                     ^
lightsaber-1.119.ino:9530:42: error: 'TSI_GENCS_NSCN' was not declared in this scope
         TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;
lightsaber-1.119.ino:9530:59: error: 'PRESCALE' was not declared in this scope
         TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;
                                                           ^
lightsaber-1.119.ino:9530:67: error: 'TSI_GENCS_PS' was not declared in this scope
         TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;
                                                                   ^
lightsaber-1.119.ino:9530:71: error: 'TSI_GENCS_TSIEN' was not declared in this scope
         TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;
                                                                       ^
lightsaber-1.119.ino:9530:89: error: 'TSI_GENCS_SWTS' was not declared in this scope
         TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;
                                                                                         ^
lightsaber-1.119.ino:9539:14: error: 'TSI0_GENCS' was not declared in this scope
       while (TSI0_GENCS & TSI_GENCS_SCNIP) YIELD();
              ^
lightsaber-1.119.ino:9539:27: error: 'TSI_GENCS_SCNIP' was not declared in this scope
       while (TSI0_GENCS & TSI_GENCS_SCNIP) YIELD();
                           ^
lightsaber-1.119.ino:9544:39: error: 'TSI0_CNTR1' was not declared in this scope
       Update(*((volatile uint16_t *)(&TSI0_CNTR1) + (pin2tsi[pin_])));
                                       ^
lightsaber-1.119.ino:9544:54: error: 'pin2tsi' was not declared in this scope
       Update(*((volatile uint16_t *)(&TSI0_CNTR1) + (pin2tsi[pin_])));
                                                      ^

The same code compiles fine when I select the Teensy 3.2 board. 

I haven't been able to figure out why.  Any ideas?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 17, 2017, 07:40:08 PM
I am trying to compile v1.119 for the Teensy 3.5 and I'm getting the following errors...

....

The same code compiles fine when I select the Teensy 3.2 board. 

I haven't been able to figure out why.  Any ideas?

The Teensy 3.5 doesn't support touch buttons, and it would seem my code doesn't like that.
I will fix it.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 18, 2017, 12:30:52 PM
So this is now what happens if you boot up a teensysaber without an SD card:



Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 18, 2017, 12:51:38 PM
I am trying to compile v1.119 for the Teensy 3.5 and I'm getting the following errors...

....

The same code compiles fine when I select the Teensy 3.2 board. 

I haven't been able to figure out why.  Any ideas?

The Teensy 3.5 doesn't support touch buttons, and it would seem my code doesn't like that.
I will fix it.

The version on github should now compile on Teensy 3.5.
I will be uploading to my site in a few days or so.
Note that the new version is split up into multiple files.

Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 18, 2017, 01:35:19 PM
So this is now what happens if you boot up a teensysaber without an SD card:



That is a nice addition. I have forgot to put my SD card in a couple times so that will help :)

Great work.

How is the testing of the Teensyduino beta going ? Is the MTP working out as expected ?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 19, 2017, 12:32:26 PM
I have a question, in the code how do I change the sensitivity of the clash? In my students saber, we have secured the chassis, nothing is moving or shaking, every time we swing soft it will swing. But if we swing it harder it will clash instead. I thought the chassis would be moving but we have secured it in several places fixing that issue.

It is the first time I have done the V2 electronics so maybe I need to redesign the chassis for them... Which I am currently doing. Will make it easier to program as the whole back half will come out leaving the button assembly in place.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 19, 2017, 12:44:22 PM
I have a question, in the code how do I change the sensitivity of the clash? In my students saber, we have secured the chassis, nothing is moving or shaking, every time we swing soft it will swing. But if we swing it harder it will clash instead. I thought the chassis would be moving but we have secured it in several places fixing that issue.

It is the first time I have done the V2 electronics so maybe I need to redesign the chassis for them... Which I am currently doing. Will make it easier to program as the whole back half will come out leaving the button assembly in place.

Regards,

GMcIvor

The V2 seems to be more sensitive than the V1 for some reason. Maybe because it samples at a higher speed?
Either way, the threshold lives in Saber::SB_Accel, in a line that looks like this:
Code: [Select]
if ( (accel_ - accel).len2() > 1.0) {

The 1.0 is the limit in g squared. Try a higher value, like maybe 2.0 ?
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 19, 2017, 12:49:09 PM
I have a question, in the code how do I change the sensitivity of the clash? In my students saber, we have secured the chassis, nothing is moving or shaking, every time we swing soft it will swing. But if we swing it harder it will clash instead. I thought the chassis would be moving but we have secured it in several places fixing that issue.

It is the first time I have done the V2 electronics so maybe I need to redesign the chassis for them... Which I am currently doing. Will make it easier to program as the whole back half will come out leaving the button assembly in place.

Regards,

GMcIvor

The V2 seems to be more sensitive than the V1 for some reason. Maybe because it samples at a higher speed?
Either way, the threshold lives in Saber::SB_Accel, in a line that looks like this:
Code: [Select]
if ( (accel_ - accel).len2() > 1.0) {

The 1.0 is the limit in g squared. Try a higher value, like maybe 2.0 ?

I will give that a try, thank you!



Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on June 19, 2017, 01:44:54 PM
Well I had to change it to 3 and it was alot better, still happens now and again. She is super happy now.

Thank you :)

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 20, 2017, 10:26:30 AM
TeensyDuino 1.37 has just been released, which adds "MTP Disk (experimental)" in the USB type menu.
Using this option will enable MTP in TeensySaber and let you upload/download files to the SD card without removing it.
It should work without any extra drivers on Windows and Linux, but may require some extra installs on Mac.
I know a few people are using the serial flash chip on the prop shield instead of an SD card. Currently the MTP code does not support uploading/downloading to the serialflash chip, but I intend to fix that.
Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 20, 2017, 10:40:10 AM
The version on github should now compile on Teensy 3.5.
I will be uploading to my site in a few days or so.
Note that the new version is split up into multiple files.

I pulled the version from github and spent some time tailoring it.  I was able to get it to compile and load to my Teensy 3.5 electronics.  I do however have an issue.  When I signal a power off of the blade my "pwroff01.wav" file does not play.  Power on, hum, clash, swing, etc. all seem to work but power off doesn't.

Please note I am testing this on a bench with NO blade connected.  I don't even have the N-channel MOSFETs attached yet.  I'm not sure that this would make a difference.

Based on the sound playing I can obviously access the SDcard and the soundfont loaded under folder "font1".  I can even play the "font1/pwroff01.wav" file through the Serial Monitor commands but it doesn't play when I power off (even using the "pow" command). 
Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 20, 2017, 10:54:15 AM
The version on github should now compile on Teensy 3.5.
I will be uploading to my site in a few days or so.
Note that the new version is split up into multiple files.
I found I still needed to tailor some items in the main lightsaber.ino file so I decided to do a little work to make these remaining items options in the "config" header file. Here's what I changed to enable the builtin SD on the Teensy 3.5...
#ifdef ENABLE_BUILTIN_SDCARD
  sdCardSelectPin = BUILTIN_SDCARD,  // SD card chip (sd card adapter)
                                     // Set to BUILTIN_SDCARD for Teensy 3.5/3.6
                                     // (See File->Example->SD->ReadWrite for
                                     // other possible values.)
#else
  sdCardSelectPin = 0,
#endif

I then added the following to the "config" header file...
// If you are using a Teensy 3.5/3.6 built-in SD card reader define this.
#define ENABLE_BUILTIN_SDCARD 

While I was in the saber pins section I noticed a comment about the Wiz820+SD so I made the following change...
#ifdef ENABLE_WIZ820SD
  freePin4 = sdCardSelectPin,     // FREE (make this sdCardSelectPin if you're using a Wiz820+SD shield)
#else
  freePin4 = 4,                   // FREE (make this sdCardSelectPin if you're using a Wiz820+SD shield)
#endif

and I added the following to the "config" header file...
// If you are using a Wiz820+SD uncomment the #define ENABLE_WIZ820SD
// #define ENABLE_WIZ820SD

I then added the following to support specifying a different value for the external pullup resistor in your v1 electronics...
#if VERSION_MAJOR >= 2
    float pulldown = 220000;  // External pulldown
    float pullup = 2000000;  // External pullup
#else
    float pulldown = 33000;  // Internal pulldown is 33kOhm
#ifdef EXTERNAL_PULLUP_VALUE
    float pullup = EXTERNAL_PULLUP_VALUE;  // External pullup value from config header file
#else
    float pullup = 23000;  // External pullup
#endif
#endif

and the following to the "config" header file...
// If you are using an external pullup resistor value other that 23K on your v1 electronics, define the value here.
// #define EXTERNAL_PULLUP_VALUE yourvaluehere

Let me know what you think.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 20, 2017, 11:31:55 AM
I don't want to put too much in the config files, so uncommon configuration options should probably still require changing lightsaber.ino.
Of the changes you listed, I think the WIZ820SD definitely falls into that category.
As for the sd card change, I've been considering ways to add some ways to override the pin map in the config file, so that you could change things in the pin map *if you want to*.  Using ifdefs for every possible pin map is probably going to make the code really hard to read. However, until I've figure out the right way to do that, ENABLE_BUILTIN_SDCARD might be an ok solution. Maybe the simplest option would be to just move the pin map to the config file...

Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 20, 2017, 12:03:17 PM
I don't want to put too much in the config files, so uncommon configuration options should probably still require changing lightsaber.ino.
Of the changes you listed, I think the WIZ820SD definitely falls into that category.
As for the sd card change, I've been considering ways to add some ways to override the pin map in the config file, so that you could change things in the pin map *if you want to*.  Using ifdefs for every possible pin map is probably going to make the code really hard to read. However, until I've figure out the right way to do that, ENABLE_BUILTIN_SDCARD might be an ok solution. Maybe the simplest option would be to just move the pin map to the config file...

I was looking at it from the perspective of trying to avoid modifying the main lightsaber.ino file each time you release a new version.  I would think the main options should be housed in the "config" file while those odd, "one offs" could stay in the main code.  This would include the things that would change if you were running on different Teensy boards, etc.  I also included the external pullup resistor because I ended up using a 22K resistor instead of a 23K and I took a reading on them before installing them.  I ended up with a value of 21,800 which was enough of a difference to throw off the battery level values.  I would also think things like sound volume and sensitivity settings for clash and swing should be something that can be specified in the config file.

Just my humble opinion.   :grin:

Oh and btw... nice work on the voice coding.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 20, 2017, 12:36:31 PM
I don't want to put too much in the config files, so uncommon configuration options should probably still require changing lightsaber.ino.
Of the changes you listed, I think the WIZ820SD definitely falls into that category.
As for the sd card change, I've been considering ways to add some ways to override the pin map in the config file, so that you could change things in the pin map *if you want to*.  Using ifdefs for every possible pin map is probably going to make the code really hard to read. However, until I've figure out the right way to do that, ENABLE_BUILTIN_SDCARD might be an ok solution. Maybe the simplest option would be to just move the pin map to the config file...

I was looking at it from the perspective of trying to avoid modifying the main lightsaber.ino file each time you release a new version.  I would think the main options should be housed in the "config" file while those odd, "one offs" could stay in the main code.  This would include the things that would change if you were running on different Teensy boards, etc.  I also included the external pullup resistor because I ended up using a 22K resistor instead of a 23K and I took a reading on them before installing them.  I ended up with a value of 21,800 which was enough of a difference to throw off the battery level values.  I would also think things like sound volume and sensitivity settings for clash and swing should be something that can be specified in the config file.

Just my humble opinion.   :grin:

Oh and btw... nice work on the voice coding.

Yeah, we're basically agreeing. I just want to make sure we keep the config files short and easy to use as well.
And I totally agree that sensitivity settings should be in the config file.
I will be incorporating all of these changes (except for the wiz820sd change) into the code.
(And I might try to do something else for the sd card pin.)

Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 20, 2017, 01:57:26 PM
I pulled the version from github and spent some time tailoring it.  I was able to get it to compile and load to my Teensy 3.5 electronics.  I do however have an issue.  When I signal a power off of the blade my "pwroff01.wav" file does not play.  Power on, hum, clash, swing, etc. all seem to work but power off doesn't.

Please note I am testing this on a bench with NO blade connected.  I don't even have the N-channel MOSFETs attached yet.  I'm not sure that this would make a difference.

Based on the sound playing I can obviously access the SDcard and the soundfont loaded under folder "font1".  I can even play the "font1/pwroff01.wav" file through the Serial Monitor commands but it doesn't play when I power off (even using the "pow" command).

I'm not sure if you saw this earlier post.  For some reason I can't get the "power off" sound to work with the latest commit on github.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 20, 2017, 02:25:52 PM
I pulled the version from github and spent some time tailoring it.  I was able to get it to compile and load to my Teensy 3.5 electronics.  I do however have an issue.  When I signal a power off of the blade my "pwroff01.wav" file does not play.  Power on, hum, clash, swing, etc. all seem to work but power off doesn't.

Please note I am testing this on a bench with NO blade connected.  I don't even have the N-channel MOSFETs attached yet.  I'm not sure that this would make a difference.

Based on the sound playing I can obviously access the SDcard and the soundfont loaded under folder "font1".  I can even play the "font1/pwroff01.wav" file through the Serial Monitor commands but it doesn't play when I power off (even using the "pow" command).

I'm not sure if you saw this earlier post.  For some reason I can't get the "power off" sound to work with the latest commit on github.

Sorry, missed it before.
I think maybe you want the "poweroff" sound. If I remember correctly "pwroff" is meant to be the opposite of the "boot" sound, and is not supported. (Although I suppose it could be supported with a large enough capacitor somewhere....)

Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 20, 2017, 06:19:36 PM
Sorry, missed it before.
I think maybe you want the "poweroff" sound. If I remember correctly "pwroff" is meant to be the opposite of the "boot" sound, and is not supported. (Although I suppose it could be supported with a large enough capacitor somewhere....)

That worked but is opposite of how it worked with the Serial Flash on the Prop Shield.  With my Teensy 3.2 / Prop Shield set up the pwroff01.wav played when powering off the blade and poweroff.wav didn't play.  It's not a big deal but I thought you should be aware.

Thanks for your support.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 20, 2017, 07:25:50 PM
Sorry, missed it before.
I think maybe you want the "poweroff" sound. If I remember correctly "pwroff" is meant to be the opposite of the "boot" sound, and is not supported. (Although I suppose it could be supported with a large enough capacitor somewhere....)

That worked but is opposite of how it worked with the Serial Flash on the Prop Shield.  With my Teensy 3.2 / Prop Shield set up the pwroff01.wav played when powering off the blade and poweroff.wav didn't play.  It's not a big deal but I thought you should be aware.

Thanks for your support.

Actually, it seems like poweroff and pwroff are really supposed to be part of the same set of effects and chosen randomly. (I should fix that.)
However, as far as I can tell, teensysaber has always played "poweroff*.wav", never "pwroff*.wav".

 
Title: Re: TeensySaber Software Discussion
Post by: Whosle on June 22, 2017, 10:33:41 AM
Hi Profezzorn,

  I hate to be that guy, but I need someone to help me understand the scope of my ignorance.  I am able to follow nearly everything on your instructions for V1.  Until, I get to the actual reading of the code and trying to understand what I am supposed to actually alter. It took me a good 10 minutes to find the blade array, and it still looks like Greek to me!

 I need to know how over my head I am, and then learn accordingly. I know I should crawl before I run a marathon, but I was hoping that I could alter the details and learnt how to  customize everything after I loaded your sketch.  I would be pretty smitten with all the functionality as demonstrated on your video.
   Currently I have it on a breadboard , and I am using almost the exact components you have, except I have an adafruit 5v ready sd card adapter (its huge). I hope to eventually complete another build with a teensy 3.6.



1) Is the sketch a "template"? I see so many open/close brackets and parenthesis my mind is tellimg me that I need to be filling in these spots... Or Can I just upload the sketch and it will work?

2) If I follow your steps exactly and use the same resistors as you have in the diagrams, can I more or less just " plug and play"?  I am testing with a RGB tri cree currently, but I have the other blades being constructed (same as yours).

3) The blades array, are all the blades described in the diagrams already in the sketch ? I Can't tell if I am supposed to build my own array(s). EDIT: I looked a bit longer, and now I understand the struct/ array descriptions in the code.

4) Do you upload the sketch before you solder it all together?  Does everything need to be connected in place before I upload the sketch?

  I think that is all for now, I will try my best not to ask too many basic questions after this. Your documentation and instructions are great, and usually If I stare at something long enough, it starts to make sense. I just need a little push in the right direction.

Thanks


 
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 22, 2017, 11:27:03 AM
Hi Profezzorn,

  I hate to be that guy, but I need someone to help me understand the scope of my ignorance.  I am able to follow nearly everything on your instructions for V1.  Until, I get to the actual reading of the code and trying to understand what I am supposed to actually alter. It took me a good 10 minutes to find the blade array, and it still looks like Greek to me!


The good news is that in the next version of the code, the blades array will be in a separate config file and should be much easier to find.

Quote
I need to know how over my head I am, and then learn accordingly. I know I should crawl before I run a marathon, but I was hoping that I could alter the details and learnt how to  customize everything after I loaded your sketch.  I would be pretty smitten with all the functionality as demonstrated on your video.

If you can operate a text editor, you really shouldn't be that far from figuring out how to configure the blades array.
It may look like greek, but it's really not that hard, and I don't mind helping.

Quote
Currently I have it on a breadboard , and I am using almost the exact components you have, except I have an adafruit 5v ready sd card adapter (its huge). I hope to eventually complete another build with a teensy 3.6.

1) Is the sketch a "template"? I see so many open/close brackets and parenthesis my mind is tellimg me that I need to be filling in these spots... Or Can I just upload the sketch and it will work?

It's not a template, but you will need to change a few things, as the sketch is configured for a V2.3 board by default.
The minimum you'll need to change is the VERSION_MAJOR and VERSION_MINOR defines, they should be 1 and 0 instead of 2 and 3.
You'll probably also need to change the blades and preset arrays to match the blades and sound fonts you have.

Quote
2) If I follow your steps exactly and use the same resistors as you have in the diagrams, can I more or less just " plug and play"?  I am testing with a RGB tri cree currently, but I have the other blades being constructed (same as yours).

Yes, assuming you put sound fonts in the same locations on the sound card.
But you really shouldn't worry about making it exactly the same as me, changing the blades array to match what you have really is easy.

Quote
3) The blades array, are all the blades described in the diagrams already in the sketch ? I Can't tell if I am supposed to build my own array(s).

The blades array actually contains the blades that I have, and is meant to be an example of what the blades arryay can look like.
While matching your blades to mine means you don't have to change it, that's not really the intention.

Quote
4) Do you upload the sketch before you solder it all together?  Does everything need to be connected in place before I upload the sketch?

Either way.
The sketch won't really work well until motion and sd card is connected, but you can upload it at any time.
Just make sure you cut VIN/VUSB on the teensy. Once that's done, you'll need battery power to upload new sketches.

Quote
  I think that is all for now, I will try my best not to ask too many basic questions after this. Your documentation and instructions are great, and usually If I stare at something long enough, it starts to make sense. I just need a little push in the right direction.

Thanks

Don't worry about it, the more questions you ask, the better the instructions will become! :)
Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on June 24, 2017, 07:46:16 AM
I recently obtained several soundfont sets that all have *.lsu files.  Are these files supported by the Teensy Saber code?  If not, what would you recommend I convert them to in order to use them?

Also, can you explain the difference between monophonic and polyphonic soundfonts?  If I'm going to convert sounds from say lsu to wav are there settings I should use to make them polyphonic vs. monophonic?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 24, 2017, 10:35:29 AM
I recently obtained several soundfont sets that all have *.lsu files.  Are these files supported by the Teensy Saber code?  If not, what would you recommend I convert them to in order to use them?

Also, can you explain the difference between monophonic and polyphonic soundfonts?  If I'm going to convert sounds from say lsu to wav are there settings I should use to make them polyphonic vs. monophonic?

TeensySaber should be able to play the lsu files directly. (They really are just RAW audio files.)
However, the LSU files don't have any sort of consistent naming scheme, so you have to rename the files, or teensysaber will not be able to find them.
(See the "sound effect filenames" section on this page (http://fredrik.hubbe.net/lightsaber/teensy_saber.html).)

I think LSU-based sound fonts are monophonic (meaning that only one sound play at a time, so the hum is mixed in with the sound effects.) Polyphonic sound fonts do not have the hum mixed in, so the sound board has to play the hum and the effect at the same time. Teensysaber uses the name of the files to determine if a font is polyphonic or monophonic, there are no settings.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on June 30, 2017, 08:05:34 PM
New software update: 1.144


PS: TeensySaber V2 for sale (https://www.fx-sabers.com/forum/index.php?topic=51903.0)


Title: Re: TeensySaber Software Discussion
Post by: Obi-Ken Wanobi on July 07, 2017, 08:27:37 PM
New software update: 1.144

  • MTP now works with SerialFlash for V1 builds.

Is there anything special I would need to do to support MTP with the PropShield SerialFlash on my V1 saber besides the #define ENABLE_SERIALFLASH statement?

Will MTP support allow me to create folders on the SerialFlash (which is not supported using Teensytransfer)?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 07, 2017, 09:34:37 PM
New software update: 1.144

  • MTP now works with SerialFlash for V1 builds.

Is there anything special I would need to do to support MTP with the PropShield SerialFlash on my V1 saber besides the #define ENABLE_SERIALFLASH statement?

Will MTP support allow me to create folders on the SerialFlash (which is not supported using Teensytransfer)?


No, nothing special. All you should need is ENABLE_SERIALFLASH and select "MTP disk (experimental)" in the usb type menu.
It will not let you make folders though. Folders are not supported by the SerialFlash library.

Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 09, 2017, 09:43:04 AM
Hello Again,

  I have had moderate success with putting the unit together.

Serial monitor works, but there are some issues.

1) When SD card is inserted, it gets stuck reading font03 and pretty much bricks the teensy. (serial monitor won't update after scanning font03 comes up) I have tried two different soundcards, and re-sampled the sound to mono 44100. When I open the wav in audacity, it always says its at 32 bit float. At this point I am about to try a different SD card reader. This is the sd card reader I am using now, I have it connected to 5v pad.
 MicroSD card breakout board+ ID: 254 - .50 : Adafruit Industries, Unique & fun (https://www.adafruit.com/product/254)
My soundfonts directories are seperated out on sd card by: sdcard/font01
sdcard/font02
etc... There is a tracks directory in every font directory.

2) The top ID line sends out random data that is different everytime. I changed the float pullup to match my resistor (100k ohm). Currently my ID line is as follows: ID 687 volts 2.21 resistance=67272.98[/b]

3) Blade=7 simple blade changes even though I have the charging blade in. Sometimes it says blade=0 ws2811 blade with 81 Leds.
Are my resistors to blame? (alicrappa special) . I have matched the resistor values in the code.

4) Battery voltage seems ok. I had wrong pullup intially and burnt out a couple neopixels.

5) Is there a turorial on how to flash sounds to the teensy memory? and what format?
Beep and pow commands work on my simple string blade and my charging plug.

6) I can only talk to my teensy through the serial monitor if I upload a sketch. I cannot unplug it and plug it back in again, even with reset button etc. Not a huge issue, just wondering if it happens to others.

I will most likely download the  new version to try out the new serial flash menu.

At this point I am about to change out the SD card reader, but I want to test the sound via teensy serial first.

I am pretty happy I at least got it talking through the serial!

If there are formatting issues for these questions I ask, and you would like me to improve it for ease of reading, let me know.
Thanks again,
 
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 09, 2017, 10:24:37 AM
Hello Again,

  I have had moderate success with putting the unit together.

Serial monitor works, but there are some issues.

1) When SD card is inserted, it gets stuck reading font03 and pretty much bricks the teensy. (serial monitor won't update after scanning font03 comes up) I have tried two different soundcards, and re-sampled the sound to mono 44100. When I open the wav in audacity, it always says its at 32 bit float. At this point I am about to try a different SD card reader. This is the sd card reader I am using now, I have it connected to 5v pad.
 MicroSD card breakout board+ ID: 254 - .50 : Adafruit Industries, Unique & fun (https://www.adafruit.com/product/254)
My soundfonts directories are seperated out on sd card by: sdcard/font01
sdcard/font02
etc... There is a tracks directory in every font directory.
I usually have the tracks directory in the root folder of the sdcard. If you have it in the font directory, you'll need to put names like "font01/tracks/march.wav" in the preset array, but that should work just fine.

I haven't tried using that SD card reader myself, but I don't see a reason why it wouldn't work. I assume that you have CS connected to pin 0?
The kind of problems you're having sounds a lot like what happens when the SD card isn't connected correctly.

You can try commenting out #define ENABLE_SDCARD and see if it works better.

Quote
2) The top ID line sends out random data that is different everytime. I changed the float pullup to match my resistor (100k ohm). Currently my ID line is as follows: ID 687 volts 2.21 resistance=67272.98[/b]

This can happen right after re-programming because neopixels have little capacitors in them which push some of the
current back down. It usually works better when the circuit is unpowered before the blade is connected.
Not sure why you would change the pullup resistor though. In a V1 configuration, the pullup resistor is internal (meaning that it's inside the teensy).

Quote
3) Blade=7 simple blade changes even though I have the charging blade in. Sometimes it says blade=0 ws2811 blade with 81 Leds.
Are my resistors to blame? (alicrappa special) . I have matched the resistor values in the code.

No, probably the neopixels are to blame. (I assume you have one in your charging blade, is that correct?)
I recommend using fairly small (a few Kohm) blade ID resistors for neopixel blades.

Quote
4) Battery voltage seems ok. I had wrong pullup intially and burnt out a couple neopixels.

Eh? Not sure how you can burn neopixels by having the wrong pullup...

Quote
5) Is there a turorial on how to flash sounds to the teensy memory? and what format?
Beep and pow commands work on my simple string blade and my charging plug.

Generally, the sounds go on the SD card.
If you have a prop shield, you can also put them on the serialflash memory on the prop shield.
With the latest teensysaber software, you should be able to just drag-n-drop files onto the serialflash, assuming you have the latest teensyduino software and choose "MTP disk (experimental)" for USB type.

Quote
6) I can only talk to my teensy through the serial monitor if I upload a sketch. I cannot unplug it and plug it back in again, even with reset button etc. Not a huge issue, just wondering if it happens to others.

That's kind of weird.
Pushing the reset button puts the teensy in programming mode, so you won't be able to talk to it until you either program it or disconnect it from power and plug it in again, so that part is not so weird.

Quote
I will most likely download the  new version to try out the new serial flash menu.

At this point I am about to change out the SD card reader, but I want to test the sound via teensy serial first.

I am pretty happy I at least got it talking through the serial!

If there are formatting issues for these questions I ask, and you would like me to improve it for ease of reading, let me know.
Thanks again,

A little more context would help, as it seems that your build isn't the same as mine.
Also, pictures is always a good idea.
Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 09, 2017, 04:17:25 PM
Profezzorn,

Thank you for the quick reply.

Quote
   I haven't tried using that SD card reader myself, but I don't see a reason why it wouldn't work. I assume that you have CS connected to pin 0?
The kind of problems you're having sounds a lot like what happens when the SD card isn't connected correctly.
 

  I have CS connected to pin 0. I tried hooking it up to 3v pad, with no luck. Adafruit says short wires are Ideal, so I will try that before I break down and purchase the same sd card reader from PJRC. (Unless you have an extra one you can sell me one along with a teensy saber V2!). :smiley:

Quote
In a V1 configuration, the pullup resistor is internal (meaning that it's inside the teensy).
I changed the external float pullup as described by your tutorial, you have a 23 k ohm, I used a 100 K ohm. Did I misread \misunderstood this?

Quote
Eh? Not sure how you can burn neopixels by having the wrong pullup...

My hair-brained theory as to why I popped 2 8mm strawhat neopixels (near end of blade), is that I had 10 k ohm in the code when I actually had 100 k ohm.This gave a false voltage reading on battery. The red and orange stripes on the resistors are tough to differentiate in my basement lab. I swore a few times when I saw it in daylight.

I have 4 pics online on my deviantart profile. I hope it's not too weird to link to it, since  photobucket went paywall/ransomware.

Whosle (J H) | DeviantArt (http://whosle.deviantart.com/)

Teensy Saber by Whosle on DeviantArt (http://whosle.deviantart.com/art/Teensy-Saber-691525852)

Teensy Saber by Whosle on DeviantArt (http://whosle.deviantart.com/art/Teensy-Saber-691525667)
 
My biggest concern now , I used a couple of cheap wires to help with color coding. The green, blue and yellow wires all have fairly brittle copper strands.

Let me know if you want more pics to see my build. I have nearly the same ingredients, I am using a protected 3.7v for testing, before I move on to the (repected!) Samsung unprotected one you linked on your page.

I have an microusb charger card in the charging blade setup.

Thanks.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 09, 2017, 04:58:55 PM
Profezzorn,

Thank you for the quick reply.

I have CS connected to pin 0. I tried hooking it up to 3v pad, with no luck. Adafruit says short wires are Ideal, so I will try that before I break down and purchase the same sd card reader from PJRC. (Unless you have an extra one you can sell me one along with a teensy saber V2!). :smiley:


I do actually have an extra PJRC sd card adapter which I can sell to you.
Of course, if you use the TeensySaberV2, you won't need it. :)

Try shorter wires, it actually matters. (Also double-check your wiring, I have mixed up din/dout more times than I care to admit...)
I'd check it for you, but I can't see what is hooked up to what from the pictures.
You might also want to try one the sd card example sketches to just try the sd card by itself.
Last, but not least, please try commenting out #define ENABLE_SD It's not a permanent solution, but if it works without the sd card, then the problem is definitely with the sd card. :)

Quote

My hair-brained theory as to why I popped 2 8mm strawhat neopixels (near end of blade), is that I had 10 k ohm in the code when I actually had 100 k ohm.This gave a false voltage reading on battery. The red and orange stripes on the resistors are tough to differentiate in my basement lab. I swore a few times when I saw it in daylight.


I only know of three ways to burn neopixels: 1) reverse the voltage  2) solder them too hot 3) over-voltage (which should be impossible with a 3.7v battery.)


Quote
I have 4 pics online on my deviantart profile. I hope it's not too weird to link to it, since  photobucket went paywall/ransomware.

Anytyhing is better than photobucket.

Quote

Whosle (J H) | DeviantArt (http://whosle.deviantart.com/)

Teensy Saber by Whosle on DeviantArt (http://whosle.deviantart.com/art/Teensy-Saber-691525852)

Teensy Saber by Whosle on DeviantArt (http://whosle.deviantart.com/art/Teensy-Saber-691525667)
 
My biggest concern now , I used a couple of cheap wires to help with color coding. The green, blue and yellow wires all have fairly brittle copper strands.

I like using ribbon cable, then I tear off as many wires as I need. The bundles are much easier to keep track of than individual cables.

Quote
Let me know if you want more pics to see my build. I have nearly the same ingredients, I am using a protected 3.7v for testing, before I move on to the (repected!) Samsung unprotected one you linked on your page.

I have an microusb charger card in the charging blade setup.

Thanks.

Looks like you don't have a resistor between the neopixel data line and the connector though. 100-300ohm is usually recommended and may help stabilize the blade ID thingy.

Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 09, 2017, 07:35:53 PM
Profezzorn,

 I failed to mention that when the sdcard isn't inserted, the sketch moves forward and I can access help menu etc.

If I try the CD command it gets stuck on reading font03.
 
I will try everything you suggested and triple check my wiring.

Quote
I do actually have an extra PJRC sd card adapter which I can sell to you.
Of course, if you use the TeensySaberV2, you won't need it. :)

I will get back to you on the next 2 days on the teensysaber V2 after these next few tries. Local shop just picked up more teensy3.2. I have a 3.6 and another prop shield which I was planning on starting after this one (seemed easier),that was before reading your release notes on new software, I am thinking about starting it.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 09, 2017, 09:08:32 PM
Profezzorn,

I failed to mention that when the sdcard isn't inserted, the sketch moves forward and I can access help menu etc.

If I try the CD command it gets stuck on reading font03.
 
I will try everything you suggested and triple check my wiring.

Guess there is no need to comment out ENABLE_SD then, as we already know that's the problem.
First of all, make sure you run the last version of the TeensySaber software, it has some bugfixes that may be relevant.
Second, try renaming "font03" on the sd card, or change the preset array so that the font isn't found. Then try typing "dir" in the serial monitor.

Basically, there are three things that could be going wrong:
1. There is something wrong with the SD card itself. (either corruption, or maybe it's exfat or something that the SD library doesn't understand.) Maybe try a different card or an empty sd card.
2. Signalling problems, either the wires are too long, or not hooked up correctly. Signalling problems will usually cause hangs, but they can be
   somewhat random.
3. Playback problems: After scanning the directory, it will try to play the "boot" sound, if this crashes, we could end up with the same type of problem. If you delete the boot sounds, you should be able to rule this out.
Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 10, 2017, 06:39:41 PM
  Back again with some more info.

  I tried a new sd card and sd card reader, no luck.

 Shortened the wires, no luck. Strange thing is, when the teensy boots up and flashes orange SMD, the card reader activity light also lights up.

  I have upgraded to your new software. Now it gets stuck on font01. Rebooting without a card gets me robot voice! So cool.

 Without an SD card, PWD brings back font01/ but DIR shows no files.

If I try and plug in an SD card and try Next Pre , robot voice says an error, which is difficult to make out.



I am having trouble with MTP. My computer shows an SD directory (without sd card inserted) and a serial flash directory. The SD directory shows about half a gig free. The serial flash is Red. I tried drag and drop into both, and I am still not getting any sounds, and I cannot see the files in monitor or playfile.

I am going to try and re-format my sounds again, to make sure they are correct.

Any chance there is a sample soundfont , that is in best format/sample rate etc?

I am using the standard (but resampled) light meat , dark meat, grey meat distributed on plecter cards.

I am wondering now if it is a soundfont format issue.

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 10, 2017, 07:40:36 PM
  Back again with some more info.

  I tried a new sd card and sd card reader, no luck.

 Shortened the wires, no luck. Strange thing is, when the teensy boots up and flashes orange SMD, the card reader activity light also lights up.

  I have upgraded to your new software. Now it gets stuck on font01. Rebooting without a card gets me robot voice! So cool.

 Without an SD card, PWD brings back font01/ but DIR shows no files.

If I try and plug in an SD card and try Next Pre , robot voice says an error, which is difficult to make out.
Probably "bank open failure"
SD card is only detected on boot, so inserting an sd after boot doesn't work.

Quote
I am having trouble with MTP. My computer shows an SD directory (without sd card inserted) and a serial flash directory. The SD directory shows about half a gig free. The serial flash is Red. I tried drag and drop into both, and I am still not getting any sounds, and I cannot see the files in monitor or playfile.

Hmm, might not work well with sd card problems.
Try commenting out ENABLE_SD
You can use "ls" command to see files on the serialflash.
You can also format the serialflash with the "format" command. (takes 30 seconds or so)
The SD library doesn't provide a way to read the available disk space, so MTP always reports half a gig for the SD card right now.

Quote
I am going to try and re-format my sounds again, to make sure they are correct.
Any chance there is a sample soundfont , that is in best format/sample rate etc?

Try downloading the standard Igniter font pack?

Quote
I am using the standard (but resampled) light meat , dark meat, grey meat distributed on plecter cards.

Try the unresampled files?
You could also send me the files and I could try them on my boards.

[/quote]
I am wondering now if it is a soundfont format issue.
[/quote]

I don't actually think so, but I could be wrong.
Try using an empty directory as your default sound font.
If it still hangs, you know it's not the files.
If it doesn't hang you can use "dir" to make sure that the sd card can be read. (If it hangs during "dir", there is a almost certainly a wiring issue of some sort.)
If "dir" works, you can do "play font03/poweron.wav" to see if that works.
You can also try "readalot <filename>", which will read a lot of data from the file, but will not play anything or try to decode WAV files.
Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 10, 2017, 10:08:34 PM
Well I am at a loss,

  MTP Serialflash doesn't seem to work for me. Files don't seem to upload. The teensy can't seem to find them.  I know it's experimental, have you already had success? I tried igniter sounds as well .(thanks btw, I didn't know about them).

 I tried all your suggestions, some of them I had tried initially, and retried again.

It's super weird. Unless I managed to fry the teensy in a very specific way, or there is a fundamental thing I have overlooked.

 It's so close, the simple string blade powers on and off with monitor commands and buttons, If I boot without SD card.

I am trying a long format on the SD card for one more go.
 

 

 


Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 10, 2017, 10:33:32 PM
Well I am at a loss,

  MTP Serialflash doesn't seem to work for me. Files don't seem to upload. The teensy can't seem to find them.  I know it's experimental, have you already had success? I tried igniter sounds as well .(thanks btw, I didn't know about them).

I've managed to upload some files to the serialflash through MTP, but I haven't done a LOT of testing yet.
Try the rawfile-uploader sketch, which is an alternate way to upload things to the serialflash.

Quote
I tried all your suggestions, some of them I had tried initially, and retried again.

So which ones works and which ones do not?

Quote
It's super weird. Unless I managed to fry the teensy in a very specific way, or there is a fundamental thing I have overlooked.

WHile I don't know what's going on, it sounds REALLY similar to what happens if you mix up miso and mosi.
Are you triple-darn-sure you have those hooked up right?
Frying the teensy is a possibility, but not particularly common.
Ideally you'd use an oscilloscope or a digital analyzer to see what is going on the SD card pins.
If you don't have any of those, you might try a multimeter (set it to AC to check for digital signals)
Also, there are digtal analyzer sketches for arduino/teensy, so you could potentially hook up another teensy or arduino to the relevant pins and run a sketch that lets you see what is going on.

One more thing: I've noticed that if the communication between the teensy and the SD card breaks down. Rebooting the teensy typically doesn't help. Only removing the sd card or cutting the power actually helps.

Quote
It's so close, the simple string blade powers on and off with monitor commands and buttons, If I boot without SD card.

I am trying a long format on the SD card for one more go.

Make sure you use fat32.
Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 11, 2017, 06:34:41 AM
Wait, I just may have found the fundamental issue.

  Are the MOSI and MISO connections from teensy to prop shield supposed to,be connected? I assumed all the wire connections are just connected to the teensy alone.



Quote
So which ones works and which ones do not?

  For my issue, I tried all the simple solves first, like using the soundfonts as is, after I modified them, no directories on soundcards etc.

Part of my problem was improper diagnostics in the first few messages. Some of the issues were created from the same root cause, which was the teensy bricking.

Quote
Are you triple-darn-sure you have those hooked up right?


 I even switched them before I tried another SD card reader , which actually has MOSI and MISO labeled on board as opposed to DI DO etc.  I will try switching them again when the iron is hot.

 Just to confirm, MOSI=DI which is connected to pad 11 on teensy.
MISO=D0 connected to pad 12.


Quote
Ideally you'd use an oscilloscope or a digital analyzer to see what is going on the SD card pins.
If you don't have any of those, you might try a multimeter (set it to AC to check for digital signals)
Also, there are digtal analyzer sketches for arduino/teensy, so you could potentially hook up another teensy or arduino to the relevant pins and run a sketch that lets you see what is going on.

  Yes, that was the next step. The monitor is able to show info on accelerometers and such, so I didn't think it could be a propshield communication issue. At this point I am not sure if the MTP transfer is an unrelated  issue or not. I will try the rawfile uploader sketch.
 
Perhaps one of the teensy to prop shield pins doesn't have a perfect connection, but my soldering is usually pretty good. If I find a misbehaving Pin, I will see which one is best to use as backup.

Quote
Rebooting the teensy typically doesn't help. Only removing the sd card or cutting the power actually helps

  I had been pulling the blade typically. The teensy has no problem being recognized by the computer, and if there is not a SD card inserted, I can get serial monitor everytime.


  I might try and dismantle the unit and try again from scratch, while I put together the 3.6. I dislike that idea, as I risk mucking up the pads if I'm hasty.
 
 


 
Title: Re: TeensySaber Software Discussion
Post by: Whosle on July 11, 2017, 08:09:05 AM
IT WORKS!!!!!!@@!


Thank you so much for your patience and free knowledge!!

Soooo awesome.

Made my day!

I sent you a PM.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 11, 2017, 01:40:00 PM
So what made it work?
Was it hooking up the prop shield signals, swapping miso/mosi or something else?
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on July 14, 2017, 05:11:36 AM
I've added support for my Oled lcd, but currently im using adafruits library and simple wrapper. Need to simplify it in order to use the teensy wire lib, as I want to hook it up on the second i2c bus. But even on the same bus it works ok ( with the simple animation and motion chip).
I realized this LCD is a perfect fit for the graflex clamp :D. Will post code once its beautified.

https://photos.app.goo.gl/xJK8TzkY04mXerrH3 (https://photos.app.goo.gl/xJK8TzkY04mXerrH3)
https://photos.app.goo.gl/abQXgizNJeRMNi0K2 (https://photos.app.goo.gl/abQXgizNJeRMNi0K2)

Now the fun part begins - writing graphical interface :D

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 14, 2017, 09:47:50 AM
I've added support for my Oled lcd, but currently im using adafruits library and simple wrapper. Need to simplify it in order to use the teensy wire lib, as I want to hook it up on the second i2c bus. But even on the same bus it works ok ( with the simple animation and motion chip).
I realized this LCD is a perfect fit for the graflex clamp :D. Will post code once its beautified.

http://photos.app.goo.gl/xJK8TzkY04mXerrH3 (http://photos.app.goo.gl/xJK8TzkY04mXerrH3)
http://photos.app.goo.gl/abQXgizNJeRMNi0K2 (http://photos.app.goo.gl/abQXgizNJeRMNi0K2)

Now the fun part begins - writing graphical interface :D

That's pretty awesome.
Where do you buy that display?
Do you really need to worry about putting on a separate i2c bus?
I'm hoping that this will become a pull request for me to add to the teensysaber code. :)
I've been thinking about buying one of these: SparkFun TeensyView - LCD-14048 - SparkFun Electronics (https://www.sparkfun.com/products/14048)
But the short wires means you couldn't put it in a clamp like you suggested.
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on July 15, 2017, 01:42:49 AM
This is the model that I got -> IIC I2C 0.91" 128x32 White OLED LCD Display Module DC 3.3V 5V For Arduino PIC | (http://www.ebay.com/itm/IIC-I2C-0-91-128x32-White-OLED-LCD-Display-Module-DC-3-3V-5V-For-Arduino-PIC/332047978840?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649)
My only concern is the lcd not to intervene in any way in the gyro communication, as motion is with higher priority for me. So better safe then sorry, and use the other bus :D.
For the sparkfun model although the flex cable is short, it still can be extended with some kynar wire.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 15, 2017, 11:58:59 AM
This is the model that I got -> IIC I2C 0.91" 128x32 White OLED LCD Display Module DC 3.3V 5V For Arduino PIC | (http://www.ebay.com/itm/IIC-I2C-0-91-128x32-White-OLED-LCD-Display-Module-DC-3-3V-5V-For-Arduino-PIC/332047978840?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649)
My only concern is the lcd not to intervene in any way in the gyro communication, as motion is with higher priority for me. So better safe then sorry, and use the other bus :D.
For the sparkfun model although the flex cable is short, it still can be extended with some kynar wire.

Nice! (and cheap too!)
It depends on the protocol and speed of the device, but I'd be surprised if this would interfere with the motion in any noticable way.  If it does, I would just update the display in chunks with a YIELD() call in between each chunk.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on August 24, 2017, 11:19:33 AM
I'm looking to put together a default sound font pack for teensysaber.
Any recommendations for free fonts?

For any sound font makers out there: I'd be happy to include readme files for each font so that people will know who made them and where to get more fonts. Also, I would love to have some fonts with looped swing sounds, which seems to be a feature unique to TeensySaber right now.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on September 11, 2017, 12:36:00 PM
I'm looking to put together a default sound font pack for teensysaber.
Any recommendations for free fonts?

For any sound font makers out there: I'd be happy to include readme files for each font so that people will know who made them and where to get more fonts. Also, I would love to have some fonts with looped swing sounds, which seems to be a feature unique to TeensySaber right now.

I would suggest a few of the default Naigon electronics packs found here http://www.saberigniter.com/downloads.aspx (http://www.saberigniter.com/downloads.aspx) or ultrsabers default sound packs Obsidian USB Sound Fonts | Obsidian Sound Fonts| Ultrasabers.com (https://www.ultrasabers.com/Sound-Font-p/soundfont-manual.htm) Their sound packs are a .LSU file format which I do not believe works with the teensysaber.

Also how have you been, communication on here in various forms seems to have dipped, myself included. I am looking forward to using these new options in some of my saber builds. I took the summer to digest, relax, and think about a new chassis design, which in theory, which should allow me, and the user, to have multiple sabers only needing one set of electronics. I am currently in the design phase, and when parts arrive I will hopefully be able to print and make a prototype to see if it works as expected.

Feedback would be much appreciated or if you have any suggestions as how this could be possible that would help too.

Again, thanks for all the work you do and I look forward to creating some amazing sabers this year!

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 11, 2017, 01:32:43 PM
I'm looking to put together a default sound font pack for teensysaber.
Any recommendations for free fonts?

For any sound font makers out there: I'd be happy to include readme files for each font so that people will know who made them and where to get more fonts. Also, I would love to have some fonts with looped swing sounds, which seems to be a feature unique to TeensySaber right now.

I would suggest a few of the default Naigon electronics packs found here http://www.saberigniter.com/downloads.aspx (http://www.saberigniter.com/downloads.aspx) or ultrsabers default sound packs Obsidian USB Sound Fonts | Obsidian Sound Fonts| Ultrasabers.com (https://www.ultrasabers.com/Sound-Font-p/soundfont-manual.htm) Their sound packs are a .LSU file format which I do not believe works with the teensysaber.


While it would be fairly easy to put together a bunch of free fonts found on the internet, I really would prefer to have direct permission from the creators of those fonts.

Quote

Also how have you been, communication on here in various forms seems to have dipped, myself included. I am looking forward to using these new options in some of my saber builds. I took the summer to digest, relax, and think about a new chassis design, which in theory, which should allow me, and the user, to have multiple sabers only needing one set of electronics. I am currently in the design phase, and when parts arrive I will hopefully be able to print and make a prototype to see if it works as expected.


I've been good, poking around with building a 125W saber... :)

Sharable electronics sounds cool, but difficult. I've been pondering how to make a chassis that easy to remove for my sabers, not because I want to share the electronics, but because I would like to make it easy to swap the batteries. However, I could never figure out a good system for handling the connections to things which are wired into the hilt. (buttons, speakers, charge ports, PLI, etc.)

Quote
Feedback would be much appreciated or if you have any suggestions as how this could be possible that would help too.

Again, thanks for all the work you do and I look forward to creating some amazing sabers this year!
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on September 12, 2017, 09:09:15 AM
Yes, that makes sense, well i wish you luck in finding them and if I see any I will let you know.

oh that sounds amazing:) So what is the main difference between the V2 and V3 board? Amp?

Yes, I dont want to share with anyone just myself and other sabers I build. I want to be able to remove some of the electronics to make it easier for programming and battery swapping. I took a note from your book and was going to use pogo pins and some perf board as a prototype. The button assembly and blade connector will be fixed in the hilt and the pommel will push the electronics into that assembly completing the circuit.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 12, 2017, 10:17:14 AM
oh that sounds amazing:) So what is the main difference between the V2 and V3 board? Amp?

3W digital amplifier and slightly smaller (see here: Teensy Saber Electronics V3 (http://fredrik.hubbe.net/lightsaber/v3/))

Quote
Yes, I dont want to share with anyone just myself and other sabers I build. I want to be able to remove some of the electronics to make it easier for programming and battery swapping. I took a note from your book and was going to use pogo pins and some perf board as a prototype. The button assembly and blade connector will be fixed in the hilt and the pommel will push the electronics into that assembly completing the circuit.

Pogo pins might be overkill. Might be better to just have an aviation connector at the top of the chassis mate with a connector inside the hilt. The problem is that both pogo pins and connectors take quite a lot of space.

I've seen something inside cell phones that might work though: It's kind of like a pogo pin, but it's small. flat and surface mounted. You could put some of those on a circuit board, and then have another circuit board with circular contact areas to connect to. The whole thing would be maybe 1/4" thick. Then it's just a matter of figuring out the mounting mechanics.

This part is probably too expensive, but it's an example of the kind of thing I was thinking:
815-22-001-30-001101 Mill-Max Manufacturing Corp. | Connectors, Interconnects | (https://www.digikey.com/product-detail/en/mill-max-manufacturing-corp/815-22-001-30-001101/ED1232-01-ND/3913214)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on September 15, 2017, 01:50:28 PM
They might, but worth a try. I found some half inch long ones which make it pretty compact. and I have quite a bit of space inside my chassis design. Yes, you could use an aviation connector, but it would be hard to pull the bottom chassis out. You would need to 3d print a strong tab to pull on that didn't interfere with anything. Those look promising, but at almost 5 dollars a piece it would be expensive to make.

Yeah, mounting mechanics is what I am playing with right now. Hopefully, I can have a prototype soon and build some more V2 boards so i can buy some V3 :)

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: arusiasotto on September 20, 2017, 07:57:58 AM
So I've got the hardware built, and I am a out to embark on the software side. What does the file structure for sound fonts loom like? Just a folder on the root of the card?
Next question is setti g up my blade. I'm using a Cree XM-L. So I would need to change the my_saber1.h generated configuration such that is using the CreeXPE2White, red, blue, and green?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 20, 2017, 09:13:47 AM
So I've got the hardware built, and I am a out to embark on the software side. What does the file structure for sound fonts loom like? Just a folder on the root of the card?
Yes, just make a directory, put the font in it, and then update the first entry in one of your presets to name that directory.
Just remember that teensysaber is currently limited to 8.3-character file and directory names.

Quote
Next question is setti g up my blade. I'm using a Cree XM-L. So I would need to change the my_saber1.h generated configuration such that is using the CreeXPE2White, red, blue, and green?

Sounds like you should make a new LED class. (Because I don't have one for XM-L yet) Find CreeXPE2White in lightsaber.ino, duplicated it, call it CreeXML and follow the instructions.
If you need help, I can create the class for you tonight.

Note that you'll also need to change the blade configuration (in the preset array) to use all white colors.


Title: Re: TeensySaber Software Discussion
Post by: arusiasotto on September 20, 2017, 04:41:02 PM
So here is what I think I need to be doing?

Code: [Select]
struct CreeXMLWhite {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 255;
  static const int Blue = 255;
};

struct CreeXMLRed {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 2.6;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 2.25;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 0;
  static const int Blue = 0;
};

struct CreeXMLBlue {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

struct CreeXMLGreen {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.9;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.3;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};
};

Would this be right, and then I have to make a preset that uses all 4 values, as this is an RGBW led?

Then the Blade config that has all 4 leds.
Code: [Select]
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXMLRed, CreeXMLGreen, CreeXMLBlue, CreeXMLWhite>(), CONFIGARRAY(presets) },
};
#endif

now the presets are going to difficult. Maybe it might be easier to set the White LED as a second blade and alster it with the presets?
I may have to define some led setups that are RGBW instead of RGB?

EDIT: So I found the color class. Debating if I should fuss with it, so that I can control the level of White light.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 20, 2017, 06:51:56 PM
So here is what I think I need to be doing?

Code: [Select]
struct CreeXMLWhite {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 255;
  static const int Blue = 255;
};

struct CreeXMLRed {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 2.6;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 2.25;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 0;
  static const int Blue = 0;
};

struct CreeXMLBlue {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

struct CreeXMLGreen {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.9;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.3;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};
};

Would this be right, and then I have to make a preset that uses all 4 values, as this is an RGBW led?

Then the Blade config that has all 4 leds.
Code: [Select]
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXMLRed, CreeXMLGreen, CreeXMLBlue, CreeXMLWhite>(), CONFIGARRAY(presets) },
};
#endif

now the presets are going to difficult. Maybe it might be easier to set the White LED as a second blade and alster it with the presets?
I may have to define some led setups that are RGBW instead of RGB?

EDIT: So I found the color class. Debating if I should fuss with it, so that I can control the level of White light.


I'm confused. As far as I can tell, Cree XM-L only comes in various tones of white. Do you have a data sheet for these LEDs?
Also, assuming that the data you entered above is correct, I would recommend a 1-ohm resistor in series with the red channel. (Setting R=0 means no resistor.)
The presets shouldn't be difficult. You can just use RGB colors with your RGB star, the white channel will just be min(R, G, B), which should work pretty ok. Try it and let me know if it works for you or not.
Title: Re: TeensySaber Software Discussion
Post by: arusiasotto on September 20, 2017, 07:04:19 PM
You are likely seeing the XM-L2 which is indeed a simple white LED. Here is the official data sheet.
http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf (http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf)
It is a 4 die chip.
And yes, I had already noticed I hadn't put in the R value on Red.
And by Min RGB, that means if any color is set to 0, the white won't turn on?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 20, 2017, 08:34:49 PM
You are likely seeing the XM-L2 which is indeed a simple white LED. Here is the official data sheet.
http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf (http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf)
It is a 4 die chip.
And yes, I had already noticed I hadn't put in the R value on Red.
And by Min RGB, that means if any color is set to 0, the white won't turn on?

Yes, that's what it means.
If you want a little white, you can use a color like 30,30,255
This also turns on the red and green colors a little though, which is nice for brightness, but less nice for battery life.

I think you should set P2Amps to 0.35 for all the LEDs and fill in the typical forward voltage for P2Volts (2.25, 3.3, 3.1)
The MaxAmps is correctly set to 1.0 for all the dies. I think you should get the MaxVolts from the graph on page 4, which means ~2.7 volts for red, ~3.35 volts for white and blue and ~3.8 volts for green.
It would be even better to measure these things of course.

The white and blue LEDs should probably also have resistors at about 0.35 ohms, but it will probably work fine without.

Title: Re: TeensySaber Software Discussion
Post by: arusiasotto on September 21, 2017, 03:24:40 PM
Alas, I can't seem to keep the Teensy powered long enough. I probably just melted 80$ of electronics together...
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 21, 2017, 03:36:28 PM
Ouch, that sucks, what happened?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on September 21, 2017, 09:18:10 PM
You are likely seeing the XM-L2 which is indeed a simple white LED. Here is the official data sheet.
http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf (http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf)
It is a 4 die chip.
And yes, I had already noticed I hadn't put in the R value on Red.
And by Min RGB, that means if any color is set to 0, the white won't turn on?

Yes, that's what it means.
If you want a little white, you can use a color like 30,30,255
This also turns on the red and green colors a little though, which is nice for brightness, but less nice for battery life.

I think you should set P2Amps to 0.35 for all the LEDs and fill in the typical forward voltage for P2Volts (2.25, 3.3, 3.1)
The MaxAmps is correctly set to 1.0 for all the dies. I think you should get the MaxVolts from the graph on page 4, which means ~2.7 volts for red, ~3.35 volts for white and blue and ~3.8 volts for green.
It would be even better to measure these things of course.

The white and blue LEDs should probably also have resistors at about 0.35 ohms, but it will probably work fine without.

After re-reading the data sheet (and measuring the diagram on page 4 with a ruler), here is what I came up with:

Code: [Select]
struct CreeXMLRed {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 2.68;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 2.25;
  static constexpr float R = 1.0;
  static const int Red = 255;
  static const int Green = 0;
  static const int Blue = 0;
};

struct CreeXMLGreen {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.79;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 3.3;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};

struct CreeXMLBlue {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.38;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.32;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

struct CreeXMLWhite {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.38;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.32;
  static const int Red = 255;
  static const int Green = 255;
  static const int Blue = 255;
};


I'll add this to the next version of teensysaber.
Note that "maxvolts" should be the typical voltage at the maximum amps, not the absolute maximum possible voltage.

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 05, 2017, 10:09:56 PM
New teensysaber software drop: Version 1.164

New features:
 o 16-bit color calculations makes very dim led output possible
 o Blaster block blade effect
 o Drag mode (like lockup, but lights up the tip when you drag it across the ground.)
 o Pulsing blades.
 o Serial port support.

As usual, get it here: Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)
Title: Re: TeensySaber Software Discussion
Post by: Sligs78 on November 09, 2017, 08:12:57 AM
Does the Teensy saber have pitch shift yet?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 09, 2017, 10:27:57 AM
Does the Teensy saber have pitch shift yet?

Do you literally mean
  1) "can teensysaber change the pitch of a sample?"
 or
  2) "does teensysaber have thexters asweme algorithm?"

The answer to (1) it could, but what would you do with it?
(I did experiment with changing the pitch of samples based on swings at one point, but it didn't sound good to me.)

The answer to (2) is that teensysaber has an implementation of thexters first smoothswing algorithm, you'll find references to it in the code and on the documentation page if you search for "looped swing sounds". Teensysaber does not have an implementation of the smoothswing V2 algorithm, and as far as I know, nobody except thexter does.
Title: Re: TeensySaber Software Discussion
Post by: Darth Brooks on November 10, 2017, 08:29:00 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?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.
Title: Re: TeensySaber Software Discussion
Post by: Darth Brooks 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!
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.
Title: Re: TeensySaber Software Discussion
Post by: Kouri 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.
Title: Re: TeensySaber Software Discussion
Post by: Kouri 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.

Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.)
Title: Re: TeensySaber Software Discussion
Post by: Kouri 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.
Title: Re: TeensySaber Software Discussion
Post by: Kouri 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.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.

Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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 (http://fredrik.hubbe.net/lightsaber/bluetooth.html)
Title: Re: TeensySaber Software Discussion
Post by: Kouri 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 (http://fredrik.hubbe.net/lightsaber/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.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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 (http://fredrik.hubbe.net/lightsaber/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!
Title: Re: TeensySaber Software Discussion
Post by: Kouri 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?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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. :)

Title: Re: TeensySaber Software Discussion
Post by: Kouri 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 (http://kourikustoms.com/tools/NeoPixelColorSelector.html)

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>
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 28, 2017, 12:16:21 PM
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 (http://kourikustoms.com/tools/NeoPixelColorSelector.html)

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>


I'll make sure to include the SWING_THRESHOLD in the config file for next version. :)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 28, 2017, 12:17:45 PM
BTW, the color of the clash should have very little impact on the battery life, since clashes are so short-lived.
Title: Bluetooth
Post by: KanyonKris on November 29, 2017, 04:48:37 AM
Bluetooth is way cool.

Since it's inside a metal enclosure, how is the range?

I know this isn't included in the current firmware, but is it technically feasible to upload new firmware and sound fonts over Bluetooth?  It would be very nice to never need to open up the saber.
Title: Re: TeensySaber Software Discussion
Post by: Kouri on November 29, 2017, 05:50:52 AM
It's not really so much about the clash as preventing mixed colors from pulling 2-3x as much power as single colors. Up to the end user to balance brightness and power draw. Also helps prevent bright white flashes from causing a significant voltage drop on weaker cells that might shut off the board.

That said, I've got a high-drain cell in my crossguard, and haven't yet had any issues with the default  WHITE and YELLOW values on TeensySaber.

As for bluetooth range, I can't speak for this setup, but the last time I toyed with a bluetooth module, I had really poor reception in the aluminum hilt. I got around that by drilling some holes near the switch, running some black wire through the holes to the outside of the hilt, and soldering those wires to the antenna traces on the module. I forget exact values, but I want to say it increased range from about 2-3ft to 20ft.

(https://i.imgur.com/U2ZZcFVl.jpg)

Also, I originally misunderstood Drag as a feature that would activate if the lockup sounds were renamed/replaced with the appropriately named file. After looking at the code, I realized it's basically a special lockup that only triggers when the blade is pointed toward the floor.

It's a super nifty effect, but there really ought to be some warning in the build guide that TeensySaber expects to be installed with the SD card facing the pommel. I very nearly installed it the other way around for cleaner wiring.

It's taking me a bit to wrap my head around all the code since I've never really worked with anything more complex than PHP and Basic, but I find myself building up a large to-do list of tweaks to the code, so at least this is a fun way to learn C.

EDIT: So I'm taking a break from the more complicated code to play around with blade styles. I don't see EasyBlade documented on the software page, but looking at the code, I'm led to believe it's basically SimpleClash with audioflicker incorporated in the clash effects?

EDIT2: Took the advice for slash code. Polyphonic swings looking like:
Code: [Select]
if (speed > SWING_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF) {
        swinging_ = true;
        if (speed - average_speed > SLASH_DELTA){
          Play(&slsh);
        } else {
          Play(&swng);
        }
      }
    } else {
      swinging_ = false;
    }

So far I'm happy with CLASH_THRESHOLD_G at 3.0 and SWING_THRESHOLD at 150. Still need to dial in SLASH_DELTA. 15 and 20 were both too low.
Title: Re: Bluetooth
Post by: profezzorn on November 29, 2017, 10:33:22 AM
Bluetooth is way cool.

Since it's inside a metal enclosure, how is the range?

I know this isn't included in the current firmware, but is it technically feasible to upload new firmware and sound fonts over Bluetooth?  It would be very nice to never need to open up the saber.

I don't actually know what the range is yet, as my bluetooth chip isn't in a hilt yet.
I would expect the hilt to work as a faraday cage, so unless an antenna is placed on the outside, it might not work at all.
BLE is rated for 60 meters under ideal conditions, obviously placing the antenna inside a metal container is not ideal conditions. :)

It is technically feasible to upload new fonts and firmware over bluetooth, but I'm not sure you would want to as BLE is pretty slow.
I would love to integrate the app with soundfont.com though so that fonts could be bought and uploaded from your phone or computer directly.

Firmware updates are a little trickier, but could be accomplished with a two-step process:
  1) upload firmware to sd card
  2) firmware is flashed from sd card

I'm probably going to work on moving some configuration items out of the source code and into config files in the future so that they can be
dynamically changed without having to upload new firmware. I want to keep the config files fairly simple though, so I don't expect the need to upload
new firmware to away completely.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 29, 2017, 10:42:47 AM
It's not really so much about the clash as preventing mixed colors from pulling 2-3x as much power as single colors. Up to the end user to balance brightness and power draw. Also helps prevent bright white flashes from causing a significant voltage drop on weaker cells that might shut off the board.

That said, I've got a high-drain cell in my crossguard, and haven't yet had any issues with the default  WHITE and YELLOW values on TeensySaber.

As for bluetooth range, I can't speak for this setup, but the last time I toyed with a bluetooth module, I had really poor reception in the aluminum hilt. I got around that by drilling some holes near the switch, running some black wire through the holes to the outside of the hilt, and soldering those wires to the antenna traces on the module. I forget exact values, but I want to say it increased range from about 2-3ft to 20ft.

(https://i.imgur.com/U2ZZcFVl.jpg)


Good to know

Quote
Also, I originally misunderstood Drag as a feature that would activate if the lockup sounds were renamed/replaced with the appropriately named file. After looking at the code, I realized it's basically a special lockup that only triggers when the blade is pointed toward the floor.

It's a super nifty effect, but there really ought to be some warning in the build guide that TeensySaber expects to be installed with the SD card facing the pommel. I very nearly installed it the other way around for cleaner wiring.

Good point, I should add that somewhere.
Although, it's pretty simple to insert a - somewhere to negate the right axis in the acceleration detection code.

Quote

It's taking me a bit to wrap my head around all the code since I've never really worked with anything more complex than PHP and Basic, but I find myself building up a large to-do list of tweaks to the code, so at least this is a fun way to learn C.


Feel free to share the todo list so that other people (including me) can work on it as well. :)
Also, please consider sharing any changes you make so I can include them in the next release of the code.
Btw, it's C++, not C, and it's written a little weird because I try to avoid using malloc() when I write code for small processors.
And I really should split the file up 10000 lines of code in one file can be hard to work with.

Quote
EDIT: So I'm taking a break from the more complicated code to play around with blade styles. I don't see EasyBlade documented on the software page, but looking at the code, I'm led to believe it's basically SimpleClash with audioflicker incorporated in the clash effects?

Missed the Lockup and Blast effects.
Basically it just adds clash, lockup and blast effects to whatever colors you select.
I will add it to the documentation.

Quote
EDIT2: Took the advice for slash code. Polyphonic swings looking like:
Code: [Select]
if (speed > SWING_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF) {
        swinging_ = true;
        if (speed - average_speed > SLASH_DELTA){
          Play(&slsh);
        } else {
          Play(&swng);
        }
      }
    } else {
      swinging_ = false;
    }

So far I'm happy with CLASH_THRESHOLD_G at 3.0 and SWING_THRESHOLD at 150. Still need to dial in SLASH_DELTA. 15 and 20 were both too low.

I'm not actually sure that this is the right way to detect slash vs. swing, I just suggested it because i seemed better than
first triggering a swing and then a slash. Let me know how it works out.
Title: Re: TeensySaber Software Discussion
Post by: Kouri on November 29, 2017, 11:45:12 AM
Well my first idea of adding a nested speed check didn't trigger any slashes (I'm using Naigon's "Testing Testing" font to verify). The only other idea I can think up is checking for a slash speed before checking for a swing speed, but it's probably a waste of CPU to compare speed twice every step. At least your way only checks for slash speeds after meeting the minimum swing speed.

Code: [Select]
if (speed > SLASH_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF) {
        swinging_ = true;
        Play(&slsh);
        }
      }
    } else if (speed > SWING_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF) {
        swinging_ = true;
        Play(&swng);
        }
      }
    } else {
      swinging_ = false;
    }

As for my to-do list, in no particular order:

Most of it's saberstaff and crossguard optimization that won't effect 98% of end-users, so it just made sense to tackle on my own and share my findings afterward.

And I wasn't sure about the math needed for the drag-detection code. If it really is just a negative, I was thinking of adding an ORIENTATION variable to the config that could be set to 1 or -1 depending on which way the board's facing, then just multiply that in the drag check.

Finally, your bluetooth announcement has me thinking about replicating Prizm's multi-blade support (All neopixel blades in series, Pixels 1-20 designated as crossguards, pixels 21-160 designated as main blade, for example) so that I could free up those two data pins for bluetooth or Zigbee modules, but that's *really* low on my priorities.

EDIT: Looks like a Slash Delta of ~30 works great. Motion tracking on this board feels a LOT better now.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 29, 2017, 03:54:45 PM
And I wasn't sure about the math needed for the drag-detection code. If it really is just a negative, I was thinking of adding an ORIENTATION variable to the config that could be set to 1 or -1 depending on which way the board's facing, then just multiply that in the drag check.

I think it would be better to do the multiplication in the motion sensor code, otherwise it may need to be done in multiple places.
(Like the POV blade for instance.)

Title: Re: TeensySaber Software Discussion
Post by: Kouri on November 30, 2017, 07:38:07 AM
I'm trying to adjust Flame Blade to at least show the clash effect on a blaster block.

Current code is:

Code: [Select]
      FireConfig config(0,0,0);
      if (blade->clash()) {
         config = clash_;
      } else if (On(blade)) {
        if (SaberBase::Lockup() == SaberBase::LOCKUP_NONE) {
          config = normal_;
        } else {
          config = lockup_;
        }
      } else {
         config = normal_;
         config.intensity_base = 0;
         config.intensity_rand = 0;
      }

And I'm thinking of tweaking it to:

Code: [Select]
      FireConfig config(0,0,0);
      if (blade->clash()) {
         config = clash_;
      } else if (On(blade)) {
        if (SaberBase::NumBlasts > 0) {
          config = clash_;
        } else if (SaberBase::Lockup() == SaberBase::LOCKUP_NONE) {
          config = normal_;
        } else {
          config = lockup_;
        }
      } else {
         config = normal_;
         config.intensity_base = 0;
         config.intensity_rand = 0;
      }

I'm just not sure that "if (SaberBase::NumBlasts > 0)" is the best way to identify when a blast should be triggered.

Also wanting to change the retraction so it's like a normal saber blade. My current understanding is Fire Blade basically plays an animation of random colors travelling up the blade, and on retraction, the animation stops adding new colors and lets the existing ones finish travelling. What I'd like to do instead is, when retraction is triggered, start lowering the num_leds variable (or some temporary copy of it) while maintaining the animation, so the fire just travels a shorter distance each iteration until it stops emitting entirely.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 30, 2017, 02:25:17 PM
I'm trying to adjust Flame Blade to at least show the clash effect on a blaster block.

Current code is:

Code: [Select]
      FireConfig config(0,0,0);
      if (blade->clash()) {
         config = clash_;
      } else if (On(blade)) {
        if (SaberBase::Lockup() == SaberBase::LOCKUP_NONE) {
          config = normal_;
        } else {
          config = lockup_;
        }
      } else {
         config = normal_;
         config.intensity_base = 0;
         config.intensity_rand = 0;
      }

And I'm thinking of tweaking it to:

Code: [Select]
      FireConfig config(0,0,0);
      if (blade->clash()) {
         config = clash_;
      } else if (On(blade)) {
        if (SaberBase::NumBlasts > 0) {
          config = clash_;
        } else if (SaberBase::Lockup() == SaberBase::LOCKUP_NONE) {
          config = normal_;
        } else {
          config = lockup_;
        }
      } else {
         config = normal_;
         config.intensity_base = 0;
         config.intensity_rand = 0;
      }

I'm just not sure that "if (SaberBase::NumBlasts > 0)" is the best way to identify when a blast should be triggered.

Also wanting to change the retraction so it's like a normal saber blade. My current understanding is Fire Blade basically plays an animation of random colors travelling up the blade, and on retraction, the animation stops adding new colors and lets the existing ones finish travelling. What I'd like to do instead is, when retraction is triggered, start lowering the num_leds variable (or some temporary copy of it) while maintaining the animation, so the fire just travels a shorter distance each iteration until it stops emitting entirely.

SaberBase::NumBlasts > 0 will activate the blast for a rather long time, which might be ok, but it's probably better to do something like:

Saberbase::NumBlasts > 0 && micros() - SaberBase::getBlast(0).start_micros < 300000

(adjust the 300000 to the number of micros you actually want.)

For the retraction, it might be better to hack up a version of the fire style that fits he run()/getColor() pattern, that way you can just encapsulate it in
a InOutHelper<> template to get the retraction working the way you want to.

Title: Github ?
Post by: KanyonKris on December 04, 2017, 01:25:33 PM
Looks like the last code commit to GitHub was early September. Are you not using GitHub anymore as your code repository? I'm OK pulling the latest firmware from your website, but just want to know what your plan is for managing the code.
Title: Re: TeensySaber Software Discussion
Post by: Kouri on December 04, 2017, 04:27:36 PM
Ehhhhh, this is still beyond me.

Put the re-writing to a hold and just used the existing blade code to whip up a new blade style in my config.

Changed the fire configs to bump up speed and minimum brightness while preventing it getting too yellow:
Code: [Select]
// Fire speed, valid values are 1 - 10
#define FIRE1_SPEED 3 //default 2
// How long to wait before firing up crossguards.
#define FIRE1_DELAY 800

// Each of these have three values: A, B, C
// A = non-random intensity
// B = random intensity
// C = cooling
// The first two control temperature, and as we add
// A + rnd(B) to the base of the blade each animation frame.
// The second controls how rapidly the fire cools down

// This is used during normal operation.
//#define FIRE1_NORMAL 0, 1000, 2
#define FIRE1_NORMAL 150, 900, 2

// This is used when a clash occurs
//#define FIRE1_CLASH  3000, 0, 0
#define FIRE1_CLASH  3000, 1000, 0

// This is used during lockup.
//#define FIRE1_LOCKUP 0, 5000, 10
#define FIRE1_LOCKUP 0, 5000, 10

// Helper
#define FIRE1PTR(NUM, DELAY) \
  StyleFirePtr<RED, Orange, NUM, DELAY, FIRE1_SPEED, \
    FIRE1_NORMAL, FIRE1_CLASH, FIRE1_LOCKUP>()

And using a random-flicker main blade with fire crossguards to keep most of the blade effects.
Code: [Select]
{ "font01", "tracks/Intro.wav",
    StylePtr<InOutSparkTip<EasyBlade<RandomPerLEDFlicker<Rgb<160,0,0>, Rgb<255,32,0> >, WHITE>, 300, 800, YELLOW> >(),
    FIRE1PTR(1, FIRE1_DELAY),
    FIRE1PTR(2, FIRE1_DELAY)
  },

Going to try and figure out how to mess with the single-button input so it's hold-while-on to Shutoff and tap-while-on for Blaster Block.
Title: Re: Github ?
Post by: profezzorn on December 04, 2017, 09:25:09 PM
Looks like the last code commit to GitHub was early September. Are you not using GitHub anymore as your code repository? I'm OK pulling the latest firmware from your website, but just want to know what your plan is for managing the code.

I actually use CVS to manage the code, and then mirror the code to github.
Unfortunately I sometimes forget to do the mirroring, sorry about that.
I have mirrored all the latest changes now. Please remind me if I forget again.
Title: Re: TeensySaber Software Discussion
Post by: Kouri on December 06, 2017, 09:25:48 AM
Looking like three fire blades put a bit too much stress on Teensy. Really hard clashes, or a series of consecutive clashes pause the fire animation while the effect processes.

I'll try rewiring the hilt to get both crossguard's on one data pin and see how things work with just two blades.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 06, 2017, 10:31:26 AM
Looking like three fire blades put a bit too much stress on Teensy. Really hard clashes, or a series of consecutive clashes pause the fire animation while the effect processes.

I'll try rewiring the hilt to get both crossguard's on one data pin and see how things work with just two blades.

That's weird, and it's not supposed to happen.
Are you sure it's not the "Blast" effect, because that one is pretty slow right now.
If that's not it, then something weird is going on, because running the fire blades takes exactly the same amount of processing power weather a clash is in effect or not.
Another thing to check is that each of BladeFirePtr<> calls has a different blade number argument. Not having that causes slowdowns.  (If you don't know what that is, just post your config file and I'll check for you.)

The last possibility is that something bad happens with hard clashes. Maybe the SD card gets wiggled to much? Maybe the power drops? Maybe the communication with the motion chip goes wonky for a little? Maybe the blade connector gets disconnected?

When these problems occur, does it affect all blades equally? Does it affect the sound as well? How long does it last?
Title: Re: TeensySaber Software Discussion
Post by: Kouri on December 06, 2017, 12:55:23 PM
I'd actually gone back to the stock lightsaber.ino without Blaster or Slash code to verify it wasn't any of those additions.

It's all blades equally, and I think I've got the culprit. The lowered swing threshold is triggering way too many swing events. I can clash and rapidly swing to slow the animation and effectively freeze a clash mid-blade.

I'm thinking I need to add some sort of alarm to limit the number of swings per second.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 06, 2017, 03:59:04 PM
I'd actually gone back to the stock lightsaber.ino without Blaster or Slash code to verify it wasn't any of those additions.

It's all blades equally, and I think I've got the culprit. The lowered swing threshold is triggering way too many swing events. I can clash and rapidly swing to slow the animation and effectively freeze a clash mid-blade.

I'm thinking I need to add some sort of alarm to limit the number of swings per second.

Normally swinging_ is set to true when a swing starts, and isn't set to false until the swing is over. New swings sounds aren't generated unless swinging_ is false.
Maybe your change messed that up somehow?

Title: Re: TeensySaber Software Discussion
Post by: Kouri on December 06, 2017, 04:43:31 PM
I literally just changed the "250" to "SWING_THRESHOLD". It shouldn't affect swing detection. I think you can verify the issue by dropping the threshold in your own lightsaber.ino to 150 or less. It was never apparent before because 250 is a ridiculously high swing threshold that made it hard to trigger a single swing event, let alone a series of recurring swings.

The code basically checks "if moving faster than threshold, say we're swinging and disable new swings. If under threshold, say we're not swinging and re-enable swings" which sounds great. The problem is with a low threshold, anything that's going to rock the saber back and forth, like a really hard impact, or just swinging back and forth, is going to vary speed. Say I'm swinging left and right - eventually I'm going to have to stop moving left to move right, so the saber stops moving left - if only for a fraction of a second, so that it can start moving right, and at that moment, speed is low enough to re-enable swing sounds.

I think some sort of swing timer variable will fix the issue. Basically, somewhere declare a timer variable:

Code: [Select]
swing_timer = 0;
Then adjust the swing code to check that the timer is 0, and set the timer when a swing starts:

Code: [Select]
if (speed > SWING_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF && swing_timer == 0) {
        swinging_ = true;
        swing_timer = 20; //arbitrary value
        Play(&swng);
      }
    } else {
      swinging_ = false;

And then somewhere else, count down the timer.
Code: [Select]
if (swing_timer > 0) {
      swing_timer--;

I'm just not sure if that's the best way to go about making a timer for this little microcontroller. I've only ever done game development for PC where there's plenty of CPU and memory to spare.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 06, 2017, 05:29:48 PM
I literally just changed the "250" to "SWING_THRESHOLD". It shouldn't affect swing detection. I think you can verify the issue by dropping the threshold in your own lightsaber.ino to 150 or less. It was never apparent before because 250 is a ridiculously high swing threshold that made it hard to trigger a single swing event, let alone a series of recurring swings.

The code basically checks "if moving faster than threshold, say we're swinging and disable new swings. If under threshold, say we're not swinging and re-enable swings" which sounds great. The problem is with a low threshold, anything that's going to rock the saber back and forth, like a really hard impact, or just swinging back and forth, is going to vary speed. Say I'm swinging left and right - eventually I'm going to have to stop moving left to move right, so the saber stops moving left - if only for a fraction of a second, so that it can start moving right, and at that moment, speed is low enough to re-enable swing sounds.

I think some sort of swing timer variable will fix the issue. Basically, somewhere declare a timer variable:

Code: [Select]
swing_timer = 0;
Then adjust the swing code to check that the timer is 0, and set the timer when a swing starts:

Code: [Select]
if (speed > SWING_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF && swing_timer == 0) {
        swinging_ = true;
        swing_timer = 20; //arbitrary value
        Play(&swng);
      }
    } else {
      swinging_ = false;

And then somewhere else, count down the timer.
Code: [Select]
if (swing_timer > 0) {
      swing_timer--;

I'm just not sure if that's the best way to go about making a timer for this little microcontroller. I've only ever done game development for PC where there's plenty of CPU and memory to spare.


I'll try lowering the swing threshold and see if I have the same issue.
(Are you using plecter or NEC style font though?)

If you look carefullly you'll find plenty of examples of timers in the code.
The right way is usually to do something like this:   (swing_end_ is a uint32_t)
Code: [Select]
   if (speed > SWING_THRESHOLD) {
      if (!swinging_ && state_ != STATE_OFF && millis() - swing_end_ > 200) {
        swinging_ = true;
        Play(&swng);
      }
   } else {
      if (swinging_) {
        swing_end_ = mills();
        swinging_ = false;
      }
   }
   // avoid wrap-around
   if (millis() - swing_end_ > 10000) swing_end_ = millis() - 5000;

Another option would be to star the timer when the swing stops.
Title: Single button preset change
Post by: KanyonKris on December 06, 2017, 09:22:56 PM
Stupid question: How do I change presets with a single button?
Title: Re: Single button preset change
Post by: profezzorn on December 06, 2017, 10:36:47 PM
Stupid question: How do I change presets with a single button?

I don't have a configuration option for changing what the buttons do, but it's not
terribly difficult to do in the code, just search for "case EVENTID" in lightsaber.ino.
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on December 07, 2017, 12:03:36 AM
One question about the templates (c++ in embeded is nightmare for me :D) Im Trying to do a custom preset that allows me to switch the color and font from the BLE App. I taught of doing it as separate implementation. But You might have already considered this idea while designing the whole class structure.

Secondly, I believe we need some persistence class, In order to save configuration in the eeprom for example. Its quite handy when going to Conventions and putting the blade plug will force you to browse through the presets over and over again to find the one you prefer for the event.

Regards,
Boyko
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 07, 2017, 12:31:40 AM
One question about the templates (c++ in embeded is nightmare for me :D) Im Trying to do a custom preset that allows me to switch the color and font from the BLE App. I taught of doing it as separate implementation. But You might have already considered this idea while designing the whole class structure.

Secondly, I believe we need some persistence class, In order to save configuration in the eeprom for example. Its quite handy when going to Conventions and putting the blade plug will force you to browse through the presets over and over again to find the one you prefer for the event.

Regards,
Boyko

Unfortunately, I did not consider the need for dynamic configuration when I designed the blade configuration classes. However, I did think long and hard about it while working on the bluetooth stuff.

I haven't implemented anything yet, but my idea was to to implement support for reading the presets from a config file on the SD card.  Since I don't want to create an entire configuration language, the blade configuration would be as simple as a template name and a couple of colors/numbers.  The bluetooth configuration app would then update the settings by simply re-writing the configuration file.

The trick will be to provide a comprehensive list of name -> blade templates.
While using the eeprom does have some advantages (doesn't interfere with the sound for one thing) the SD card makes it a lot simpler to access and see what's going on, and it also makes it possible to edit the config file the old-fashion way.

Title: Re: Single button preset change
Post by: Kouri on December 07, 2017, 08:34:56 AM
Stupid question: How do I change presets with a single button?

While off, press and hold the power button and trigger a clash.

----

Prof, this is with the NEC fonts. I've a Kylo font I'll eventually use on the hilt, but for now, I'm using Naigon's "Testing Testing Testing" (FONTC in the Igniter Default package) to calibrate swing/slash thresholds.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 09, 2017, 07:04:56 PM
New teensysaber software version: 1.175

As usual, you can download the new version here: Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)

New features:

SubBlade - This let's you split up a string of neopixels into multiple blades
IgnitionDelay - Let's you delay the ignition of a blade, intended for kylo-style quillions.
ColorCycle - Meant for circles of neopixels, lights up a fraction of the circle and rotates
Makefiles - Let's you compile and install the code using "make" instead of the arduino IDE.
Support for up to 8 blades (crystal chambers and auxiliary LEDs are also blades)

There are additional instructions for how to use these features in the code, but feel free to ask questions here.
Title: MTP folders
Post by: KanyonKris on December 09, 2017, 10:25:13 PM
MTP disk is not fully working for me.

I copied files and folder structure onto the SD card then put it into the Saberboard (V3). When I view the SD card via MTP I can see the files in the root directory and the folders, but when I go into a folder I see no files there nor can I see any subfolders.

When in an MTP connection I was able to create a folder but not copy any files to the SD card.

I am using Windows 7 (I saw a PJRC forum post that said maybe Windows 7 doesn't work, only Windows 10). And installed the latest Teensyduino.
Title: Re: MTP folders
Post by: profezzorn on December 10, 2017, 12:39:12 AM
MTP disk is not fully working for me.

I copied files and folder structure onto the SD card then put it into the Saberboard (V3). When I view the SD card via MTP I can see the files in the root directory and the folders, but when I go into a folder I see no files there nor can I see any subfolders.

When in an MTP connection I was able to create a folder but not copy any files to the SD card.

I am using Windows 7 (I saw a PJRC forum post that said maybe Windows 7 doesn't work, only Windows 10). And installed the latest Teensyduino.

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.

Title: Re: TeensySaber Software Discussion
Post by: bobi-one on December 11, 2017, 02:23:51 AM
One question about the templates (c++ in embeded is nightmare for me :D) Im Trying to do a custom preset that allows me to switch the color and font from the BLE App. I taught of doing it as separate implementation. But You might have already considered this idea while designing the whole class structure.

Secondly, I believe we need some persistence class, In order to save configuration in the eeprom for example. Its quite handy when going to Conventions and putting the blade plug will force you to browse through the presets over and over again to find the one you prefer for the event.

Regards,
Boyko

Unfortunately, I did not consider the need for dynamic configuration when I designed the blade configuration classes. However, I did think long and hard about it while working on the bluetooth stuff.

I haven't implemented anything yet, but my idea was to to implement support for reading the presets from a config file on the SD card.  Since I don't want to create an entire configuration language, the blade configuration would be as simple as a template name and a couple of colors/numbers.  The bluetooth configuration app would then update the settings by simply re-writing the configuration file.

The trick will be to provide a comprehensive list of name -> blade templates.
While using the eeprom does have some advantages (doesn't interfere with the sound for one thing) the SD card makes it a lot simpler to access and see what's going on, and it also makes it possible to edit the config file the old-fashion way.

Lets make it the safe way - Sd card and eeprom. For example 1st boot will load configuration file to eeprom, as you can never trust  memory with a mechanical connection :D. I even believe when MTP is fully tested functional, that eMMC  chip will be the best thing to use in the future.
The other consideration is that you may program one hilt to act in certain way, but if you reuse the SD card to other hilt, you may  need completly diferent configuration - > SD provides default config, and user config stays in EEPROM.

One other thing is about the Bluetooth boards,
For the T1 diabetes society we use a clever board called xbridge which is basically a wixel and a HM-XX bluetooth board,
The MCU uses the AT commands to change the name and password  of the HM module, and same way can be done here. And on evry init will check if the connected Bluetooth module is correctly configured.

Title: Re: TeensySaber Software Discussion
Post by: Kouri on December 11, 2017, 05:35:41 AM
Well that multi-blade revision is most welcome. Going to see if I can mount a single NeoPixel somewhere on the hilt with style_charging so I don't need to dedicate an entire blade preset for power indication.
Title: Re: MTP folders
Post by: KanyonKris on December 11, 2017, 10:12:43 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.
Title: Re: MTP folders
Post by: profezzorn 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. :)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor 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
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.

Title: Re: TeensySaber Software Discussion
Post by: TTFRAZ 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.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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 (http://fredrik.hubbe.net/lightsaber/teensy_saber.html).
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.

Title: Re: TeensySaber Software Discussion
Post by: KanyonKris 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.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.)
Title: Re: TeensySaber Software Discussion
Post by: Fletch 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????
Title: Re: TeensySaber Software Discussion
Post by: Fletch 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.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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. :)
Title: Re: TeensySaber Software Discussion
Post by: Fletch 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!!
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.
Title: ENABLE_AUDIO
Post by: KanyonKris 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;
    }
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris 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?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn 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.
Title: PL9823 blade + 1 LED
Post by: KanyonKris on December 19, 2017, 11:14:26 PM
I see in the release notes for 1.175 along with 8 blades this also supports auxiliary LEDs, but I'm having trouble figuring out how it works.

I have a saber with a PL9823 string for the main blade and a red accent ring around the main power button.  I'd like to control the red accent ring, make it pulse, flash, etc. How do I configure it?
Title: Re: ENABLE_AUDIO
Post by: profezzorn on December 19, 2017, 11:17:32 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;
    }

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;
    }

Thanks for the patches, I will make sure that future versions compile without ENABLE_AUDIO
Title: Re: TeensySaber Software Discussion
Post by: spearson on December 26, 2017, 09:24:42 AM
Question,

I broke my buttons (used super glue on the plungers and it soaked all around and ruined the buttons), so I've been doing my testing using serial monitor and I have disconnected the physical buttons.   I have my fonts loaded, and they seem to be working correctly, but I have a couple issues and I'm not sure if it's just using Serial Monitor that is the problem, or something else.

1)  Verify - Upload - Open Serial Monitor -- sometimes first LED is lit green, no sound, nothing else on.
2)  Using either "on" or "pow", ignites the saber, blade lights up, out sound and hum starts
3)  Using either "off" or "pow", this turns the blade off, but most of the time with the following issues:
-- The very first pixel stays lit, sometimes green, sometimes blue, sometimes off.
-- hum does not turn off

If I power on, and power off a couple times, the first pixel will turn off
The only way to get hum to turn off, is to press the "aux" button (or rather type the command).

I have also clipped off 3 LEDS from my my 144 LED strip.  I have set both spots that I can find with 141 from 144:
{   10000, WS2811BladePtr<141, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(presets) },
const unsigned int maxLedsPerStrip = 141;

Any thoughts?  I'm working on getting my physical buttons replaced, but until I'll keep plugging away.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 26, 2017, 10:15:38 AM
Question,

I broke my buttons (used super glue on the plungers and it soaked all around and ruined the buttons), so I've been doing my testing using serial monitor and I have disconnected the physical buttons.   I have my fonts loaded, and they seem to be working correctly, but I have a couple issues and I'm not sure if it's just using Serial Monitor that is the problem, or something else.

1)  Verify - Upload - Open Serial Monitor -- sometimes first LED is lit green, no sound, nothing else on.
2)  Using either "on" or "pow", ignites the saber, blade lights up, out sound and hum starts
3)  Using either "off" or "pow", this turns the blade off, but most of the time with the following issues:
-- The very first pixel stays lit, sometimes green, sometimes blue, sometimes off.
-- hum does not turn off

If I power on, and power off a couple times, the first pixel will turn off
The only way to get hum to turn off, is to press the "aux" button (or rather type the command).

I have also clipped off 3 LEDS from my my 144 LED strip.  I have set both spots that I can find with 141 from 144:
{   10000, WS2811BladePtr<141, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(presets) },
const unsigned int maxLedsPerStrip = 141;

Any thoughts?  I'm working on getting my physical buttons replaced, but until I'll keep plugging away.

This is all quite strange. Unfortunately I'm on vacation, so I can't try things myself right now, but I have a few observations and a couple of things we can try to see if we can narrow down the problem.
First of all, what kind of sound font are you using? Is it NEC or Plecter style?
The first-pixel-problem might be an issue in the code, as other people have reported similar issues, it may also be a problem caused by not having a resistor on the neopixel data line.
(When the teensy turns off the power to the neopixels, they can still suck some power from the data line and stay on in some circumstances.)
One more thing: There is no need to change the maxLedsPerStrip constant. (But changing it shouldn't actually cause problems either, unless there is a bug in my code...)
Finally, the "whatison" command may be helpful in diagnosing why the hum keeps playing.

Title: Re: TeensySaber Software Discussion
Post by: spearson on December 26, 2017, 10:42:18 AM
I have a 100 ohm resistor on the data line, maybe that's too low from some of the things I've read.  I'll also keep an eye on when it stays on versus my battery voltage.  My voltage is now at 3.01 volts and I no longer have the first LED staying on after pow on off commands, but it is on when first connected and programmed/rebooted.   

I have an NEC font, in a directory named "fonts", and in my presets I have the directory as "fonts", and soundtrack I left blank because I don't have anything to play here.  All the basic fonts seem to play correctly, in and out, hum, clash and lockup, and the font.wav plays each time I change a preset.

The 'whatison' command outputs this after a 'pow' to turn off:
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: On (eof =  0)
Wav player 1: Off (eof =  1)
Wav player 2: Off (eof =  0)
Wav player 3: Off (eof =  0)
Wav player 4: Off (eof =  0)
Wav player 5: Off (eof =  0)

after entering "aux" command
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: Off (eof =  1)
Wav player 1: Off (eof =  0)
Wav player 2: Off (eof =  0)
Wav player 3: Off (eof =  0)
Wav player 4: Off (eof =  0)
Wav player 5: Off (eof =  0)

I'll trace through what "pow" is doing and see if I can find anything.

I might have other issues too, I just noticed that only one strip is lit up now, so that's fun.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 26, 2017, 01:12:21 PM
I have a 100 ohm resistor on the data line, maybe that's too low from some of the things I've read.  I'll also keep an eye on when it stays on versus my battery voltage.  My voltage is now at 3.01 volts and I no longer have the first LED staying on after pow on off commands, but it is on when first connected and programmed/rebooted.   

I have an NEC font, in a directory named "fonts", and in my presets I have the directory as "fonts", and soundtrack I left blank because I don't have anything to play here.  All the basic fonts seem to play correctly, in and out, hum, clash and lockup, and the font.wav plays each time I change a preset.

The 'whatison' command outputs this after a 'pow' to turn off:
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: On (eof =  0)
Wav player 1: Off (eof =  1)
Wav player 2: Off (eof =  0)
Wav player 3: Off (eof =  0)
Wav player 4: Off (eof =  0)
Wav player 5: Off (eof =  0)

after entering "aux" command
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: Off (eof =  1)
Wav player 1: Off (eof =  0)
Wav player 2: Off (eof =  0)
Wav player 3: Off (eof =  0)
Wav player 4: Off (eof =  0)
Wav player 5: Off (eof =  0)

I'll trace through what "pow" is doing and see if I can find anything.

I might have other issues too, I just noticed that only one strip is lit up now, so that's fun.

Do you have ENABLE_MOTION in your config file?
It seems like the polyphonic font handler doesn't actually turn the hum off, it only fades it to zero volume.
However, the fade is driven by the motion event handler, so it won't work if you're not receiving motion events for some reason. (Like, if ENABLE_MOTION is not defined.)

On a related note, I may have found and fixed some bugs in the polyphonic font handler, so I uploaded a new (and untested) version of the software here:  http://fredrik.hubbe.net/lightsaber/lightsaber-1.181.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.181.zip)
Also, in fonts/config.ini, is there a field called "humStart" ? If so, what is it's value?
Title: Re: TeensySaber Software Discussion
Post by: spearson on December 26, 2017, 02:02:51 PM
Well that makes sense I have ENABLE_MOTION commented out because it was preventing the Serial Monitor from working.

I do not appear to have a config.ini file. 
Title: Re: TeensySaber Software Discussion
Post by: spearson on December 26, 2017, 06:54:23 PM
I think this first LED being lit issue is probably related to a wiring issue on my blade.  I just spent the last hour playing with it and both strips were working and no LEDs were remaining lit.  But then I moved my saber, and one strip went out, and when I moved the blade I got a flicker on the bad strip + I got the first LED lit again. 

I'll redo my blade and report back. 

Can I move my data line resister to be between the board and the AV connector instead of between the string and AV connector? 
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 27, 2017, 02:07:22 AM
Well that makes sense I have ENABLE_MOTION commented out because it was preventing the Serial Monitor from working.

Well that solves that mystery.
However, if ENABLE_MOTION causes the serial monitor to not work, it would seem that you have a problem with your motion chip(s).

Can I move my data line resister to be between the board and the AV connector instead of between the string and AV connector?

Yes you can. It will add to the blade ID resistance, so if you're using blade ID to identify blades, you'll need to add the value of the resistor to each entry.
Title: Re: TeensySaber Software Discussion
Post by: spearson on December 27, 2017, 07:01:34 AM
You had it in your troubleshooting page to try disabling it and audio if the Serial Monitor wasn't working, so now that I do have it working, I'll try enabling it and see if I have any issues.
Title: Re: TeensySaber Software Discussion
Post by: TTFRAZ on December 28, 2017, 08:06:59 AM
Iím wiring up the resistor for the ws2811 and I believe the amps for the entire led strip is calculated to 9.72. And they are 5 volt led. In you example you said yours were only 3.2. Can you help figure out which resistor I should use. Or even if I can use these LEDs?
Title: Re: TeensySaber Software Discussion
Post by: TTFRAZ on December 28, 2017, 11:09:44 AM
Also I keep getting this error massage and not sure how to resolve it. I've changed multiple settings and none seem to work

Quote
Arduino: 1.8.5 (Mac OS X), TD: 1.40, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

In file included from /Users/taylorignacio/Documents/LightSabers/lightsaber/lightsaber.ino:6384:0:
Taylors_Jedi_Saber.h:18: error: cannot convert 'BladeStyle*' to 'const char*' in initialization
 };
 ^
Taylors_Jedi_Saber.h:18: error: cannot convert 'const char*' to 'BladeStyle*' in initialization
Multiple libraries were found for "SD.h"
 Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
 Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
cannot convert 'BladeStyle*' to 'const char*' in initialization

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

heres my preset page

Quote
#ifdef CONFIG_PRESETS
Preset light[] = {
   { "Corellian",
    StyleNormalPtr<OnSpark<Gradient<WHITE, CYAN>, WHITE, 800>, WHITE, 300, 500>(), "justice"},
}; <- this is the part in question
BladeConfig blades[] = {
 { 0, WS2811BladePtr<54, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(light) },
 };
#endif
Title: Re: TeensySaber Software Discussion
Post by: TTFRAZ on December 28, 2017, 01:05:15 PM
Fixed the error. Its was in the way my preset was set up

But now when i go to upload to the teensy it says the lightsaber.ino.hex is too large. has anyone experienced this before?
Title: Re: TeensySaber Software Discussion
Post by: TTFRAZ on December 28, 2017, 03:53:03 PM
Just looked into it a bit more and noticed the led on the Teensy isnít lighting up. Perhaps I fried something while soldering or thereís a wiring error. Tho I wired it up to the Teensy saber and accessories just as it was in the diagram
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 29, 2017, 01:04:55 AM
Iím wiring up the resistor for the ws2811 and I believe the amps for the entire led strip is calculated to 9.72. And they are 5 volt led. In you example you said yours were only 3.2. Can you help figure out which resistor I should use. Or even if I can use these LEDs?

The LED strips will draw less than 9.72 amps, because they won't get the full 5 volts.
WS2811 strips have internal current limiting, so they don't need resistors on the power line.
However, they do need a resistor on the data line to make sure the strip turns off properly when not in use. A 100-300 ohm resistor is recommended.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 29, 2017, 01:06:14 AM
Fixed the error. Its was in the way my preset was set up

But now when i go to upload to the teensy it says the lightsaber.ino.hex is too large. has anyone experienced this before?

That's new, did you make sure you selected "Teensy 3.1/3.2" in the boards menu?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 29, 2017, 01:07:51 AM
Just looked into it a bit more and noticed the led on the Teensy isnít lighting up. Perhaps I fried something while soldering or thereís a wiring error. Tho I wired it up to the Teensy saber and accessories just as it was in the diagram

That's normal. The LED on the teensy is connected to pin 13, which is also used for SPI communication. In teensysaber SPI is used to access the SD card, so the LED only lights up when reading from the SD card.
Title: Re: TeensySaber Software Discussion
Post by: TTFRAZ on December 29, 2017, 08:27:11 AM
Fixed the error. Its was in the way my preset was set up

But now when i go to upload to the teensy it says the lightsaber.ino.hex is too large. has anyone experienced this before?

That's new, did you make sure you selected "Teensy 3.1/3.2" in the boards menu?

yup its on teensy 3.2 / 3.1, serial, 96 MHz (overclock), Faster, US english on COM1

the teensy loader says lightsaber.ino.hex (too large!)

and when i verify and try to sync it reads
Code: [Select]
Arduino: 1.8.5 (Mac OS X), TD: 1.40, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

Build options changed, rebuilding all
Sketch uses 158432 bytes (60%) of program storage space. Maximum is 262144 bytes.
Global variables use 25788 bytes (39%) of dynamic memory, leaving 39748 bytes for local variables. Maximum is 65536 bytes.
Teensy did not respond to a USB-based request to enter program mode.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 


Title: Re: TeensySaber Software Discussion
Post by: spearson on December 29, 2017, 10:14:29 AM
For what it's worth, I had a similar problem but mine was because of lack of power to my teensy board.  When I jumped the teensy power back together (the one you cut) my teensy lit up, so I needed to add a connection from bat neg to ground on my V2.
Title: Re: TeensySaber Software Discussion
Post by: spearson on December 29, 2017, 10:17:34 AM
Quick update, renabled motion and the serial monitor worked, and my hum now fades out.  Though there is a strange issue where after I reprogram and the teensy reboots the motion chip fails to start so I need to insert the kill key and pull it for it to work again.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 29, 2017, 10:40:30 AM
Fixed the error. Its was in the way my preset was set up

But now when i go to upload to the teensy it says the lightsaber.ino.hex is too large. has anyone experienced this before?

That's new, did you make sure you selected "Teensy 3.1/3.2" in the boards menu?

yup its on teensy 3.2 / 3.1, serial, 96 MHz (overclock), Faster, US english on COM1

the teensy loader says lightsaber.ino.hex (too large!)

and when i verify and try to sync it reads
Code: [Select]
Arduino: 1.8.5 (Mac OS X), TD: 1.40, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"

Build options changed, rebuilding all
Sketch uses 158432 bytes (60%) of program storage space. Maximum is 262144 bytes.
Global variables use 25788 bytes (39%) of dynamic memory, leaving 39748 bytes for local variables. Maximum is 65536 bytes.
Teensy did not respond to a USB-based request to enter program mode.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 


This doesn't say that the program is too large. It says it can't reset the teensy. You might just need to press the button. Or, the teensy doesn't have power.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on December 29, 2017, 10:44:54 AM
Quick update, renabled motion and the serial monitor worked, and my hum now fades out.  Though there is a strange issue where after I reprogram and the teensy reboots the motion chip fails to start so I need to insert the kill key and pull it for it to work again.

This happens because the programming interrupts the motion chip communication, so the motion chip is waiting for the teensy to read more bytes. The code tried to work around this, but it doesn't always work.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on December 29, 2017, 04:35:06 PM
yup its on teensy 3.2 / 3.1, serial, 96 MHz (overclock), Faster, US english on COM1
I've never seen a Teensy on COM1, usually that's a default Windows serial port (often it doesn't exist). Go into the Tools | Port menu and try selecting a different port, usually the correct port says "Teensy" next to it.
Title: Invert X
Post by: KanyonKris on January 05, 2018, 12:36:56 PM
A few of us mounted the saber board backwards (SD card toward the blade) which means the X axis of the IMU is inverted and drag mode doesn't work. Here's how I fixed it just for drag mode.

Added a new define for the config.h file:
Code: [Select]
// If the TeensySaber is backward (SD card toward blade), define this. The drag effect won't work if this is wrong.
#define INVERT_X

And added an ifdef to the drag/clash case:
Code: [Select]
      case EVENTID(BUTTON_AUX, EVENT_PRESSED, MODE_ON):
#ifdef INVERT_X
        accel_.x = -accel_.x;
#endif
        if (accel_.x < -0.15) {
          pointing_down_ = true;
        } else {
          pointing_down_ = false;
        }
        break;

I tried to figure out how to invert the X axis at a lower level, but couldn't (I'm not a skilled coder).

Should both the X and Y axis be inverted together since they are on the same plane?

Should there be a way to invert the Z axis? I don't think so, just asking.
Title: ENABLE_SNOOZE
Post by: KanyonKris on January 05, 2018, 12:53:16 PM
Is ENABLE_SNOOZE safe to use? In all the example config files it's commented out which makes me hesitant.

Looks like it snoozes after 1 second.  So this puts the Teensey into a low power mode waiting for an interrupt (button press) to wake it up.

Does it also cut power to the blade (via the FETs)? I have a PL9823 string blade and it draws a fair amount of current even if all the LEDs are off. Would be nice to stop this power draw if I forget to pull the blade (kill switch).
Title: Lotsa config commenting
Post by: KanyonKris on January 05, 2018, 01:26:28 PM
I like documentation in comments. Here's my config file with lots of comments added for all the templates for the presets, color names, etc.

Code: [Select]
#ifdef CONFIG_TOP
  #include "v3_config.h"
  // Number of simultaneously connected blades. (For interchangeable blades, see the blades[] array.)
  #define NUM_BLADES 1
  // Number of buttons
  #define NUM_BUTTONS 1
  // Dual power buttons means that clicking AUX will also turn the saber on. If not defined, AUX will go to next preset when off.
//  #define DUAL_POWER_BUTTONS
  // Volume, useful range is about 0-2000.
  #define VOLUME 1000
  // Number of LEDs connected together in the blade.
  // If you have two 144 LED/m strips in your blade, connect both of them to bladePin and drive them in parallel.
  const unsigned int maxLedsPerStrip = 81;
  // This defines how sensetive the clash detection is.
  #define CLASH_THRESHOLD_G 1.2
  // If the TeensySaber is backward (SD card toward blade), define this. The drag effect won't work if this is wrong.
//  #define INVERT_X
  // Define this if your power button is a touch button.
//  #define POWER_TOUCHBUTTON_SENSITIVITY 1700
//  #define AUX_TOUCHBUTTON_SENSITIVITY 1700
//  #define AUX2_TOUCHBUTTON_SENSITIVITY 1700
  // For V1 electronics, there is an external pullup resistor to measure battery voltage. This specifies how many Ohms it is.
  #define BATTERY_PULLUP_OHMS 23000
  // If your electonics inverts the bladePin for some reason, define this.
//  #define INVERT_WS2811
  // Feature defines, these let you turn off large blocks of code used for debugging.
  #define ENABLE_AUDIO
  #define ENABLE_MOTION
//  #define ENABLE_SNOOZE
  #define ENABLE_WS2811
  // FASTLED is experimental and untested right now
//  #define ENABLE_FASTLED
//  #define ENABLE_WATCHDOG
  #define ENABLE_SD
//  #define ENABLE_SERIALFLASH
  #define ENABLE_SERIAL
#endif  // CONFIG_TOP

#ifdef CONFIG_PRESETS

// *** CONFIGURABLE ***
// PRESETS
// Each preset line consists of:
// { "font directory", "sound track", Style, "name" },
// The first entry is a directory containing a sound font.
// The second entry is a sound track that can be played in the background.
// The third entry is a BladeStyle pointer, which specifies what the blade will actually look like.
// The forth entry is an optional name for the preset.
// Style may be one of these standard styles:
//   StyleNormalPtr<BaseColor, FlashColor, out millis, in millis>()
//   StyleFirePtr<LowHeatColor, HighHeatColor>()
//   StyleRainBowPtr<out millis, in millis>()
//   StyleStrobePtr<BaseColor, FlashColor, out millis, in millis>()
//   &style_charging
// Or Style may be a template built of these components:
//   Rgb<R, G, B> - Solid 8-bit color. (Rgb<255,255,255> is white)
//   Rgb16<R, G, B> - Solid 16-bit color. (Rgb<65536,65536,65536> is white)
//   Gradient<BASE_COLOR, TIP_COLOR> - smooth fade from base to tip
//   Rainbow - scrolling RGB rainbow
//   Pulsing<COLOR1, COLOR2, pulse_millis> - smoothly translate between COLOR1 and COLOR2 every pulse_millis.
//   RandomFlicker<COLOR1, COLOR2> - Randomly mixes between COLOR1 and COLOR2, mix is even over entire blade.
//   RandomPerLEDFlicker<COLOR1, COLOR2> - Randomly mixes between COLOR1 and COLOR2, mix is different for each LED.
//   AudioFlicker<COLOR1, COLOR2> - Like RandomFlicker, but chooses based on audio, quiet audio means more COLOR1, loud audio means more COLOR2. The choice is made based on a single sample to make it flickery.
//   OnSpark<COLOR, SPARK_COLOR, MILLIS> - Normally defaults to "COLOR", but right as you turn on the saber, it uses SPARK_COLOR, then fads back to COLOR.
//   SimpleClash<COLOR, CLASH_COLOR, CLASH_MILLIS> - Normally defaults to "COLOR", but when you whack the saber, it will use CLASH_COLOR for CLASH_MILLIS millseconds.
//   Lockup<COLOR, LOCKUP_COLOR> - Normally uses "COLOR", but during lockup, use "LOCKUP_COLOR" instead.
//   Strobe<COLOR, STROBE_COLOR, FREQUENCY, STROBE_MILLIS> - Similar to SimpleClash, but flickers at a fixed frequency.
//   InOutHelper<COLOR, OUT_MILLIS, IN_MILLIS> - Makes part of the blade black to make in/out/on/off work the way you expect.
//   InOutSparkTip<COLOR, OUT_MILLIS, IN_MILLIS, SPARK_COLOR> - Similar to InOutHelper, but as the blade is extended, the part closest to the tip will be SPARK_COLOR. (usually white)
//   BrownNoiseFlicker<COLOR1, COLOR2, GRADE> - Randomly selects between COLOR1 and COLOR2, but keeps nearby pixels looking similar.
//   HumpFlicker<COLOR1, COLOR2, HUMP_WIDTH> - Makes a random "hump" which is about 2xHUMP_WIDTH leds wide.
//   RGBCycle - Very fast Red, Green, Blue cycle, result should essentially be white until you start swinging it around.
//   EasyBlade<COLOR, CLASH_COLOR> = SimpleClash<Lockup<Blast<COLOR, WHITE>, AudioFlicker<COLOR, WHITE> >, CLASH_COLOR>;
//   StylePtr<COLOR> - Converts one of the templates from above to a BladeStylePtr so you can use it in a preset array.
// Now here's the really cool part: Anywhere where you can specify a color above, you can also specify a component, making a LOT of combinations possible.
// All colors can be specified as three numbers or using one the handy macros below.
// If you wish to have different presets for different blades, copy this array and
// name it something other than "preset", then use the new name inside the blade
// configuration array below. See "simple_presets" and "charging_presets"
// below for examples.
// Basic color macros: RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, WHITE, GRAY, BLACK
// Extended color macros: AliceBlue, Aqua, Aquamarine, Azure, Bisque, Black, BlanchedAlmond, Blue
//  Chartreuse, Coral, Cornsilk, Cyan, DarkOrange, DeepPink, DeepSkyBlue, DodgerBlue
//  FloralWhite, Fuchsia, GhostWhite, Green, GreenYellow, HoneyDew, HotPink, Ivory
//  LavenderBlush, LemonChiffon, LightCyan, LightPink, LightSalmon, LightYellow, Lime
//  Magenta, MintCream, MistyRose, Moccasin, NavajoWhite, Orange, OrangeRed
//  PapayaWhip, PeachPuff, Pink, Red, SeaShell, Snow, SpringGreen, SteelBlue
//  Tomato, White, Yellow

Preset presets[] = {
   { "f-stndrd", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },
   { "f-stndrd", "tracks/track.wav", StyleNormalPtr<RED, WHITE, 300, 800>(), "red" },
   { "f-stndrd", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<DarkOrange, YELLOW>, 300, 800> >(), "orange" },
   { "f-stndrd", "tracks/swtheme.wav", StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan" },
   { "f-stndrd", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },
   { "f-stndrd", "tracks/track.wav", StylePtr<InOutHelper<EasyBlade<OnSpark<GREEN>, WHITE>, 300, 800> >(), "green" },
   { "f-stndrd", "tracks/impmarch.wav", StyleFirePtr<RED, YELLOW>(), "fire" },
   { "f-stndrd", "tracks/track.wav", StyleFirePtr<BLUE, CYAN>(), "blue fire" },
   { "f-stndrd", "tracks/track.wav", StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white" },
   { "f-stndrd", "tracks/track.wav", StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow" },
   { "f-stndrd", "tracks/cantina.wav", StyleRainbowPtr<300, 800>(), "rainbow" },
   { "f-stndrd", "tracks/track.wav", StylePtr<InOutSparkTip<EasyBlade<MAGENTA, WHITE>, 300, 800> >(), "magenta" },
   { "f-stndrd", "tracks/track.wav", StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"},
//   { "f-stndrd", "tracks/track.wav", &style_pov, "POV"},
   { "f-stndrd", "tracks/track.wav", &style_charging, "Battery\nLevel"},
   { "charging", "tracks/duel.wav", &style_charging, "battery" },
};

Preset charging_presets[] = {
  { "charging", "", &style_charging },
};

// WS2811_800kHz 0x00      // Nearly all WS2811 are 800 kHz
// WS2811_400kHz 0x10      // Adafruit's Flora Pixels
// WS2813_800kHz 0x20      // WS2813 are close to 800 kHz but has 300 us frame set delay
// WS2811_580kHz 0x30      // PL9823
// WS2811_ACTUALLY_800kHz 0x40      // Normally we use 740kHz instead of 800, this uses 800.

// WS2811_RGB       // The WS2811 datasheet documents this way
// WS2811_RBG
// WS2811_GRB       // Most LED strips are wired this way
// WS2811_GBR

BladeConfig blades[] = {
    // PL9823 blade. Resistor is 2.6k but is measuring way higher. Blade measures: ID: 680 volts 2.19 resistance= 65232.56, ID: 708 volts 2.28 resistance= 73936.70
 { 65000, WS2811BladePtr<maxLedsPerStrip, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(presets) },
  // Charging adapter, single PL9823 LED. Charger measures: ID: 489 volts 1.58 resistance= 30162.62
 { 30000, WS2811BladePtr<1, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(charging_presets) },
  // For testing (makes the charging blade behave like a normal blade.)
  //  {  30000, WS2811BladePtr<1, WS2811_580kHz | WS2811_RGB>(), CONFIGARRAY(presets) },
};
#endif  // CONFIG_PRESETS

#ifdef CONFIG_BUTTONS
  Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
//  TouchButton PowerButton(BUTTON_POWER, powerButtonPin, 1700, "pow");
//  Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif
Title: Re: Invert X
Post by: profezzorn on January 06, 2018, 09:05:57 PM
A few of us mounted the saber board backwards (SD card toward the blade) which means the X axis of the IMU is inverted and drag mode doesn't work. Here's how I fixed it just for drag mode.

Added a new define for the config.h file:
Code: [Select]
// If the TeensySaber is backward (SD card toward blade), define this. The drag effect won't work if this is wrong.
#define INVERT_X

And added an ifdef to the drag/clash case:
Code: [Select]
      case EVENTID(BUTTON_AUX, EVENT_PRESSED, MODE_ON):
#ifdef INVERT_X
        accel_.x = -accel_.x;
#endif
        if (accel_.x < -0.15) {
          pointing_down_ = true;
        } else {
          pointing_down_ = false;
        }
        break;

I tried to figure out how to invert the X axis at a lower level, but couldn't (I'm not a skilled coder).

Should both the X and Y axis be inverted together since they are on the same plane?

Should there be a way to invert the Z axis? I don't think so, just asking.

I'll add a way to change the orientation in the next version.
(Just don't let me forget...)
Title: Re: ENABLE_SNOOZE
Post by: profezzorn on January 06, 2018, 09:10:21 PM
Is ENABLE_SNOOZE safe to use? In all the example config files it's commented out which makes me hesitant.

Looks like it snoozes after 1 second.  So this puts the Teensey into a low power mode waiting for an interrupt (button press) to wake it up.

Does it also cut power to the blade (via the FETs)? I have a PL9823 string blade and it draws a fair amount of current even if all the LEDs are off. Would be nice to stop this power draw if I forget to pull the blade (kill switch).

The blade power is automatically disabled weather you have ENABLE_SNOOZE on or not, as long as the blade style calls the allow_disable() function.

ENABLE_SNOOZE doesn't really work. I've experimented with it quite a bit, and it's possible to reduce power consumption, but it messes with USB communication which can make it difficult to re-program the teensy without pushing the reset button. Also, the power savings are not that big, because the power booster always keeps running.
Title: Re: ENABLE_SNOOZE
Post by: KanyonKris on January 06, 2018, 10:16:33 PM
The blade power is automatically disabled weather you have ENABLE_SNOOZE on or not, as long as the blade style calls the allow_disable() function.

ENABLE_SNOOZE doesn't really work. I've experimented with it quite a bit, and it's possible to reduce power consumption, but it messes with USB communication which can make it difficult to re-program the teensy without pushing the reset button. Also, the power savings are not that big, because the power booster always keeps running.
<slaps forhead> of course the code turns off the FETs when the blade is off. Thanks for confirming the obvious. When we were soldering the LEDs into string we'd test them with a bench supply and a simple program to turn the LEDs on and off and that's when we saw how much power they draw even when digitally commanded to all off, so that's what threw me.

And thanks for the info about ENABLE_SNOOZE. I agree the power savings would be minimal so not worth messing with.
Title: Re: TeensySaber Software Discussion
Post by: spearson on January 09, 2018, 03:45:17 PM
Update, re-soldered my blade connections and now no more random on LEDs, so that's good, and all my effects are working.

I think I may have some font issues though.  I'm using a polyphonic font and I'm getting 2 things don't seem right.

1) The hum fades out when power button is clicked, but the Amplifier does not turn off, I can hear it.  When I hit Aux and it goes to the next preset, then the Amp turns off.  Previously we thought it was because Motion was turned off and preventing the fade out, but that part is actually working now.  Is that something with the font do you think, or code? 

2) I'm getting 'Wrong Format' on my swing files, which is weird because they are no different than all the other files, and they play just fine in windows media player.

Here is some snippets of Serial Monitor logs:

Sdcard found..
ID: 224 volts 0.72 resistance= 9240.00
blade= 0
WS2811 Blade with 144 leds
Scanning sound font: fonts done
Activating polyphonic font.
unit = 0 vol = 0.50, No sounds found: boot
Amplifier off.
Motion setup ... done.
Welcome to TeensySaber, type 'help' for more info.

EVENT: Power-Pressed
EVENT: Power-Released
EVENT: Power-Shortclick
Ignition.
unit = 0 vol = 0.50, Playing fonts/hum/hum01.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.50, Playing fonts/out/out02.wav
channels: 1 rate: 22050 bits: 16

//Power button to turn off
EVENT: Power-Pressed ON
EVENT: Power-Released ON
EVENT: Power-Shortclick ON
unit = 1 vol = 0.50, Playing fonts/in/in02.wav
channels: 1 rate: 22050 bits: 16
Battery voltage: 3.87

//whatison
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: On (eof =  0 volume = 0.00)
Wav player 1: Off (eof =  1 volume = 0.50)
Wav player 2: Off (eof =  0 volume = 0.50)
Wav player 3: Off (eof =  0 volume = 0.50)
Wav player 4: Off (eof =  0 volume = 0.50)
Wav player 5: Off (eof =  0 volume = 0.50)

//aux button to change presets
EVENT: Aux-Pressed
EVENT: Aux-Released
EVENT: Aux-Shortclick
DISPLAY: blue
Scanning sound font: fonts done
Activating polyphonic font.
unit = 0 vol = 0.50, Playing fonts/font.wav
channels: 1 rate: 22050 bits: 16
Amplifier off.

//whatison
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: Off (eof =  1 volume = 0.50)
Wav player 1: Off (eof =  0 volume = 0.50)
Wav player 2: Off (eof =  0 volume = 0.50)
Wav player 3: Off (eof =  0 volume = 0.50)
Wav player 4: Off (eof =  0 volume = 0.50)
Wav player 5: Off (eof =  0 volume = 0.50)


EVENT: Power-Pressed
EVENT: Power-Released
EVENT: Power-Shortclick
Ignition.
unit = 0 vol = 0.50, Playing fonts/hum/hum01.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.50, Playing fonts/out/out03.wav
channels: 1 rate: 22050 bits: 16
Battery voltage: 3.71

unit = 1 vol = 0.50, Playing fonts/swng/swng06.wav
Wrong format.
EVENT: Clash ON
unit = 1 vol = 0.50, Playing fonts/clsh/clsh13.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing fonts/clsh/clsh03.wav
channels: 1 rate: 22050 bits: 16
unit = 3 vol = 0.50, Playing fonts/swng/swng01.wav
Wrong format.
unit = 3 vol = 0.50, Playing fonts/swng/swng04.wav
Wrong format.
unit = 3 vol = 0.50, Playing fonts/swng/swng07.wav
Wrong format.


Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 09, 2018, 03:58:03 PM
Update, re-soldered my blade connections and now no more random on LEDs, so that's good, and all my effects are working.

I think I may have some font issues though.  I'm using a polyphonic font and I'm getting 2 things don't seem right.

1) The hum fades out when power button is clicked, but the Amplifier does not turn off, I can hear it.  When I hit Aux and it goes to the next preset, then the Amp turns off.  Previously we thought it was because Motion was turned off and preventing the fade out, but that part is actually working now.  Is that something with the font do you think, or code? 


I think that might be a bug in my code, not your fault.

Quote

2) I'm getting 'Wrong Format' on my swing files, which is weird because they are no different than all the other files, and they play just fine in windows media player.

Here is some snippets of Serial Monitor logs:

Sdcard found..
ID: 224 volts 0.72 resistance= 9240.00
blade= 0
WS2811 Blade with 144 leds
Scanning sound font: fonts done
Activating polyphonic font.
unit = 0 vol = 0.50, No sounds found: boot
Amplifier off.
Motion setup ... done.
Welcome to TeensySaber, type 'help' for more info.

EVENT: Power-Pressed
EVENT: Power-Released
EVENT: Power-Shortclick
Ignition.
unit = 0 vol = 0.50, Playing fonts/hum/hum01.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.50, Playing fonts/out/out02.wav
channels: 1 rate: 22050 bits: 16

//Power button to turn off
EVENT: Power-Pressed ON
EVENT: Power-Released ON
EVENT: Power-Shortclick ON
unit = 1 vol = 0.50, Playing fonts/in/in02.wav
channels: 1 rate: 22050 bits: 16
Battery voltage: 3.87

//whatison
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: On (eof =  0 volume = 0.00)
Wav player 1: Off (eof =  1 volume = 0.50)
Wav player 2: Off (eof =  0 volume = 0.50)
Wav player 3: Off (eof =  0 volume = 0.50)
Wav player 4: Off (eof =  0 volume = 0.50)
Wav player 5: Off (eof =  0 volume = 0.50)

//aux button to change presets
EVENT: Aux-Pressed
EVENT: Aux-Released
EVENT: Aux-Shortclick
DISPLAY: blue
Scanning sound font: fonts done
Activating polyphonic font.
unit = 0 vol = 0.50, Playing fonts/font.wav
channels: 1 rate: 22050 bits: 16
Amplifier off.

//whatison
Saber bases: Off
Audio splicer: Off
Beeper: Off
Talker: Off
Wav player 0: Off (eof =  1 volume = 0.50)
Wav player 1: Off (eof =  0 volume = 0.50)
Wav player 2: Off (eof =  0 volume = 0.50)
Wav player 3: Off (eof =  0 volume = 0.50)
Wav player 4: Off (eof =  0 volume = 0.50)
Wav player 5: Off (eof =  0 volume = 0.50)


EVENT: Power-Pressed
EVENT: Power-Released
EVENT: Power-Shortclick
Ignition.
unit = 0 vol = 0.50, Playing fonts/hum/hum01.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.50, Playing fonts/out/out03.wav
channels: 1 rate: 22050 bits: 16
Battery voltage: 3.71

unit = 1 vol = 0.50, Playing fonts/swng/swng06.wav
Wrong format.
EVENT: Clash ON
unit = 1 vol = 0.50, Playing fonts/clsh/clsh13.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing fonts/clsh/clsh03.wav
channels: 1 rate: 22050 bits: 16
unit = 3 vol = 0.50, Playing fonts/swng/swng01.wav
Wrong format.
unit = 3 vol = 0.50, Playing fonts/swng/swng04.wav
Wrong format.
unit = 3 vol = 0.50, Playing fonts/swng/swng07.wav
Wrong format.

"wrong format" generally means that the wav file is not saved as PCM.
Where did this font come from? Can I download and try it? Or could you send it to me at hubbe@hubbe.net?


Title: Re: TeensySaber Software Discussion
Post by: spearson on January 09, 2018, 04:11:44 PM
I bought it off of saberfont.com. 

I'll send it to you, I just noticed (using VLC) that the swng fonts are 44100 32bit, which may be the issue according to your troubleshooting page.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 09, 2018, 04:26:12 PM
I bought it off of saberfont.com. 

I'll send it to you, I just noticed (using VLC) that the swng fonts are 44100 32bit, which may be the issue according to your troubleshooting page.

Could be, although I don't think you would get that error message for 32bit files.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 22, 2018, 11:44:13 PM
New TeensySaber software version: 1.191

ChangeLog (since 1.175)
o SmoothSwing V2 support!!! - Demo: SmoothSwing v2 Multiple Font Demo - YouTube (https://www.youtube.com/watch?v=LHpzbtBo-5w) Many thanks to Thexter for his excellent work on this algorithm.
o Better wav reader - skips comments and handles 24-bit wav files
o Cylon - back-and-forth effect
o Clash sensitivity is reduced when swinging.

Same Bat time, same Bat channel:
Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)

Title: Re: TeensySaber Software Discussion
Post by: bobi-one on January 23, 2018, 01:25:59 AM
New TeensySaber software version: 1.191

ChangeLog (since 1.175)
o SmoothSwing V2 support!!! - Demo: SmoothSwing v2 Multiple Font Demo - YouTube (https://www.youtube.com/watch?v=LHpzbtBo-5w) Many thanks to Thexter for his excellent work on this algorithm.
o Better wav reader - skips comments and handles 24-bit wav files
o Cylon - back-and-forth effect
o Clash sensitivity is reduced when swinging.

Same Bat time, same Bat channel:
Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)
Pure Epic awesomeness. Do you still change the swingl and swingh files as before? Maybe I will automate it in a bash script, to make  configurable variety of swings.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on January 23, 2018, 08:20:31 AM
New TeensySaber software version: 1.191
Cool, all good stuff!

Ditto bobi-one, do I need to redo the swingl and swingh files?

Since you asked me to remind you, did you add code for inverting the X (and possibly other) axis?
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on January 23, 2018, 10:02:57 AM
Additional info on SmoothSwing V2 is on the Teensy Saber OS page near the bottom - Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)

Looks like V2 now supports more than one swingl.wav and swingh.wav file (ie. swingl01.wav, swingl02.wav)

I guess I'll start with my swingl.wav and swinh.wav I made based on profezzorn's instructions (https://www.fx-sabers.com/forum/index.php?topic=51430.msg652617#msg652617):

Code: [Select]
sox hum.wav swingh.wav speed -180c rate -v
sox hum.wav swingl.wav speed 150c rate -v
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 23, 2018, 11:01:48 AM
Additional info on SmoothSwing V2 is on the Teensy Saber OS page near the bottom - Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)

Looks like V2 now supports more than one swingl.wav and swingh.wav file (ie. swingl01.wav, swingl02.wav)

I guess I'll start with my swingl.wav and swinh.wav I made based on profezzorn's instructions (https://www.fx-sabers.com/forum/index.php?topic=51430.msg652617#msg652617):

Code: [Select]
sox hum.wav swingh.wav speed -180c rate -v
sox hum.wav swingl.wav speed 150c rate -v


For smoothswing V2 you'll want multiple swingl/swingh pairs.
(Although multiple swingl/swingh is good for smoothswing v1 as well, but in a different way.)
I've been using something like this:

Code: [Select]
sox hum.wav swingl01.wav pitch -200 tremolo 12 60 overdrive 15 75
sox hum.wav swingh01.wav pitch 150 tremolo 12 60 overdrive 15 75

Then you change a few of the parameters to make swingl02/swingh02, etc.
A formant filter to change the tonal quality of the hum would be even better, but sox doesn't have that.
Also, taking a the hum from a different font may be better than using the hum from the same font.
However, Thexter's sounds are much better than mine, and hopefully other people will start experiment and add their own tricks when creating these files.

And no, I did not add code for the orientation yet, as I couldn't decide on the best way to do it, thanks for the reminder.

Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on January 23, 2018, 04:42:24 PM
Feedback:

On the Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html) page it says the file is somoothsw.ini, should be smoothsw.ini

lightsaber.ino on GitHub at line 172 is:
Code: [Select]
const char version[] = "$Id$";I think it needs more Id info like 1.175:
Code: [Select]
const char version[] = "$Id: lightsaber.ino,v 1.175 2017/12/10 01:16:22 hubbe Exp $";
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 23, 2018, 07:05:22 PM
Feedback:

On the Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html) page it says the file is somoothsw.ini, should be smoothsw.ini

lightsaber.ino on GitHub at line 172 is:
Code: [Select]
const char version[] = "$Id$";I think it needs more Id info like 1.175:
Code: [Select]
const char version[] = "$Id: lightsaber.ino,v 1.175 2017/12/10 01:16:22 hubbe Exp $";

Thank you, the typo is fixed.
The $Id$ thing comes from CVS, and the cvs-to-git script I'm using doesn't support it unfortunately.
If/When I move all development to github, I will stop using the $Id$ thing and just update the version manually.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on January 25, 2018, 11:56:19 AM
For smoothswing V2 you'll want multiple swingl/swingh pairs.
Are the swingl/swingh pairs selected randomly or does the order mean something? I'm wondering if smoothswing V2 selects the lower pairs (ie swingl01.wav, swingh01.wav) for slow swings and higher pairs (ie swingl05.wav, swingh05.wav) for faster swings. If smoothswing V2 doesn't work this way, should it? Then the pairs could have more aggressive sound as the pair numbers go up.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 25, 2018, 12:08:01 PM
For smoothswing V2 you'll want multiple swingl/swingh pairs.
Are the swingl/swingh pairs selected randomly or does the order mean something? I'm wondering if smoothswing V2 selects the lower pairs (ie swingl01.wav, swingh01.wav) for slow swings and higher pairs (ie swingl05.wav, swingh05.wav) for faster swings. If smoothswing V2 doesn't work this way, should it? Then the pairs could have more aggressive sound as the pair numbers go up.

They are selected randomly.
It's possible that there is a better way to select swing sounds, but I guess that would be called SmoothSwing V3. :)
Not sure how well it would work though, as it's very difficult to know how aggressive the swing is going to be in the beginning of the swing. Also, I'm not sure that it's actually better than random. I mean, if you do the same swing over and over, do you want it to sound the same?
Title: Re: TeensySaber Software Discussion
Post by: spearson on January 28, 2018, 06:37:22 PM
Two questions on smooth swing,

1) What is a good length of a hum file to use?  I have some hums from a different font and the hum file is only 2 seconds long.  This causes a strange speaker pop/crackle every 2 seconds when there is no swinging (like sitting stationary on the desk).

2) The files are named swingl and swingh, these seem to coincide with monophonic font names, should I do something different if I have a polyphonic font(swngl and swngh), or does that not matter?  If it doesn't matter, can my swingl and h files be made from mono font even though I have a polyphonic font?
Title: Re: TeensySaber Software Discussion
Post by: spearson on January 28, 2018, 07:19:24 PM
volHum and volEff are set at 15 and 16, what does 15/16 represent, a percentage out of 100?  I have my overall volume at 1750, and my effects are ear piercing, the hum volume is perfect, and the swinging I wish I could get louder.  I've been playing with changing volHum and volEff (via config file) but it doesn't seem to have an effect.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on January 28, 2018, 08:58:21 PM
Two questions on smooth swing,

1) What is a good length of a hum file to use?  I have some hums from a different font and the hum file is only 2 seconds long.  This causes a strange speaker pop/crackle every 2 seconds when there is no swinging (like sitting stationary on the desk).

2) The files are named swingl and swingh, these seem to coincide with monophonic font names, should I do something different if I have a polyphonic font(swngl and swngh), or does that not matter?  If it doesn't matter, can my swingl and h files be made from mono font even though I have a polyphonic font?

1. Generally speaking, longer is better, because it makes the sound less repetitive. Beyond 20 seconds it probably doesn't matter though.
The pop/crackle isn't a good thing though. My best guess is that you get an underflow on the main hum while the other two hums are re-opened.
Things to try that may fix it:

a) Try a different sd card (I mostly use Sandisk.)
b) Make sure your sounds are 16-bit mono. (24/32-bit and stereo are a waste of sd card bandwidth.)
c) Try making the hums different lengths. This will make them loop around at different times.
d) Increase the buffer in BufferedWavPlayer (I've been considering doing this myself...)

Note to self: add sd card bandwidth latency/bandwidth testing command to teensysaber...

2. The SmoothSwing V1/V2 is implemented separately from the font renderer, which means that it works with both polyphonic and monophonic fonts. However, with monophonic fonts, clashes and blast effects will be be toned down while swinging, with polyphonic fonts they will not, as they are played separately.

volHum and volEff are set at 15 and 16, what does 15/16 represent, a percentage out of 100?  I have my overall volume at 1750, and my effects are ear piercing, the hum volume is perfect, and the swinging I wish I could get louder.  I've been playing with changing volHum and volEff (via config file) but it doesn't seem to have an effect.

No, 16 is the max.
Smoothswing V2 volume is controlled by smoothsw.ini, in particular SwingSensetivity, SwingSharpness and MaxSwingVolume.
More info here: Teensy Saber OS (http://fredrik.hubbe.net/lightsaber/teensy_saber.html)
Title: SmoothSwing V2 problems with SD card
Post by: KanyonKris on February 01, 2018, 12:01:48 AM
Had problems trying out SmoothSwing V2 tonight. I used thexter's new sounds (SmoothGrey and SmoothJedi). My first preset uses a SmoothSwing V1 polyphonic sound font and it always worked, although when I switched it to SmoothSwing V2 it got a little scratchy sounding. But thexter's fonts with SmoothSwing V2 were all garbled and it even caused the blade in and out to be slow, much weirdness. I tried reducing the WAV files from 44kHz to 22kHz, but no help. Finally I switched to the Teensy optimzed SD card code (#include sd_t3.h with USE_TEENSY3_OPTIMIZED_CODE uncommented) and everything worked great.

I'm guessing this means my microSD card is the problem. It's a Kingston 8 GB microSDHC Class 4 that has fairly good reviews on Amazon. Do I need higher than Class 4? I'll try a different card tomorrow.

BTW, if you use the Teensy optimized SD code, the sd_t3.h file comments are very clear that it is read only so you won't be able to use MTP disk.
Title: SmoothSwing V2
Post by: KanyonKris on February 01, 2018, 12:09:29 AM
Note: put a copy of smoothsw.ini in each font directory. You can have different SmoothSwing settings for each font. I first tried putting just one smoothsw.ini in the root directory and that doesn't work.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 01, 2018, 12:45:52 AM
SD card bandwidth can be .a problem, but different SD cards seems to have different problems. My sandisk cards seems to work pretty well, but if I try to turn on USE_TEENSY3_OPTIMIZED_CODE, it doesn't work, not sure why.
I'm not sure that the class is the problem, because teensy uses the the sd card with a single data line, while the class is measured using four data lines. It's possible that some sd cards are just slow when using a single data line.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 01, 2018, 12:47:53 AM
PS, I think I'm going to add a command for benchmarking the SD card in the next version.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 01, 2018, 11:01:22 AM
Hmm, it occurs to me that the code that re-starts a looping sound is less than optimial, especially if two files are doing it at the same time.
I'm going to see if I can improve that.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 01, 2018, 12:18:59 PM
Hmm, it occurs to me that the code that re-starts a looping sound is less than optimial, especially if two files are doing it at the same time.
I'm going to see if I can improve that.
I am happy to test code changes with my seemingly finicky Kingston microSD card.

BTW, I'm curious about this: When I #include sd_t3.h and uncomment USE_TEENSY3_OPTIMIZED_CODE, it compiles and works fine. But when I #include sd_t3.h and comment out USE_TEENSY3_OPTIMIZED_CODE I got a long list of compiler errors all similar to this:
Code: [Select]
lightsaber:2113: error: 'File' does not name a type
   typedef File FILE;
Maybe not worth bothering with but the comments in sd_t3.h seem to indicate that even without USE_TEENSY3_OPTIMIZED_CODE there may be some performance improvements and it would be nice to be able to write to the microSD card. This is what the sd_t3.h says:
Code: [Select]
// This Teensy 3.x optimized version is a work-in-progress.
//
// Uncomment this line to use the Teensy version, which completely replaces
// all of the normal Arduino SD library code.  The optimized version is
// currently read-only.  It CAN NOT WRITE ANYTHING TO YOUR SD CARD.  However,
// it is *much* faster for reading more than 1 file at a time, especially for
// the Teensy Audio Library to play and mix multiple sound files.
//
//#define USE_TEENSY3_OPTIMIZED_CODE

/* Why reinvent the SD library wheel...
 *   1: Allow reading files from within interrupts
 *   2: Cache more than one sector for improved performance
 *   3: General optimization for 32 bit ARM on Teensy 3.x & Teensy-LC
 *   4: Permissive MIT license
 */
Or am I misreading/misunderstanding this?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 01, 2018, 12:27:02 PM
There is no need to include SD_t3.h directly, as it is included from SD.h.
If USE_TEENSY3_OPTIMIZED_CODE is defined, SD_t3.h defines __SD_H__ which prevents the rest of SD.h from actually doing anything.
Without USE_TEENSY3_OPTIMIZED_CODE SD_t3.h does exactly nothing.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 01, 2018, 12:56:19 PM
There is no need to include SD_t3.h directly, as it is included from SD.h.
If USE_TEENSY3_OPTIMIZED_CODE is defined, SD_t3.h defines __SD_H__ which prevents the rest of SD.h from actually doing anything.
Without USE_TEENSY3_OPTIMIZED_CODE SD_t3.h does exactly nothing.
Ah, I see. Thank you for the explanation.

Thanks again for sharing all your saber work. I don't understand all your code, but I understand enough to be impressed by how awesome it is. The event handling, the preset template system, audio, handling a variety of hardware - all so good.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 01, 2018, 10:57:28 PM
This is untested, but I hacked up a minor optimization for audio loops, plus a command called "sdtest" which benchmarks the sd card.
Here is what I get:
Code: [Select]
Playing caliban/hum01.wav
Each dot is 64kB
................
................
................
................
................
................
................
................
Done
SD card speed:
874.82 kb/s = 9.92 simultaneous audio streams.

You can download the untested code here: http://fredrik.hubbe.net/lightsaber/lightsaber-1.194.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.194.zip)

Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 02, 2018, 03:16:03 PM
Installed the 1.194 firmware without USE_TEENSY3_OPTIMIZED_CODE. SmoothSwing V2 works good, no garbled audio. Thanks, profezzorn!

Ran sdtest:

Code: [Select]
Playing f-stndrd/hum02.wav
Each dot is 64kB
................
................
................
................
................
................
................
................
Done
SD card speed:
1018.65 kb/s = 11.55 simultaneous audio streams.

Looks like my Kingston card should be OK. If it matters, hum02.wav is 22kHz, 16 bit, mono.

UPDATE: This is the Kingston microSD card I have - Amazon.com: Kingston 8 GB microSDHC Class 4 Flash Memory Card SDC4/8GBET: (https://www.amazon.com/gp/product/B00200K1TS/)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 02, 2018, 03:23:31 PM
Installed the 1.194 firmware without USE_TEENSY3_OPTIMIZED_CODE. SmmothSwing V2 works good, no garbled audio. Thanks, profezzorn!

Ran sdtest:

Code: [Select]
Playing f-stndrd/hum02.wav
Each dot is 64kB
................
................
................
................
................
................
................
................
Done
SD card speed:
1018.65 kb/s = 11.55 simultaneous audio streams.

Looks like my Kingston card should be OK. If it matters, hum02.wav is 22kHz, 16 bit, mono.

It doesn't matter. It just reads data from the file, calculates the kb/s and divides by 88.2 to get number of streams.
(Which assumes 44.1kHz, it would be twice as many 22kHz streams.)
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 02, 2018, 04:34:15 PM
When I use the InOutSparkTip preset I see the SPARK_COLOR when the blade extends, but not when it retracts. For example, this preset from common_presets.h:

{ "graflex7", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },

Also, what is the range of values for GRADE and what does GRADE do in BrownNoiseFlicker?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 02, 2018, 05:08:51 PM
When I use the InOutSparkTip preset I see the SPARK_COLOR when the blade extends, but not when it retracts. For example, this preset from common_presets.h:

{ "graflex7", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },

Also, what is the range of values for GRADE and what does GRADE do in BrownNoiseFlicker?

I did the spark tip only on extension since I thought that made more sense.
I suppose we could add an option for doing it on retraction too.

The brown noise mix is 0-255, and for each pixel the mix changes by picking a random value between mix - grade and mix + grade. The brown mix does not carry state over time though, which makes it not very useful. I need to make some random thingies with some control over the frequency of the randomness as well...
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 02, 2018, 05:39:00 PM
I did the spark tip only on extension since I thought that made more sense.
I suppose we could add an option for doing it on retraction too.
Spark tip only on extension does make sense. Spark tip retraction might look fun, but this is a small matter.

I came up with a preset I quite like. It's basically EasyBlade but I added AudioFlicker between full blue and a little darker blue (Rgb<0, 0, 180>) so the blade flickers a bit, makes it a bit more dynamic.

  { "smthjedi", "tracks/cantina.wav", StylePtr<InOutSparkTip<SimpleClash<Lockup<Blast<AudioFlicker<BLUE, Rgb<0,0,200> >, WHITE>, AudioFlicker<BLUE, WHITE> >, WHITE>, 300, 800> >(), "blueflicker" },

UPDATE: Actually this can be written more simply using EasyBlade:

  { "smthjedi", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<AudioFlicker<BLUE, Rgb<0,0,200> >, WHITE>, 300, 800> >(), "blueflicker" },
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 02, 2018, 06:51:45 PM
I did the spark tip only on extension since I thought that made more sense.
I suppose we could add an option for doing it on retraction too.
Spark tip only on extension does make sense. Spark tip retraction might look fun, but this is a small matter.

I came up with a preset I quite like. It's basically EasyBlade but I added AudioFlicker between full blue and a little darker blue (Rgb<0, 0, 180>) so the blade flickers a bit, makes it a bit more dynamic.

{ "smthjedi", "tracks/cantina.wav", StylePtr<InOutSparkTip<SimpleClash<Lockup<Blast<AudioFlicker<BLUE, Rgb<0,0,180> >, WHITE>, AudioFlicker<BLUE, WHITE> >, WHITE>, 300, 800> >(), "blueflicker" },

Nice, sharing blade styles is a nice and easy way for people to get into tweaking their configurations, more of that!
Title: Re: TeensySaber Software Discussion
Post by: bobi-one on February 03, 2018, 01:02:08 PM
I am dazzled. All My sd cards I used so far ( class10 toshiba 8G, Kingston 16G) show really low performance , around 300 kb/s.
Title: Flicker preset and SmoothSwing V2
Post by: KanyonKris on February 04, 2018, 07:45:58 AM
A quick video of the flicker preset I posted 2 days ago and SmoothSwing V2 in action.

Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 04, 2018, 01:28:55 PM
Hello guys! I'm new one here :)

I'm having a nightmare with my V1 setup. I've been on a same spot for like 1 week now. I would really appreciate your help.

In general, my setup differs only in "booster" and "SD adapter" selection. I used booster "TPS61200-Boost-Converter-Module-Support-Down-Conversion-and-Disable-Mode", which got the same chip as Li-Po booster and microSD reader "SPI-Reader-Micro-SD-Memory-Card-TF-Memory-Card-Shield-Module-for-Arduino-AD", which got the same pinout as teensy's adapter.

The problem is, that my teensy is very unstable and causes different errors, displayed in serial monitor. Right now i managed to get microSD card (Formated as FAT16) up and running and displaying the files on it but i cannot play them (Message: "failed to read 20 bytes"). "Beep" command works.

I know, there could be million errors posible but i would be really happy if you could help me cause i wanna make a suprise for my dad.

PS: I'm using the latest firmware release.


Thank you!!


Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 04, 2018, 02:50:57 PM
Hello guys! I'm new one here :)

I'm having a nightmare with my V1 setup. I've been on a same spot for like 1 week now. I would really appreciate your help.

In general, my setup differs only in "booster" and "SD adapter" selection. I used booster "TPS61200-Boost-Converter-Module-Support-Down-Conversion-and-Disable-Mode", which got the same chip as Li-Po booster and microSD reader "SPI-Reader-Micro-SD-Memory-Card-TF-Memory-Card-Shield-Module-for-Arduino-AD", which got the same pinout as teensy's adapter.

The problem is, that my teensy is very unstable and causes different errors, displayed in serial monitor. Right now i managed to get microSD card (Formated as FAT16) up and running and displaying the files on it but i cannot play them (Message: "failed to read 20 bytes"). "Beep" command works.

I know, there could be million errors posible but i would be really happy if you could help me cause i wanna make a suprise for my dad.

PS: I'm using the latest firmware release.


Thank you!!

You're right, there could be a million things that could cause these sort of problems. Generally, the best way to find these sort of things is to disconnect or replace one part at a time until things works better.

First thing, whenever things are flaky, or multiple parts seems to behave badly, it's most likely a power problem. Check your battery, check the wiring, try a different booster. Try hooking things up to a 5v power supply instead of the booster.

Second, it sounds like you have a problem with the sd card. That could of course be caused by a problem elsewhere, but sd card problems can also cause crashes and hangs which makes the whole thing behave erratically. How long are the wires to the sd card? Try a different sd card? Try using the serialflash instead?

If all else fails, some pictures of your setup may provide clues or more ideas for things to try.
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 05, 2018, 07:49:11 AM
Hey, thank you for your quick answer! :) I'm sorry for lack of information i gave. I did not have a lot of time.I tought the same about power problem. Now i just connected a 5V power suppy to have a solid input. I bypassed the booster and must say, that this act got my LED strip working and can even toogle through the different fonts (colors). There is still no sound but i can hear a very quiet scrachy sound, comming from the speaker (2W, 8ohm), but is not the .wav file.

Dir command works like a charm but i stil cannot play any of the wav files (made them with audacity).

About SDcard... I've tried two 1gb microSD cards, which performs great with my mobile phone, USB reader, etc. I formated them in FAT16 format with SDformatter. I tried even two microSD card readers but the same problem persist. I used AWG26 wires for connecting SDcard adapter. Lenght is about 90mm. As a electrician, my soldering skills are pretty good too.

I tried to use the serialflash method but honestly don't know how to upload the files onto chip :S

Thanky you again and looking forward for your answer. :)
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 05, 2018, 08:00:27 AM
Oh and i almost forgot. Every time, teensy boots up, speaker speaks out the words sounding like "BAD OPEN FAILURE" or "BATCH OPEN FAILURE".
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 05, 2018, 08:22:37 AM
Oh and i almost forgot. Every time, teensy boots up, speaker speaks out the words sounding like "BAD OPEN FAILURE" or "BATCH OPEN FAILURE".
Pretty sure it's BANK OPEN FAILURE and usually it means files cannot be read from the microSD card.

Now that you're getting more stable operation with the 5V supply, it's very helpful to use the serial monitor to verify proper boot, operation and look for errors. In the Arduino IDE go to Tools | Serial Monitor. 9600 baud is fine, and left of the Baud setting make sure Newline is selected. Also make sure you have the correct serial port selected ( Tools | Port, usually the correct port will say (Teensy) next to it. And be sure you USB is set to Serial (Tools | USB Type:). When you power up the Teensy with the USB cable connected, open the Serial Monitor and you should see lines of text printing out. You can also enter commands to test many functions.

The Troubleshooting page is full of good info - Teensy Saber Troubleshooting (http://fredrik.hubbe.net/lightsaber/troubleshooting.html)

Also, many topics like this have been discussed before so search back through this thread. For instance, a search for BANK turned up some good info.
 
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 05, 2018, 09:39:30 AM
Oh and i almost forgot. Every time, teensy boots up, speaker speaks out the words sounding like "BAD OPEN FAILURE" or "BATCH OPEN FAILURE".
Pretty sure it's BANK OPEN FAILURE and usually it means files cannot be read from the microSD card.

Now that you're getting more stable operation with the 5V supply, it's very helpful to use the serial monitor to verify proper boot, operation and look for errors. In the Arduino IDE go to Tools | Serial Monitor. 9600 baud is fine, and left of the Baud setting make sure Newline is selected. Also make sure you have the correct serial port selected ( Tools | Port, usually the correct port will say (Teensy) next to it. And be sure you USB is set to Serial (Tools | USB Type:). When you power up the Teensy with the USB cable connected, open the Serial Monitor and you should see lines of text printing out. You can also enter commands to test many functions.

The Troubleshooting page is full of good info - Teensy Saber Troubleshooting (http://fredrik.hubbe.net/lightsaber/troubleshooting.html)

Also, many topics like this have been discussed before so search back through this thread. For instance, a search for BANK turned up some good info.
 

Yeah, it's the BANK OPEN FAILURE. I tested 3 different microSD cards in different formats (FAT16, FAT32) with no luck.

My initialization in serial monitor:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ...  Done
Gyro setup ...  Done
Amplifier off.
OPEN.WAV 233516
CLOSE.WAV 266284
FONT01 16384
FONT02 16384
FONT03 16384
FONT04 16384
HUM.WAV 21757996
CHARGING 16384
Done listing files.
Battery voltage: 4.82
Playing hum.wav
File hum.wav not found. ???

I got serial, port (teensy), 9600baud, newline "enabled".

I checked the troubleshoot page many times now but there seems to still be an error with SD card reading :(

Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 05, 2018, 09:40:42 AM
(https://thumb.ibb.co/d24Tkc/problem_serial.jpg) (https://ibb.co/d24Tkc)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 05, 2018, 10:26:49 AM
Oh and i almost forgot. Every time, teensy boots up, speaker speaks out the words sounding like "BAD OPEN FAILURE" or "BATCH OPEN FAILURE".
Pretty sure it's BANK OPEN FAILURE and usually it means files cannot be read from the microSD card.

Now that you're getting more stable operation with the 5V supply, it's very helpful to use the serial monitor to verify proper boot, operation and look for errors. In the Arduino IDE go to Tools | Serial Monitor. 9600 baud is fine, and left of the Baud setting make sure Newline is selected. Also make sure you have the correct serial port selected ( Tools | Port, usually the correct port will say (Teensy) next to it. And be sure you USB is set to Serial (Tools | USB Type:). When you power up the Teensy with the USB cable connected, open the Serial Monitor and you should see lines of text printing out. You can also enter commands to test many functions.

The Troubleshooting page is full of good info - Teensy Saber Troubleshooting (http://fredrik.hubbe.net/lightsaber/troubleshooting.html)

Also, many topics like this have been discussed before so search back through this thread. For instance, a search for BANK turned up some good info.
 

Yeah, it's the BANK OPEN FAILURE. I tested 3 different microSD cards in different formats (FAT16, FAT32) with no luck.

My initialization in serial monitor:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ...  Done
Gyro setup ...  Done
Amplifier off.
OPEN.WAV 233516
CLOSE.WAV 266284
FONT01 16384
FONT02 16384
FONT03 16384
FONT04 16384
HUM.WAV 21757996
CHARGING 16384
Done listing files.
Battery voltage: 4.82
Playing hum.wav
File hum.wav not found. ???

I got serial, port (teensy), 9600baud, newline "enabled".

I checked the troubleshoot page many times now but there seems to still be an error with SD card reading :(

"BANK OPEN FAILURE" means that it can't find the files.
If it can't read the sd card at all, it will say "Please insert SD unit".
I suspect the problem is simply that the configuration file says to look for a diectory called "fontdir", but the directory on the sd card is called "font01".  Either rename the directory, or update the configuration.

You can also try to type "play font01/hum.wav" in the serial monitor, to just play a single file directly.
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 05, 2018, 10:59:06 AM
I can't play the files through serial. When i type "play something.WAV" it just fail to play (see picture above).

This is how my folders look like:

SD:
(https://thumb.ibb.co/euxbox/1.jpg) (https://ibb.co/euxbox)

Inside tracks folder:
(https://thumb.ibb.co/dM5qFc/2.jpg) (https://ibb.co/dM5qFc)

Common_presets.h:
(https://thumb.ibb.co/b5aU8x/3.jpg) (https://ibb.co/b5aU8x)

v1_config: (do need to change pin presets?):
(https://thumb.ibb.co/jVhRox/4.jpg) (https://ibb.co/jVhRox)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 05, 2018, 11:02:08 AM
Dir command works like a charm but i stil cannot play any of the wav files (made them with audacity).

Have you tried just typing: play font01/hum.wav or similar?
You didn't save the wav files in a compressed or floating-point format I hope, because teensysaber only supports
PCM files. The playback speed must be 11025, 22050 or 44100Hz, and it should preferably have 16 bits per sample.

Quote
About SDcard... I've tried two 1gb microSD cards, which performs great with my mobile phone, USB reader, etc. I formated them in FAT16 format with SDformatter. I tried even two microSD card readers but the same problem persist. I used AWG26 wires for connecting SDcard adapter. Lenght is about 90mm. As a electrician, my soldering skills are pretty good too.

90mm may be too long. But maybe not since you can list files.
(At a few Mhz, the capacitance of even fairly short wires can become a problem.)
If you get hangs while playing sounds, try making the wires shorter.

Quote
I tried to use the serialflash method but honestly don't know how to upload the files onto chip :S

Easiest way is to use MTP, at least if you're on windows.
You just need to compile teensysaber with the usb type set to MTP.
If you're on a mac, you'll need to install MTP support, which I think comes from the android SDK.

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 05, 2018, 11:10:03 AM
I can't play the files through serial. When i type "play something.WAV" it just fail to play (see picture above).

Does it say why?
Does it crash/lock the teensy?
What actually happens?

Quote
This is how my folders look like:

The folder structure looks a little odd, this is how it would normally look:

font01/
font01/hum.wav
font01/swing.wav
font01/...all the other sound effects
font02/hum.wav
font02/swing.wav
font02/....
tracks/darth.wav
tracks/mars.wav
tracks/dubstep.wav

The directories can be called anything you like, as long as they match what you have in the config file, but the general idea is to have one directory per font, and one for background soundtracks. (I like the imperial march for that.)

Quote
v1_config: (do need to change pin presets?):

Not unless you hooked things up differently from what I did.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 05, 2018, 12:20:27 PM
Try putting some known good WAV files on your microSD card and playing them. For example, try these made-from-scratch sounds - SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/post/107359/thread)
I used these files and I can confirm they play just fine.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 05, 2018, 05:02:38 PM
I'd like to be able to move through the available presets more easily to select the one I want. Right now this is done by holding down the power button when the blade is off and hitting the saber (like a clash) which is a bit cumbersome and slow.

I wonder if this would work: hold down the power button for 2-3 seconds to enter preset selection mode (perhaps acknowledged with a beep and/or the blade blinks) then slowly swinging the blade right causes the next preset to be selected after rotating 10-15 degrees, which is confirmed by a sound and the blade displaying that preset. Swinging left would go to the previous presets. Releasing the button selects the preset.

I've been looking at the code to see if I can do this now. Can I use the Longclick event and some code to check the Z axis rotation?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 05, 2018, 05:16:28 PM
I'd like to be able to move through the available presets more easily to select the one I want. Right now this is done by holding down the power button when the blade is off and hitting the saber (like a clash) which is a bit cumbersome and slow.

I wonder if this would work: hold down the power button for 2-3 seconds to enter preset selection mode (perhaps acknowledged with a beep and/or the blade blinks) then slowly swinging the blade right causes the next preset to be selected after rotating 10-15 degrees, which is confirmed by a sound and the blade displaying that preset. Swinging left would go to the previous presets. Releasing the button selects the preset.

I've been looking at the code to see if I can do this now. Can I use the Longclick event and some code to check the Z axis rotation?

It will require a little coding, but shouldn't be too difficult to do.
Showing the current setting might cause some minor problems since some of the code won't expect it, but that shouldn't be too difficult to fix.
I have some crude gesture recognition code in DoGesture/ProcessStrokes that might be useful.
This could be a pretty useful feature, so if you do implement it, please share the code. :)
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 06, 2018, 08:13:56 AM
To checking sampling rate for WAV files: In Windows File Explorer right-click on the column headings (when in detail view) and select Bitrate.
These are the bitrates TeensySaber can play (so if you see any other bitrate, you'll need to convert the audio file):

176kbps = 11kHz 16 bit Mono
352kbps = 22kHz 16 bit Mono, or 11kHz 16 bit Stereo
705kbps = 44kHz 16 bit Mono, or 22kHz 16 bit Stereo
1411kbps = 44kHz 16 bit Stereo

For more detail audio file info, install VLC Media Player, play the audio file and open Tools | Media Information then select the Codec tab.

Audacity tip: When exporting WAV files, the sampling rate is determined by the Project Rate (Hz) found in the lower left corner of the main window.
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 06, 2018, 08:49:46 AM
Hey profezzorn & KanyonKris!

Please look at the picture. It explains my command entry:
(https://thumb.ibb.co/nn4M8x/play_hum_sound_failure.jpg) (https://ibb.co/nn4M8x)

- Files are exported with audacity: WAV (Microsoft) signed 16-bit PCM, 352kbps.

- Soldered new wires to SD adapter. The lenght of wires is now aprox. 25mm. Used AWG26 for data pins and 0,25mm2 for powering the SD adapter.

- Sometimes when i program with MTP USB type it just crashes if i open the serial monitor.

- I rearranged the folders so no looks like your example and i even change the path in code.

Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 06, 2018, 09:25:41 AM
miib123, the filesize for HUM.WAV is huge, 21 MB. You might be getting the file not found error because the file is too large to play, or the file may be corrupt. My biggest hum WAV is 450074. Try playing OPEN.WAV and CLOSE.WAV. And try playing a file in one of your font directories like, play font01/hum.wav.
Also, download the known-good SmoothSwing V2 sound fonts I posted here yesterday and put those on your microSD card and try to play them.
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 06, 2018, 10:04:10 AM
miib123, the filesize for HUM.WAV is huge, 21 MB. You might be getting the file not found error because the file is too large to play, or the file may be corrupt. My biggest hum WAV is 450074. Try playing OPEN.WAV and CLOSE.WAV. And try playing a file in one of your font directories like, play font01/hum.wav.
Also, download the known-good SmoothSwing V2 sound fonts I posted here yesterday and put those on your microSD card and try to play them.

I played all the files all the way defined and nothing worked :(

I downloaded "SmoothSwing V2 sound fonts" too and used "smoothgrey" type. Than i renamed them and put them on a SD card. Tried to play them and same problem exist.

Otherwise, the neopixel strip works great and animations (clash, in/out) too! :)

Man, i'm so near i can feel it. I almost finished 3D printing the graflex hilt to put the electronics inside. When its finished, i'll post some pictures :)

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 06, 2018, 10:25:23 AM
Hey profezzorn & KanyonKris!

Please look at the picture. It explains my command entry:
(https://thumb.ibb.co/nn4M8x/play_hum_sound_failure.jpg) (https://ibb.co/nn4M8x)

- Files are exported with audacity: WAV (Microsoft) signed 16-bit PCM, 352kbps.

- Soldered new wires to SD adapter. The lenght of wires is now aprox. 25mm. Used AWG26 for data pins and 0,25mm2 for powering the SD adapter.

- Sometimes when i program with MTP USB type it just crashes if i open the serial monitor.

- I rearranged the folders so no looks like your example and i even change the path in code.


This is very strange.
I'm not sure why "hum.wav" is in the root folder, but that's really irrelevant to the problem at hand.
Clearly, you have SD card support enabled, and the teensy found and enabled your sd card, or "dir" wouldn't work.
The "file not found" message, occurs when SD.Open() fails, which is weird because it really looks like the file is there.
The length and content of the file is also irrelevant at this point as that would cause other types of error messages.

When you say "it crashes when I open the serial monitor", what is it that crashes? Is it the teensy or the arduino program?
If the teensy crashes (or locks up) it could mean the SD card wires are still a problem. It's also possible that the SD card is corrupted somehow. I recommend not using MTP for now, as MTP needs to write to the SD card in order to work, and that could corrupt the sd card if the wires are not 100%.  If you don't use MTP, teensysaber will only read from the SD card, which should be safe.
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 06, 2018, 10:49:04 AM
MTP:
(https://thumb.ibb.co/nMJZBH/MTP_problem.jpg) (https://ibb.co/nMJZBH)

I choose "MTP disk". It programs well and it even speaks out the "bank opena failure" and when i open serial monitor,
 the thing on the pictere happens. It's like restart or something like that. Like if i would unplug the USB cable from teensy.

The second thing:

After that MTP experience, i switched the USB type to serial and reuploaded the firmware and then the next problem occured (picture below). This is not the first time, this problem occured. I then just uploaded some other lightsaber version of yours and than the original one (1.9.1) back again and the problem is gone.

(https://thumb.ibb.co/cdNEdx/stability_problem.jpg) (https://ibb.co/cdNEdx)


The "fail accel setup" can happen when the teensy crashes or is rebooted in the middle of talking to the acceleration chip.
Since the acceleration chip doesn't get rebooted, it's still waiting for the teensy to do something, but the teensy has been restarted and is trying to re-initialize the chip.  This doesn't happen inside a saber, since everything is rebooted when he power is removed.
The solution is to just disconnect the power for a second.

The driver for the V2/V3 has some code that tries to work around this, which works *most* of the time... :)
At this point, I think you should turn off MTP, re-format the SD card and put the files back again and try again.
If it still doesn't work, then I really don't know what to try next, because it seems like it should work, but then it doesn't...
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 06, 2018, 11:02:45 AM
(https://thumb.ibb.co/e4mMrH/15179436951611381535887.jpg) (https://ibb.co/e4mMrH)

The other side:

(https://thumb.ibb.co/njzudx/1517943803400_535662766.jpg) (https://ibb.co/njzudx)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 06, 2018, 12:34:06 PM
I was updated the and I configured the new button setup but it doesn't work properly. I can hold it down and it will play music but I cannot hold the button and clash to make it move to the next preset. It will not move from the battery monitor to the next preset. attached it the v1_config code I have.
Code: [Select]
#ifdef CONFIG_TOP

// V1 electronics
#include "v1_config.h"

// Number of simultaneously connected blades.
// (For interchangeable blades, see the blades[] array.)
#define NUM_BLADES 1

// Number of buttons
#define NUM_BUTTONS 1

// Dual power buttons means that clicking AUX will also turn the saber on.
// If not defined, AUX will go to next preset when off.
//#define DUAL_POWER_BUTTONS

// Volume, useful range is about 0-2000.
#define VOLUME 2000

// If you have two 144 LED/m strips in your blade, connect
// both of them to bladePin and drive them in parallel.
const unsigned int maxLedsPerStrip = 144;

// This defines how sensetive the clash detection is.
#define CLASH_THRESHOLD_G 1.0

// Define this if your power button is a touch button.
//#define POWER_TOUCHBUTTON_SENSITIVITY 1700
// #define AUX_TOUCHBUTTON_SENSITIVITY 1700
// #define AUX2_TOUCHBUTTON_SENSITIVITY 1700

// For V1 electronics, there is an external pullup resistor to measure
// battery voltage. This specifies how many Ohms it is.
#define BATTERY_PULLUP_OHMS 100000

// If your electonics inverts the bladePin for some reason, define this.
// #define INVERT_WS2811

// Feature defines, these let you turn off large blocks of code
// used for debugging.
#define ENABLE_AUDIO
#define ENABLE_MOTION
// #define ENABLE_SNOOZE
#define ENABLE_WS2811

// FASTLED is experimental and untested right now
// #define ENABLE_FASTLED
// #define ENABLE_WATCHDOG
#define ENABLE_SD
#define ENABLE_SERIALFLASH

#endif

#include "GMcommon_presets.h"

#ifdef CONFIG_BUTTONS

// There are currently three available button classes:
// Button (standard momentary button)
// TouchButton (similar to momentary button, but reacts to touch).
// LatchingButton (on/off button, always controls ignition)

 Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
//Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif

Thanks for the help and the work you do.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 06, 2018, 12:42:34 PM
I was updated the and I configured the new button setup but it doesn't work properly. I can hold it down and it will play music but I cannot hold the button and clash to make it move to the next preset. It will not move from the battery monitor to the next preset. attached it the v1_config code I have.
Code: [Select]
#ifdef CONFIG_TOP

// V1 electronics
#include "v1_config.h"

// Number of simultaneously connected blades.
// (For interchangeable blades, see the blades[] array.)
#define NUM_BLADES 1

// Number of buttons
#define NUM_BUTTONS 1

// Dual power buttons means that clicking AUX will also turn the saber on.
// If not defined, AUX will go to next preset when off.
//#define DUAL_POWER_BUTTONS

// Volume, useful range is about 0-2000.
#define VOLUME 2000

// If you have two 144 LED/m strips in your blade, connect
// both of them to bladePin and drive them in parallel.
const unsigned int maxLedsPerStrip = 144;

// This defines how sensetive the clash detection is.
#define CLASH_THRESHOLD_G 1.0

// Define this if your power button is a touch button.
//#define POWER_TOUCHBUTTON_SENSITIVITY 1700
// #define AUX_TOUCHBUTTON_SENSITIVITY 1700
// #define AUX2_TOUCHBUTTON_SENSITIVITY 1700

// For V1 electronics, there is an external pullup resistor to measure
// battery voltage. This specifies how many Ohms it is.
#define BATTERY_PULLUP_OHMS 100000

// If your electonics inverts the bladePin for some reason, define this.
// #define INVERT_WS2811

// Feature defines, these let you turn off large blocks of code
// used for debugging.
#define ENABLE_AUDIO
#define ENABLE_MOTION
// #define ENABLE_SNOOZE
#define ENABLE_WS2811

// FASTLED is experimental and untested right now
// #define ENABLE_FASTLED
// #define ENABLE_WATCHDOG
#define ENABLE_SD
#define ENABLE_SERIALFLASH

#endif

#include "GMcommon_presets.h"

#ifdef CONFIG_BUTTONS

// There are currently three available button classes:
// Button (standard momentary button)
// TouchButton (similar to momentary button, but reacts to touch).
// LatchingButton (on/off button, always controls ignition)

 Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
//Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif

Thanks for the help and the work you do.

Regards,

GMcIvor

Weird, the button definition looks right.
Does clashes work at all?
What do you see in the serial monitor?
It may be that the saber is "on" (which looks pretty much the same when charging) You just can't switch presets when the saber is on.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 06, 2018, 12:42:50 PM
miib123, your wires look short enough.

In case you missed it, I agree with profezzorn, plug your microSD card into your computer and reformat it (mine is FAT32), then copy all the files back onto it and try it in your saber electronics. If that doesn't work, perhaps try a different microSD card.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 06, 2018, 01:21:14 PM

Weird, the button definition looks right.
Does clashes work at all?
What do you see in the serial monitor?
It may be that the saber is "on" (which looks pretty much the same when charging) You just can't switch presets when the saber is on.
[/quote]

No nothing works. The first preset it boots into when I plug the blade on is the battery monitor preset. The battery will flash and I can make music play by holding down the button. But it will not switch presets.

I will connect to the serial monitor and see. But it is super weird.

So in the serial monitor I can use all the commands and make it work. holding the button and clashing does not trigger the next preset. I am super confused, but I know it is something simple. On some fonts when I type "off" the hum will stay playing and will stop once I type "next preset"

Regards,

GMcIvor


Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 06, 2018, 01:39:21 PM
Try forcing it to use the blade you have plugged in by commenting out everything else in BladeConfig (in your common_presets.h file). We had issues with our boards not correctly identifying blades so using only one blade config got it working until we could figure out the blade identification problem.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 06, 2018, 01:44:13 PM
Try forcing it to use the blade you have plugged in by commenting out everything else in BladeConfig (in your common_presets.h file). We had issues with our boards not correctly identifying blades so using only one blade config got it working until we could figure out the blade identification problem.

Good point. If the saber thought you were using a charging blade, there might only be one preset for that, so switching isn't possible.
(No way for me to know unless you show me "GMcommon_presets.h".)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 06, 2018, 01:46:26 PM
Code: [Select]
#ifdef CONFIG_PRESETS

// CONFIGURABLE
// Each preset line consists of:
// { "font directory", "sound track", Style },
// Where Style is one of:
//   StyleNormalPtr<BaseColor, FlashColor, out millis, in millis>()
//   StyleFirePtr<LowHeatColor, HighHeatColor>()
//   StyleRainBowPtr<out millis, in millis>()
//   StyleStrobePtr<BaseColor, FlashColor, out millis, in millis>()
//   &style_charging
// All colors can be specied as three numbers or using one the handy macros above.
// If you wish to have different presets for different blades, copy this array and
// name it something other than "preset", then use the new name inside the blade
// configuration array below. See "simple_presets" and "charging_presets"
// below for examples.
Preset presets[] = {
  { "Boot", "tracks/Ftheme.wav", &style_charging },
  { "Fonts/Graflex7", "Tracks/SIntro.wav",
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >() },
  { "Fonts/Graflex4", "Tracks/Ftheme.wav", StyleNormalPtr<CYAN, WHITE, 300, 800>() },
  { "Fonts/MPP", "Tracks/Vader.wav", StyleNormalPtr<RED, Orange, 300, 800>() },
  { "Fonts/Kylo", "Tracks/Kintro.wav", StyleFirePtr<RED, Orange>() },
  { "Fonts/Windu", "Tracks/Cantina.wav",
   StylePtr<InOutSparkTip<EASYBLADE(DeepPink, Pink), 300, 800> >() },
  { "Fonts/Yoda1", "Tracks/Cantina.wav",
   StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >() },
  { "Fonts/Grievous", "Tracks/Gintro.wav", StyleFirePtr<GREEN, CYAN>() },
  { "Fonts/ROTJ", "Tracks/Cantina.wav", StyleNormalPtr<SpringGreen, Orange, 300, 800>() },
  { "Fonts/MKVI", "Tracks/Cantina.wav", StyleNormalPtr<SteelBlue, Tomato, 300, 800>() },
  { "Fonts/Master", "Tracks/Gintro.wav", StyleNormalPtr<Gradient<RED, BLUE>, Gradient<Orange, CYAN>, 300, 800>() },
  { "Fonts/StandIs", "Tracks/Cantina.wav", StyleRainbowPtr<300, 800>() },
//{ "Fonts", "Tracks/Cantina.wav", &style_pov },
};

//Preset red_presets[] = {
 // { "igniter/font2", "tracks/vader.wav", StyleNormalPtr<RED, WHITE, 100, 200>()},
 // { "caliban", "tracks/duel.wav", StyleNormalPtr<RED, WHITE, 100, 200>()},
 // { "font02", "tracks/cantina.wav", StyleStrobePtr<RED, WHITE, 15, 100, 200>()},
//};

//Preset simple_presets[] = {
 // { "font01", "tracks/title.wav", StyleNormalPtr<BLUE, WHITE, 100, 200>() },
 // { "font02", "tracks/duel.wav", StyleNormalPtr<BLUE, WHITE, 100, 200>() },
 //{ "font02", "tracks/cantina.wav", StyleStrobePtr<BLUE, WHITE, 15, 100, 200>() },
//};

//Preset white_presets[] = {
  //{ "font01", "tracks/title.wav", StyleNormalPtr<WHITE, WHITE, 100, 200>() },
  //{ "font02", "tracks/duel.wav", StyleNormalPtr<WHITE, WHITE, 100, 200>() },
  //{ "font02", "tracks/cantina.wav", StyleStrobePtr<WHITE, WHITE, 15, 100, 200>() },
//};

Preset charging_presets[] = {
  { "charging", "", &style_charging },
};

// CONFIGURABLE
// Each line of configuration should be:
//     { blade id resistor ohms, blade, CONFIGARRAY(array of presets) },
// Where "blade", can be one of the following:
//     WS2811BladePtr<number of leds, WS2811 configuration flags>()
//     SimpleBladePTR<Color of channel 1, color of channel 2, color of channel 3, color of channel 4>()
// All colors can be specied as three numbers or using one the handy macros above.

BladeConfig blades[] = {
#ifdef ENABLE_WS2811
  // PL9823 blade, 73 LEDs
  {   3300, WS2811BladePtr<73, WS2811_580kHz>(), CONFIGARRAY(presets) },

  // Charging adapter, single PL9823 LED.
  {  10000, WS2811BladePtr<1, WS2811_580kHz>(), CONFIGARRAY(charging_presets) },
 
  // PL9823 blade, 2 LEDs
  {   2200, WS2811BladePtr<2, WS2811_580kHz>(), CONFIGARRAY(presets) },
 
  // For testing (makes the charging blade behave like a normal blade.)
  //  {  15000, WS2811BladePtr<1, WS2811_580kHz>(), CONFIGARRAY(presets) },

  // WS2811 string blade 144 LEDs
  //{   7800, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(), CONFIGARRAY(presets) },
#endif

  // Simple blue string blade.
  //{   5200, SimpleBladePtr<Blue3mmLED,Blue3mmLED,Blue3mmLED,NoLED>(), CONFIGARRAY(simple_presets) },

  // Blue-Blue-White LED star
  //{ 20000, SimpleBladePtr<CreeXPE2White, CreeXPE2Blue, CreeXPE2Blue, NoLED>(), CONFIGARRAY(simple_presets) },

  // Blue LED string (with green flourescent tube)
  //{ 27000, SimpleBladePtr<Blue8mmLED100, Blue8mmLED100, Blue8mmLED100, NoLED>(), CONFIGARRAY(simple_presets) },

  // Red LED string
//  { 33000, SimpleBladePtr<Red8mmLED100, Red8mmLED100, Red8mmLED100, NoLED>(), CONFIGARRAY(red_presets) },

  // 3 x Cree XL-L LED star
  //{ 100000, SimpleBladePtr<CreeXPL, CreeXPL, CreeXPL, NoLED>(), CONFIGARRAY(white_presets) },
};

#endif

I am using my 73 LED blade.. I will comment everything out and see if I can get it to work.

So I commented out the battery charge preset and the button work to turn it on and off but the clash does not work.... but clashh will trigger from the serial monitor but not the button... We are getting somewhere.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 06, 2018, 05:45:10 PM
So I commented out the battery charge preset and the button work to turn it on and off but the clash does not work.... but clashh will trigger from the serial monitor but not the button... We are getting somewhere.
When you power up your saber boards, what does the Serial Monitor show? Specifically, does it say "Accel setup ... Done." or "Accell setup ... Failed."?
If it failed, try powering it again because sometimes it fails on power up randomly. If you power up 3 times and it fails every time, you probably have a hardware problem. We built our boards and 2-3 of them had these failures but reflowing the IMU IC fixed it.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 06, 2018, 07:46:12 PM
So I commented out the battery charge preset and the button work to turn it on and off but the clash does not work.... but clashh will trigger from the serial monitor but not the button... We are getting somewhere.
When you power up your saber boards, what does the Serial Monitor show? Specifically, does it say "Accel setup ... Done." or "Accell setup ... Failed."?
If it failed, try powering it again because sometimes it fails on power up randomly. If you power up 3 times and it fails every time, you probably have a hardware problem. We built our boards and 2-3 of them had these failures but reflowing the IMU IC fixed it.

It's possible I broke something too. Or maybe gmcivor made some changes in the earlier version but forgot to make them in this version?
I will update my v1 saber when   I get a chance to make sure.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 07, 2018, 08:02:48 AM
Quote

It's possible I broke something too. Or maybe gmcivor made some changes in the earlier version but forgot to make them in this version?
I will update my v1 saber when   I get a chance to make sure.

I have had these blade configs and fonts set up for awhile and they have been transferring through great. When you updated the software to 1.175 I had the same button config problem since that is when it first changed but I changed the configuration settings and everything worked beautifully. Now that I have updated to 1.191 it doesn't seem to like it. I did some testing last night and everything works when I press the button but the clash. I can make the clash sound and go off from the serial monitor. It will cycle through presets and everything works as expected through serial monitor. Holding the button and clashing wont cause the clash and wont cause it to switch to the next preset. Even when I have the saber on and try to clash it will not trigger.

*** Update: Doing some more bench testing I put it in the hilt and turned it on and I discovered it doesn't detect swings either. I can move the saber around and it just plays the hum.... So clash and swing sounds do not work in hilt. On the bench I can make it play the clash sounds.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 07, 2018, 09:25:48 AM
miib123, your wires look short enough.

In case you missed it, I agree with profezzorn, plug your microSD card into your computer and reformat it (mine is FAT23), then copy all the files back onto it and try it in your saber electronics. If that doesn't work, perhaps try a different microSD card.

Succes!!!!!!! It plays sound, when i type "play" command(FAT32 helped)! Super happy!!  :smiley: :smiley: :smiley: :smiley:

Now the next thing is to play the sounds, when i turn on the saber with a button. I followed the profezzorn's guide on his page but i'm little confused, how to load the sound into code. Could someone posted his code example, so i can copy it, please? I downloaded the smoothswing sound fonts but dont know, how to implement the code to react to power on/off, hum, swing and clash.

This is how my smoothswing (S2RD) folder looks like:

(https://thumb.ibb.co/iNcYOx/S2R2.jpg) (https://ibb.co/iNcYOx)

(https://thumb.ibb.co/jYXNGH/S2R22.jpg) (https://ibb.co/jYXNGH)

And my configuration in "common_presets" tab:

(https://thumb.ibb.co/fEmoqc/3.jpg) (https://ibb.co/fEmoqc)

Thank you! :)

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 07, 2018, 09:43:06 AM
miib123, your wires look short enough.

In case you missed it, I agree with profezzorn, plug your microSD card into your computer and reformat it (mine is FAT23), then copy all the files back onto it and try it in your saber electronics. If that doesn't work, perhaps try a different microSD card.

Succes!!!!!!! It plays sound, when i type "play" command(FAT32 helped)! Super happy!!  :smiley: :smiley: :smiley: :smiley:

Now the next thing is to play the sounds, when i turn on the saber with a button. I followed the profezzorn's guide on his page but i'm little confused, how to load the sound into code. Could someone posted his code example, so i can copy it, please? I downloaded the smoothswing sound fonts but dont know, how to implement the code to react to power on/off, hum, swing and clash.

This is how my smoothswing (S2RD) folder looks like:

(https://thumb.ibb.co/iNcYOx/S2R2.jpg) (https://ibb.co/iNcYOx)

(https://thumb.ibb.co/jYXNGH/S2R22.jpg) (https://ibb.co/jYXNGH)

And my configuration in "common_presets" tab:

(https://thumb.ibb.co/fEmoqc/3.jpg) (https://ibb.co/fEmoqc)

Thank you! :)

All you should need to do is to change "fontdir" to "s2rd".
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 07, 2018, 10:01:54 AM
Succes!!!!!!! It plays sound, when i type "play" command(FAT32 helped)! Super happy!!  :smiley: :smiley: :smiley: :smiley:

Now the next thing is to play the sounds, when i turn on the saber with a button. I followed the profezzorn's guide on his page but i'm little confused, how to load the sound into code. Could someone posted his code example, so i can copy it, please? I downloaded the smoothswing sound fonts but dont know, how to implement the code to react to power on/off, hum, swing and clash.

This is how my smoothswing (S2RD) folder looks like:
Good to hear you have sound playing. You can get sounds playing by fixing the paths in your presets or reorganizing the directory structure on your SD card. I recommend you restructure the files and directories, you don't need that many subdirectory levels.

profezzorn outlined the cleanest directory structure - TeensySaber Software Discussion (https://www.fx-sabers.com/forum/index.php?topic=51871.msg662016#msg662016)

In your font directories (ie font01), don't have subfolders for each sound (ie /font01/hum, /font01/clash), even though some font packs are organized this way. Go into each subfolder and move the WAV files into the font directory. So you should have:
/font01/hum.wav
/font01/clash.wav
etc.

The tracks folder is for music (sound tracks) and it should be off the root folder, not inside each font folder, for example: /tracks might have: /tracks/cantina.wav

Now point your presets to the font you want to use:
  { "font01", "tracks/cantina.wav", StylePtr<InOutSparkTip<EasyBlade<BLUE, WHITE>, 300, 800> >(), "blue" },
So when this preset is active it will play the files found in /font01 when it needs a sound, for example to play the hum it will look for /font01/hum.wav or if you have /font01/hum01.wav and /font01/hum02.wav it will randomly select one of these 2 hums to play. Another example, when you turn on the saber it will try to play /font01/out.wav. And if you long press the power button it will play /tracks/cantina.wav as a background sound track.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 07, 2018, 10:09:01 AM
n your font directories (ie font01), don't have subfolders for each sound (ie /font01/hum, /font01/clash), even though some font packs are organized this way. Go into each subfolder and move the WAV files into the font directory. So you should have:
/font01/hum.wav
/font01/clash.wav
etc.

Why move the files?
sub-folders are totally supported
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 07, 2018, 12:23:32 PM
Why move the files?
sub-folders are totally supported
That's good to know. When we were bringing up our boards I had a problem with sounds not playing that I attributed to a subdirectory issue, but I guess it wasn't.
Title: Low power notification
Post by: KanyonKris on February 08, 2018, 06:32:01 PM
profezzorn, the low power notification wasn't working so I fixed it. When the battery voltage drops too low it prints out a warning to the serial port and says "low power" every 10 seconds (10000 milliseconds).

Code: [Select]
    if (battery_monitor.low()) {
      if (current_preset_->style != &style_charging) {
        if (on_) {
          STDOUT.print("Turning off, low battery voltage: ");
          STDOUT.println(battery_monitor.battery());
          Off();
        } else if (millis() - last_beep_ > 10000) {
          STDOUT.print("Warning, low battery voltage: ");
          STDOUT.println(battery_monitor.battery());
#ifdef ENABLE_AUDIO
          // TODO: allow this to be replaced with WAV file
          talkie.Say(spLOW);
          talkie.Say(spPOWER);
//          beeper.Beep(1.0, 3000.0);
#endif
          last_beep_ = millis();
       }
      }
    }

While I was at it, I didn't like how often the battery voltage was reported to the serial port, so I added some code to only report when the voltage has changed by more than 0.05 volts:

Code: [Select]
    if (monitor.ShouldPrint(Monitoring::MonitorBattery) || millis() - last_print_millis_ > 5000) {
      if (v > last_print_voltage_ + 0.05 || v < max(last_print_voltage_ - 0.05, 0)) {
        STDOUT.print("Battery voltage: ");
        STDOUT.println(v);
        last_print_voltage_ = v;
      }
      last_print_millis_ = millis();
    }

BTW, I didn't see that the beeper class was turning on the amplifier, should this be the code?

Code: [Select]
  void Beep(float length, float freq) {
    digitalWrite(amplifierPin, HIGH); // turn on the amplifier
    x_ = f_ = AUDIO_RATE / freq / 2.0;
    samples_ = AUDIO_RATE * length;
  }

Last thing, why is the hum still playing (but no sound, I assume because the amp is off) when the saber is off (blade not on)?
Title: Re: TeensySaber Software Discussion
Post by: spearson on February 08, 2018, 07:29:29 PM
If you're using a polyphonic font, there is a bug where the hum fades out but doesn't stop playing. This for me also left the amp on.

You can turn it off by hitting the aux button, or you can play around with bufferedwaveplayerstate (or something hum-state in the polyphonic class, I can't recall exactly), and force the wave player off when the hum has faded out. The latter is the workaround I used until he puts in a proper fix.
Title: Re: Low power notification
Post by: profezzorn on February 08, 2018, 08:06:54 PM
Nice!

profezzorn, the low power notification wasn't working so I fixed it. When the battery voltage drops too low it prints out a warning to the serial port and says "low power" every 10 seconds (10000 milliseconds).

Code: [Select]
    if (battery_monitor.low()) {
      if (current_preset_->style != &style_charging) {
        if (on_) {
          STDOUT.print("Turning off, low battery voltage: ");
          STDOUT.println(battery_monitor.battery());
          Off();
        } else if (millis() - last_beep_ > 10000) {
          STDOUT.print("Warning, low battery voltage: ");
          STDOUT.println(battery_monitor.battery());
#ifdef ENABLE_AUDIO
          // TODO: allow this to be replaced with WAV file
          talkie.Say(spLOW);
          talkie.Say(spPOWER);
//          beeper.Beep(1.0, 3000.0);
#endif
          last_beep_ = millis();
       }
      }
    }


Took me a while to figure out what you actually changed. Should be fixed now.

Quote

While I was at it, I didn't like how often the battery voltage was reported to the serial port, so I added some code to only report when the voltage has changed by more than 0.05 volts:

Code: [Select]
    if (monitor.ShouldPrint(Monitoring::MonitorBattery) || millis() - last_print_millis_ > 5000) {
      if (v > last_print_voltage_ + 0.05 || v < max(last_print_voltage_ - 0.05, 0)) {
        STDOUT.print("Battery voltage: ");
        STDOUT.println(v);
        last_print_voltage_ = v;
      }
      last_print_millis_ = millis();
    }

I kind of prefer to have it tell me fairly often, since I get paranoid when nothing happens for a long time.

Quote

BTW, I didn't see that the beeper class was turning on the amplifier, should this be the code?

Code: [Select]
  void Beep(float length, float freq) {
    digitalWrite(amplifierPin, HIGH); // turn on the amplifier
    x_ = f_ = AUDIO_RATE / freq / 2.0;
    samples_ = AUDIO_RATE * length;
  }


Good idea.

Quote
Last thing, why is the hum still playing (but no sound, I assume because the amp is off) when the saber is off (blade not on)?

First of all, when something like this happens, you can use "whatison" to figure out why.
Secondly, this is almost certainly because of a bug in the polyphonic font implementation that I've been meaning to fix for a while but not gotten around to, until now.

Unfortunately I don't have time to actually test stuff today (maybe laster), but I uploaded the latest version, which compiles, but is otherwise completely untested here:
http://fredrik.hubbe.net/lightsaber/lightsaber-1.201.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.201.zip)

Title: Re: Low power notification
Post by: KanyonKris on February 08, 2018, 10:42:10 PM
I kind of prefer to have it tell me fairly often, since I get paranoid when nothing happens for a long time.
That's true. I cooked up that code because sometimes I'd be annoyed when I scroll back through the serial monitor to study some previous output, and while I'm reading the battery voltage would spit out and cause the text to shift up. It was fun to twiddle with the code to see if I could make it do what I wanted. But the more pragmatic solution is to adjust the interval duration to taste.

Quote
First of all, when something like this happens, you can use "whatison" to figure out why.
Secondly, this is almost certainly because of a bug in the polyphonic font implementation that I've been meaning to fix for a while but not gotten around to, until now.
Good to know, thanks.

Quote
Unfortunately I don't have time to actually test stuff today (maybe laster), but I uploaded the latest version, which compiles, but is otherwise completely untested here:
http://fredrik.hubbe.net/lightsaber/lightsaber-1.201.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.201.zip)
FYI, I tested the low power notification code a lot. I was running it on a Teensy 3.5 and I'd connect/disconnect the power sense resistor and make sure it reacted correctly.

Thanks for the updated code base.

One more thing, when I comment out #define ENABLE_AUDIO I get an error: 'BoxFilter' does not name a type
Looks like some BoxFilter code is up in that big chunk of code enclosed in an ENABLE_AUDIO #ifdef. I couldn't figure out how to fix it.
Title: Re: Low power notification
Post by: profezzorn on February 09, 2018, 12:23:50 AM
One more thing, when I comment out #define ENABLE_AUDIO I get an error: 'BoxFilter' does not name a type
Looks like some BoxFilter code is up in that big chunk of code enclosed in an ENABLE_AUDIO #ifdef. I couldn't figure out how to fix it.

The solution is just to move the BoxFilter template up to live next close to the other helper classes.
Eventually I'm going to create a "common" subdir and move a bunch of these things in there.
I uploaded a 202 version with this fix: http://fredrik.hubbe.net/lightsaber/lightsaber-1.202.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.202.zip)
As soon as i get a chance to test things better, I'll make a update my site to point to this version.

Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 09, 2018, 05:34:54 AM
I'm back from testing the device. But again, i have mixed thoughts. Today, it was planned to put the whole thing in to the prop shield but again, i encoutered a problem. First i rewired the whole thing and soldered the aviator plugs onto electronics, added booster and li-on battery, powered the electronics... and it worked - for a while. LEDs were powering on, the sound was working and i even managed to change the fonts. As i said, it worked for a while.

Now when i power on the saber, all i can hear is the quiet high frequency sound, comming from the speaker and no LEDs turning on. If i change the preset, it speaks the infamous "bank open failure".

I'm using a Panasonic Li-On 3200mAh protected battery. One thing i noticed is, that Voltage level in serial monitor is changing from aprox 3.50V - 3.70V. I added 100kohm resistor and changed the valie of pullup resistor to "100000". Blade recognision resistor is valued to 56ohm, but i leave it to default value of 7800ohm (default). Number of blades is set to "1".

Any solutions?
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 09, 2018, 07:32:01 AM
This is the actual battery:

Panasonic NCR18650PF 10A High Drain Li-ion 2900mAh Battery with Tabs/Solders | (https://www.ebay.com/itm/Panasonic-NCR18650PF-10A-High-Drain-Li-ion-2900mAh-Battery-with-Tabs-Solders/322975613259?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m2749.l2649)
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 09, 2018, 08:06:47 AM
Just for fun / reference:

My Kingston 8 GB microSDHC Class 4 Flash Memory Card (https://www.amazon.com/gp/product/B00200K1TS/) in a TeensySaber board with a Teensy 3.2 reports:

Code: [Select]
SD card speed:
1018.65 kb/s = 11.55 simultaneous audio streams.

The same microSD card in the card slot of a Teensy 3.5 reports:

Code: [Select]
SD card speed:
1989.24 kb/s = 22.55 simultaneous audio streams.

Nearly twice as fast.

The Teensy 3.5 schematic shows all 8 pins of the card slot connected to the CPU so it should be using all 4 data lines in SD mode. Whereas the TeensySaber board is using SPI mode which has one data channel.

I'm impressed that SPI mode is only has half the transfer rate of SD mode. And let's be clear, SPI mode at 1Mb/s (11 streams) is more than enough for lightsabers.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 09, 2018, 08:22:59 AM
I'm back from testing the device. But again, i have mixed thoughts. Today, it was planned to put the whole thing in to the prop shield but again, i encoutered a problem. First i rewired the whole thing and soldered the aviator plugs onto electronics, added booster and li-on battery, powered the electronics... and it worked - for a while. LEDs were powering on, the sound was working and i even managed to change the fonts. As i said, it worked for a while.

Now when i power on the saber, all i can hear is the quiet high frequency sound, comming from the speaker and no LEDs turning on. If i change the preset, it speaks the infamous "bank open failure".

I'm using a Panasonic Li-On 3200mAh protected battery. One thing i noticed is, that Voltage level in serial monitor is changing from aprox 3.50V - 3.70V. I added 100kohm resistor and changed the valie of pullup resistor to "100000". Blade recognision resistor is valued to 56ohm, but i leave it to default value of 7800ohm (default). Number of blades is set to "1".

Any solutions?
If it's a protected Li-Ion that may be the problem. Here's profezzorn's comments:

Quote
A note about batteries
At first, i tried using a 3200mAh protected battery that supports 10A. It's a good solid battery, but if it wasn't fully charged, the protection circuit would kick in when I turned on all the LEDs at the same time in the PL9823 blade. I am now using an unprotected battery that can provide 20A continuous and 100A peak. Such a battery should be respected as it can make any wire glow white hot if short-circuited. If you want to use protected batteries for the extra safety, make sure you have some head-room, because WS2811 and PL9823 can draw more than it says on the data sheet when you turn them on. Also, batteries that are rated for high current will have lower internal resistance, which means that the voltage will drop less when you put load on them. This is an important consideration for this electronics, since it does not have buck-boost driving circuits, and the brightness of the LEDs will drop if the voltage goes too low.
from here - Teensy Saber Electronics (http://fredrik.hubbe.net/lightsaber/electronics.html)

What did you see in the serial monitor? The serial output provides a lot of useful info that is very helpful when troubleshooting. And you don't need to do a screen capture of the serial monitor, just select the serial output and copy and paste it into a post.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 09, 2018, 10:24:26 AM
I'm back from testing the device. But again, i have mixed thoughts. Today, it was planned to put the whole thing in to the prop shield but again, i encoutered a problem. First i rewired the whole thing and soldered the aviator plugs onto electronics, added booster and li-on battery, powered the electronics... and it worked - for a while. LEDs were powering on, the sound was working and i even managed to change the fonts. As i said, it worked for a while.

Now when i power on the saber, all i can hear is the quiet high frequency sound, comming from the speaker and no LEDs turning on. If i change the preset, it speaks the infamous "bank open failure".

I'm using a Panasonic Li-On 3200mAh protected battery. One thing i noticed is, that Voltage level in serial monitor is changing from aprox 3.50V - 3.70V. I added 100kohm resistor and changed the valie of pullup resistor to "100000". Blade recognision resistor is valued to 56ohm, but i leave it to default value of 7800ohm (default). Number of blades is set to "1".

Any solutions?

This is the actual battery:

Panasonic NCR18650PF 10A High Drain Li-ion 2900mAh Battery with Tabs/Solders | (https://www.ebay.com/itm/Panasonic-NCR18650PF-10A-High-Drain-Li-ion-2900mAh-Battery-with-Tabs-Solders/322975613259?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m2749.l2649)


Well, my first thought is to check the battery with a volt meter to make sure it's still charged.
Are you sure that's a protected battery? The page you link doesn't actually say it's protected.
Second, check the voltage after the booster, is it ~5 volts?
The voltage level changes you're seeing are weird though, it's not supposed to change that much. Do you see the same thing if you hook up a multimeter to the battery while it's running? If the battery is unprotected, it's possible that the battery has gotten damaged by discharging it below 2.6 volts. Damaged batteries can behave kind of odd.

Title: Error notifications
Post by: KanyonKris on February 09, 2018, 05:33:42 PM
profezzorn, I've been thinking and playing around a bit with error notifications.

Currently there are 3-4 errors that have talkie voice notifications. While it's cool to have voice messages with a pretty low memory footprint, they don't sound very good (and are often hard to make out) and the message itself is not exactly what the error is (ie Bank Open means a file was not found).

I wondered about putting recorded audio messages in program memory.  Paul Stoffgren (Mr. Teensy) has done some work on this. Paul estimated that you could put 20 seconds of audio in program memory of a Teensy 3.2. I made 4 error messages using a test-to-speech website and came up with 4 seconds of total audio, so that would take 1/5 of program memory. Is this a direction you think is worth pursuing? The plus side is the audio error messages would sound better and be exactly what you want, but is it worth 1/5 of the program space? Let me know what you think.

Another option would be to put error audio files on the SD card. Of course this doesn't work for SD card or file errors. Perhaps beeps could be used if the SD card can't be read (ie 1 beep means low battery, 2 beeps means no SD card, 3 beeps means file not found, 4 beeps means bad blade). Or maybe just use beeps and no voice messages. Again, your thoughts?
Title: Re: TeensySaber Software Discussion
Post by: spearson on February 09, 2018, 05:50:02 PM
I'm getting compile errors with the 202 build:

Code: [Select]
lightsaber:5398: error: 'StyleAllocator' does not name a type
 StyleAllocator StylePtr() {

Any thoughts?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 09, 2018, 05:58:39 PM
I'm getting compile errors with the 202 build:

Code: [Select]
lightsaber:5398: error: 'StyleAllocator' does not name a type
 StyleAllocator StylePtr() {

Any thoughts?

Yeah, I noticed that too. It's because I changed blade styles to be dynamically allocated instead of using global variables to allocate them. I think I mirrored the fix to github if you're in a hurry, otherwise I'll have another beta later tonight.
Title: Re: TeensySaber Software Discussion
Post by: spearson on February 09, 2018, 06:10:28 PM
No hurry, I merged the the fadeAndStop fix into the previous build, so going to do some testing with that.  I had an unusual issue last night in that the the hold aux and clash sound effect didn't stop playing until I powered off (the lighting effect went away, but the sound kept clashing).  I wasn't able to recreate it, so I am going to try and do that again.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 09, 2018, 06:56:31 PM
No hurry, I merged the the fadeAndStop fix into the previous build, so going to do some testing with that.  I had an unusual issue last night in that the the hold aux and clash sound effect didn't stop playing until I powered off (the lighting effect went away, but the sound kept clashing).  I wasn't able to recreate it, so I am going to try and do that again.

Monophonic or polyphonic font?
Title: Re: TeensySaber Software Discussion
Post by: spearson on February 09, 2018, 07:29:01 PM
Poly, same I sent a while back, along with one of thexter's swingl/h zip's of swing files.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 09, 2018, 11:23:52 PM
Poly, same I sent a while back, along with one of thexter's swingl/h zip's of swing files.

I found something that could cause that. (Push power, clash, push aux, release power)
I also fixed the allocation problem, and I've been breaking out code into sub-files a lot....
New beta: http://fredrik.hubbe.net/lightsaber/lightsaber-1.209.ziip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.209.ziip)
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 10, 2018, 09:18:13 AM
I found something that could cause that. (Push power, clash, push aux, release power)
I also fixed the allocation problem, and I've been breaking out code into sub-files a lot....
New beta: http://fredrik.hubbe.net/lightsaber/lightsaber-1.209.ziip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.209.ziip)
Link doesn't work because of a typo (ziip). Corrected/working link: lightsaber-1.209.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.209.zip)
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 10, 2018, 09:43:00 AM
Looks like the /sound directory is missing from the 1.209 zip. Went to Github to get the files in /sound.

also, I'm getting this error:

Code: [Select]
lightsaber:3163: error: 'StyleAllocator' does not name a type
 StyleAllocator StylePtr() {
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 10, 2018, 10:00:25 AM
Looks like the /sound directory is missing from the 1.209 zip. Went to Github to get the files in /sound.

also, I'm getting this error:

Code: [Select]
lightsaber:3163: error: 'StyleAllocator' does not name a type
 StyleAllocator StylePtr() {

Ops, uploaded a new lightsaber-1.209.zip that hopefully has all the files.
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 10, 2018, 01:12:47 PM
I don't understand. Is this StyleAllcoator error a bug or something I'm doing wrong? I get the error even if I use the supplied default_v3_config.h

Code: [Select]
lightsaber:3163: error: 'StyleAllocator' does not name a type
 StyleAllocator StylePtr() {
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 10, 2018, 01:53:52 PM
I don't understand. Is this StyleAllcoator error a bug or something I'm doing wrong? I get the error even if I use the supplied default_v3_config.h

Code: [Select]
lightsaber:3163: error: 'StyleAllocator' does not name a type
 StyleAllocator StylePtr() {

Well it's not you. I tried to make sure everything compiled using the makefile, but when I compiled within arduino, I get the same error, but I don't know why.
I change StyleAllocator from a typedef to a #define (shudder) and the problem went away.

New beta: http://fredrik.hubbe.net/lightsaber/lightsaber-1.210.zip (http://fredrik.hubbe.net/lightsaber/lightsaber-1.210.zip)
Title: Re: TeensySaber Software Discussion
Post by: spearson on February 10, 2018, 02:24:22 PM
If I wanted to make a battery indicator blade style, say a gradient from red to yellow to green, but the blade only lights up the percentage of voltage between 4.2 and 2.7, is the gradient class a good starting point?

I'm not using charging through the blade and am just looking for an easy way of seeing the voltage left.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 10, 2018, 02:52:03 PM
If I wanted to make a battery indicator blade style, say a gradient from red to yellow to green, but the blade only lights up the percentage of voltage between 4.2 and 2.7, is the gradient class a good starting point?

I'm not using charging through the blade and am just looking for an easy way of seeing the voltage left.

I would suggest starting with the StyleCharging. (Which kind of does what you want already...)
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 11, 2018, 09:06:33 AM
Voltage after booster is exactly 5V, and the battery is around 3.7V (checked by multimeter). Battery voltage, measured with multimeter is not changing like in serial monitor.

Battery is protected, cause it contains protecting pcb under the tab. The next thing i should do is to buy a new high current unprotected one.

Is this one suitable for this project?

100% Genuine Efest IMR 18650 BATTERY HIGH DRAIN 3.7v 3000mAh 35A Li-Mn Flat top (https://www.ebay.co.uk/itm/100-Genuine-Efest-IMR-18650-BATTERY-HIGH-DRAIN-3-7v-3000mAh-35A-Li-Mn-Flat-top/263342148328?hash=item3d506a4ae8:m:mvMqw717wge7T0UA-kzIiEw)

How much does current this lihtsaber drain?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 11, 2018, 09:43:48 AM
Voltage after booster is exactly 5V, and the battery is around 3.7V (checked by multimeter). Battery voltage, measured with multimeter is not changing like in serial monitor.

Battery is protected, cause it contains protecting pcb under the tab. The next thing i should do is to buy a new high current unprotected one.

Is this one suitable for this project?

100% Genuine Efest IMR 18650 BATTERY HIGH DRAIN 3.7v 3000mAh 35A Li-Mn Flat top (https://www.ebay.co.uk/itm/100-Genuine-Efest-IMR-18650-BATTERY-HIGH-DRAIN-3-7v-3000mAh-35A-Li-Mn-Flat-top/263342148328?hash=item3d506a4ae8:m:mvMqw717wge7T0UA-kzIiEw)

How much does current this lihtsaber drain?

10A should be enough, and if you measured it, I doubt the battery is the problem.
I don't know about this battery in particular, but IMR is generally a good thing for unprotected batteries.
Title: Re: Error notifications
Post by: profezzorn on February 11, 2018, 10:41:10 AM
profezzorn, I've been thinking and playing around a bit with error notifications.

Currently there are 3-4 errors that have talkie voice notifications. While it's cool to have voice messages with a pretty low memory footprint, they don't sound very good (and are often hard to make out) and the message itself is not exactly what the error is (ie Bank Open means a file was not found).

I wondered about putting recorded audio messages in program memory.  Paul Stoffgren (Mr. Teensy) has done some work on this. Paul estimated that you could put 20 seconds of audio in program memory of a Teensy 3.2. I made 4 error messages using a test-to-speech website and came up with 4 seconds of total audio, so that would take 1/5 of program memory. Is this a direction you think is worth pursuing? The plus side is the audio error messages would sound better and be exactly what you want, but is it worth 1/5 of the program space? Let me know what you think.

Another option would be to put error audio files on the SD card. Of course this doesn't work for SD card or file errors. Perhaps beeps could be used if the SD card can't be read (ie 1 beep means low battery, 2 beeps means no SD card, 3 beeps means file not found, 4 beeps means bad blade). Or maybe just use beeps and no voice messages. Again, your thoughts?

Almost forgot to reply to this...
Let le's do some Math (tm).

We have 256kB of ROM. For error messages, phone quality would be sufficient, which is 8-bit 8kHz audio, or 8 kb / s,  256 / 8 = 32 seconds of audio.
I'd feel silly if I didn't apply some sort of compression to that though. A simple linear-predictive-encoding can double the amount of audio with relatively little loss in quality, which means 64 seconds of audio, or 4kb / s.
We probably only need 10 seconds of audio though, which would take up ~40kb.  40kb is not that much, but I can pretty much guarantee that it'll be the first thing to go if we start running low on space.

Another alternative would be to simply generate new error messages using the current speech synthesizer. The original talkie script comes with a matlab script that is supposed to be able to generate talkie data. Maybe it's possible to tweak that a little to make it generate higher quality. (Like, maybe by upping the sampling rate to 11kHz)
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 11, 2018, 12:04:25 PM
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 11, 2018, 12:12:37 PM
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 11, 2018, 12:23:00 PM
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Sorry, maybe i understand it the wrong wrong way. This is the resistor, i took it in consideration:

(https://thumb.ibb.co/kPmtWS/blade_ID_resistor.jpg) (https://ibb.co/kPmtWS)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 11, 2018, 12:30:14 PM
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Sorry, maybe i understand it the wrong wrong way. This is the resistor, i took it in consideration:

(https://thumb.ibb.co/kPmtWS/blade_ID_resistor.jpg) (https://ibb.co/kPmtWS)



First of all, that's not the blade ID, it's the current limiter. (The one below it is the blade ID.)
Secondly, I'm not sure if I used correct values for the illustration, so please ignore the color bands.
So, current limiter: 100-300 ohm
Blade ID: 2k to 100k   (and update your config file to match.)

Also; this is probably the wrong thread for this, since this has nothing to do with the software.
Might be better to just create a new thread in the "Profezzorn's lab" subforum.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 11, 2018, 08:20:34 PM
So I commented out the battery charge preset and the button work to turn it on and off but the clash does not work.... but clashh will trigger from the serial monitor but not the button... We are getting somewhere.
When you power up your saber boards, what does the Serial Monitor show? Specifically, does it say "Accel setup ... Done." or "Accell setup ... Failed."?
If it failed, try powering it again because sometimes it fails on power up randomly. If you power up 3 times and it fails every time, you probably have a hardware problem. We built our boards and 2-3 of them had these failures but reflowing the IMU IC fixed it.

It's possible I broke something too. Or maybe gmcivor made some changes in the earlier version but forgot to make them in this version?
I will update my v1 saber when   I get a chance to make sure.

Finally got a chance to update my V1 saber, which works fine with the new code, so I don't think the code is broken.
Title: Re: TeensySaber Software Discussion
Post by: miib123 on February 12, 2018, 06:39:04 AM
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Sorry, maybe i understand it the wrong wrong way. This is the resistor, i took it in consideration:

(https://thumb.ibb.co/kPmtWS/blade_ID_resistor.jpg) (https://ibb.co/kPmtWS)



First of all, that's not the blade ID, it's the current limiter. (The one below it is the blade ID.)
Secondly, I'm not sure if I used correct values for the illustration, so please ignore the color bands.
So, current limiter: 100-300 ohm
Blade ID: 2k to 100k   (and update your config file to match.)

Also; this is probably the wrong thread for this, since this has nothing to do with the software.
Might be better to just create a new thread in the "Profezzorn's lab" subforum.

Thank you! I will change the resistor value.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 12:26:11 PM
*** Update: Doing some more bench testing I put it in the hilt and turned it on and I discovered it doesn't detect swings either. So the clash and swing does not work. I am using V1 electronics in this saber. So clash and swing sounds do not work in hilt. On the bench I can make it play the clash sounds and everything. I uploaded the new software from the website and it still has the same problem. No clash or swing with it in the hilt, but on the bench i can trigger a clash through the serial monitor.

This is my demo saber for students to see the project in the others I have built or I am building I am using V2 OR V3 electronics.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 13, 2018, 12:30:18 PM
*** Update: Doing some more bench testing I put it in the hilt and turned it on and I discovered it doesn't detect swings either. So the clash and swing does not work. I am using V1 electronics in this saber. So clash and swing sounds do not work in hilt. On the bench I can make it play the clash sounds and everything. I uploaded the new software from the website and it still has the same problem. No clash or swing with it in the hilt, but on the bench i can trigger a clash through the serial monitor.

This is my demo saber for students to see the project in the others I have built or I am building I am using V2 OR V3 electronics.

Regards,

GMcIvor

Did you make sure to use the right config file?
I recently updated my V1 saber, and at one point I picked the wrong config file which makes it behave all kind o weird, but when I picked the right config file, I had no trouble.
If you created a new config file or something, make sure it includes v1_config.h
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 01:37:46 PM
Quote
Did you make sure to use the right config file?
I recently updated my V1 saber, and at one point I picked the wrong config file which makes it behave all kind o weird, but when I picked the right config file, I had no trouble.
If you created a new config file or something, make sure it includes v1_config.h

That was the problem, I selected the new config files and it works.. But a new problem has arised..... When I turn it on in the serial monitor it will just clash randomly every few seconds or repeatedly. I leave it flat on my desk and it will just clash with no input.....

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 13, 2018, 01:53:57 PM
Quote
Did you make sure to use the right config file?
I recently updated my V1 saber, and at one point I picked the wrong config file which makes it behave all kind o weird, but when I picked the right config file, I had no trouble.
If you created a new config file or something, make sure it includes v1_config.h

That was the problem, I selected the new config files and it works.. But a new problem has arised..... When I turn it on in the serial monitor it will just clash randomly every few seconds or repeatedly. I leave it flat on my desk and it will just clash with no input.....

Regards,

GMcIvor

That's weird. It only happens when you use the serial monitor?
What is your CLASH_THRESHOLD_G set to?
You can use "monitor clash" to have it print out acceleration debug messages.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 02:18:12 PM

Quote

That's weird. It only happens when you use the serial monitor?
What is your CLASH_THRESHOLD_G set to?
You can use "monitor clash" to have it print out acceleration debug messages.

No it happens when I unplug it from the serial monitor as well. It is set to 1.0 I set it to .5 and it still did the same thing.

Code: [Select]
Sdcard found..
ID: 95 volts 0.31 resistance= 3374.60
blade= 0
WS2811 Blade with 73 leds
Scanning sound font: Fonts/Graflex7 done
Activating polyphonic font.
unit = 0 vol = 0.50, No sounds found: boot
Amplifier off.
Accel setup ...  Done
Gyro setup ...  Done
Welcome to TeensySaber, type 'help' for more info.
Ignition.
unit = 0 vol = 0.50, Playing Fonts/Graflex7/hum01.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.50, Playing Fonts/Graflex7/out05.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh06.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh06.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh07.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh07.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh16.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 4 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh15.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
Whut? :minitor
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh10.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh09.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh09.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh04.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh04.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
Battery voltage: 3.54
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh14.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh16.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh13.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 4 vol = 0.50, Playing Fonts/Graflex7/clsh06.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.04, -0.00, 1.03 peak 1.54, 0.41, -0.35 (1.28)
ACCEL: -0.02, -0.07, 1.03 peak -0.67, -0.18, 0.22 (0.85)
ACCEL: -0.00, -0.02, 0.92 peak -0.71, -0.08, 0.14 (0.85)
ACCEL: -0.16, -0.08, 1.07 peak -0.55, -0.08, 0.21 (0.77)
ACCEL: -0.40, -0.09, 1.09 peak -0.45, -0.03, 0.01 (0.67)
ACCEL: 0.20, 0.02, 0.96 peak 0.63, 0.13, -0.21 (0.82)
ACCEL: -0.31, -0.09, 1.09 peak -0.67, -0.12, 0.24 (0.85)
ACCEL: 0.34, 0.06, 0.88 peak 0.72, 0.12, -0.18 (0.87)
ACCEL: -0.22, -0.04, 1.07 peak 0.74, 0.14, -0.13 (0.87)
ACCEL: 0.39, 0.05, 0.95 peak -0.82, -0.16, 0.19 (0.93)
ACCEL: -0.42, -0.09, 1.08 peak -0.82, -0.12, 0.07 (0.91)
ACCEL: -0.15, -0.06, 0.99 peak 0.75, 0.13, -0.12 (0.88)
ACCEL: -0.08, -0.02, 0.99 peak -0.64, -0.09, -0.01 (0.80)
ACCEL: 0.10, 0.02, 0.95 peak 0.71, 0.15, -0.14 (0.86)
ACCEL: -0.18, -0.06, 1.00 peak -0.64, -0.13, 0.11 (0.82)
ACCEL: -0.13, -0.09, 0.98 peak 0.49, 0.10, -0.13 (0.72)
ACCEL: 0.06, -0.04, 0.95 peak -0.59, -0.11, 0.09 (0.78)
ACCEL: -0.04, -0.08, 1.01 peak 0.59, 0.12, -0.06 (0.78)
ACCEL: -0.06, -0.04, 1.04 peak -0.69, -0.11, 0.15 (0.85)
ACCEL: 0.16, 0.04, 0.98 peak -0.57, -0.11, 0.15 (0.77)
ACCEL: -0.12, -0.08, 1.06 peak 0.63, 0.11, -0.15 (0.81)
ACCEL: 0.05, -0.02, 0.96 peak 0.67, 0.15, -0.21 (0.85)
ACCEL: -0.29, -0.09, 1.02 peak 0.61, 0.18, -0.05 (0.80)
ACCEL: 0.36, 0.07, 0.89 peak 0.73, 0.12, -0.25 (0.89)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.02, 0.09, 0.95 peak -1.42, -0.26, 0.31 (1.21)
ACCEL: -0.07, -0.03, 1.14 peak 1.59, 0.31, -0.13 (1.27)
ACCEL: -0.25, -0.04, 1.04 peak -1.39, 0.00, 0.00 (1.18)
ACCEL: 0.16, -0.02, 0.97 peak -0.83, -0.23, 0.20 (0.94)
ACCEL: -0.20, -0.06, 1.04 peak -0.70, -0.10, 0.12 (0.85)
ACCEL: -0.06, -0.04, 0.92 peak -0.63, -0.19, 0.15 (0.82)
ACCEL: 0.03, -0.01, 1.01 peak 0.49, 0.17, -0.11 (0.73)
ACCEL: -0.10, -0.08, 1.07 peak 0.54, 0.15, -0.22 (0.78)
ACCEL: 0.45, 0.10, 0.90 peak -0.76, -0.23, 0.19 (0.90)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh15.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.67, -0.16, 0.86 peak 1.43, 0.31, -0.33 (1.22)
ACCEL: -0.33, -0.07, 0.94 peak -1.27, -0.24, 0.06 (1.14)
ACCEL: 0.21, 0.05, 1.00 peak -1.11, -0.27, -0.07 (1.07)
ACCEL: -0.33, -0.12, 0.93 peak -0.91, -0.25, -0.04 (0.97)
ACCEL: -0.05, -0.07, 0.99 peak -0.86, -0.25, 0.02 (0.95)
ACCEL: 0.29, 0.06, 0.99 peak -0.80, -0.23, 0.11 (0.92)
ACCEL: 0.30, -0.08, 1.05 peak 0.69, 0.16, -0.06 (0.84)
ACCEL: -0.16, -0.02, 1.05 peak -0.84, -0.15, 0.07 (0.93)
ACCEL: -0.11, -0.01, 1.02 peak -0.82, -0.17, 0.14 (0.92)
ACCEL: 0.25, 0.05, 0.98 peak 0.92, 0.20, -0.14 (0.98)
ACCEL: -0.25, -0.10, 1.02 peak 0.86, 0.18, -0.08 (0.94)
ACCEL: -0.22, -0.10, 0.99 peak 0.68, 0.18, 0.03 (0.84)
ACCEL: -0.18, -0.06, 1.00 peak -0.87, -0.19, 0.12 (0.95)
ACCEL: -0.25, -0.10, 0.98 peak -0.93, -0.17, 0.14 (0.98)
ACCEL: -0.27, -0.10, 1.01 peak -0.82, -0.17, 0.11 (0.92)
ACCEL: -0.06, -0.04, 1.01 peak 0.86, 0.20, -0.04 (0.94)
ACCEL: -0.18, -0.09, 1.02 peak 0.67, 0.13, -0.10 (0.83)
ACCEL: -0.01, -0.09, 0.99 peak -0.83, -0.19, 0.05 (0.92)
ACCEL: -0.03, -0.08, 1.02 peak 0.90, 0.19, -0.05 (0.96)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: 0.07, 0.06, 1.02 peak 1.37, 0.11, 0.10 (1.17)
ACCEL: -0.09, 0.02, 0.95 peak 0.88, 0.23, -0.04 (0.96)
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.14, -0.01, 1.06 peak -1.06, -0.20, -0.00 (1.04)
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.35, -0.05, 1.02 peak -1.07, -0.17, -0.01 (1.04)
ACCEL: 0.49, 0.03, 1.14 peak -0.98, -0.18, 0.25 (1.01)
ACCEL: 0.37, 0.04, 1.00 peak -0.78, -0.12, 0.09 (0.89)
ACCEL: 0.10, -0.01, 0.99 peak -0.86, -0.19, 0.09 (0.94)
ACCEL: -0.19, -0.06, 1.03 peak 0.70, 0.12, 0.03 (0.85)
ACCEL: -0.28, -0.09, 1.07 peak 0.64, 0.17, 0.04 (0.82)
ACCEL: -0.07, -0.08, 1.03 peak 0.72, 0.13, 0.07 (0.86)
ACCEL: -0.01, 0.01, 0.96 peak -0.52, -0.06, 0.07 (0.73)
ACCEL: -0.04, -0.04, 1.00 peak 0.60, 0.14, 0.01 (0.79)
ACCEL: -0.16, -0.07, 1.07 peak -0.78, -0.15, -0.01 (0.89)
ACCEL: -0.30, -0.06, 1.03 peak -0.62, -0.14, 0.04 (0.80)
ACCEL: 0.18, -0.01, 0.96 peak -0.75, -0.16, 0.04 (0.88)
ACCEL: -0.08, -0.08, 0.98 peak 0.67, 0.10, 0.00 (0.82)
ACCEL: 0.19, 0.02, 1.02 peak -0.73, -0.13, 0.05 (0.86)
ACCEL: -0.21, -0.04, 1.06 peak -0.83, -0.13, 0.11 (0.92)
ACCEL: -0.06, -0.00, 1.02 peak -0.74, -0.15, 0.06 (0.87)
ACCEL: -0.22, -0.09, 0.97 peak -0.79, -0.16, 0.07 (0.90)
ACCEL: 0.07, -0.02, 0.99 peak 0.66, 0.13, -0.09 (0.82)
ACCEL: 0.06, -0.02, 0.98 peak 0.61, 0.08, 0.02 (0.79)
ACCEL: 0.13, -0.02, 0.98 peak 0.43, 0.13, 0.01 (0.67)
ACCEL: -0.25, -0.07, 0.98 peak -0.65, -0.09, -0.02 (0.81)
ACCEL: -0.15, -0.07, 0.99 peak 0.72, 0.11, -0.07 (0.86)
ACCEL: -0.13, -0.04, 1.00 peak 0.53, 0.11, 0.10 (0.74)
ACCEL: -0.15, -0.07, 0.96 peak -0.73, -0.16, -0.00 (0.87)
Playing Fonts/Graflex7/hum01.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.09, -0.06, 0.98 peak 0.59, 0.09, -0.04 (0.77)
ACCEL: -0.02, 0.01, 1.02 peak -0.87, -0.16, 0.14 (0.95)
ACCEL: 0.21, 0.04, 1.01 peak -0.82, -0.03, -0.03 (0.91)
ACCEL: 0.39, 0.05, 0.97 peak 0.93, 0.16, -0.13 (0.98)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.29, -0.15, 1.06 peak 1.07, 0.19, -0.05 (1.05)
ACCEL: 0.04, 0.00, 1.01 peak 0.93, 0.18, -0.01 (0.97)
ACCEL: -0.02, -0.01, 1.04 peak 0.75, 0.16, 0.13 (0.88)
ACCEL: -0.31, -0.09, 1.06 peak 0.93, 0.15, 0.04 (0.97)
ACCEL: 0.04, 0.01, 0.99 peak -0.75, -0.10, -0.06 (0.87)
ACCEL: -0.32, -0.09, 0.99 peak -0.85, -0.19, -0.03 (0.93)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh07.wav
channels: 1 rate: 22050 bits: 16
ACCEL: 0.25, 0.04, 0.96 peak -1.00, -0.19, -0.01 (1.01)
ACCEL: -0.55, -0.12, 1.02 peak -1.57, -0.28, 0.15 (1.27)
ACCEL: -0.64, -0.13, 0.91 peak 0.95, 0.16, 0.13 (0.99)
ACCEL: 0.18, -0.00, 0.98 peak -0.93, -0.17, -0.11 (0.98)
EVENT: Clash ON

This is a snippet of what the monitor clash is saying. It just decides to clash with no input or movement from me....

Regards,

GMcIvor 
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 13, 2018, 02:33:44 PM

Quote

That's weird. It only happens when you use the serial monitor?
What is your CLASH_THRESHOLD_G set to?
You can use "monitor clash" to have it print out acceleration debug messages.

No it happens when I unplug it from the serial monitor as well. It is set to 1.0 I set it to .5 and it still did the same thing.

Code: [Select]
Sdcard found..
ID: 95 volts 0.31 resistance= 3374.60
blade= 0
WS2811 Blade with 73 leds
Scanning sound font: Fonts/Graflex7 done
Activating polyphonic font.
unit = 0 vol = 0.50, No sounds found: boot
Amplifier off.
Accel setup ...  Done
Gyro setup ...  Done
Welcome to TeensySaber, type 'help' for more info.
Ignition.
unit = 0 vol = 0.50, Playing Fonts/Graflex7/hum01.wav
channels: 1 rate: 22050 bits: 16
unit = 1 vol = 0.50, Playing Fonts/Graflex7/out05.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh06.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh06.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh07.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh07.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh16.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 4 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh15.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
Whut? :minitor
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh10.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh09.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh09.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh04.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh04.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
Battery voltage: 3.54
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh14.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh16.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh13.wav
channels: 1 rate: 22050 bits: 16
EVENT: Clash ON
unit = 4 vol = 0.50, Playing Fonts/Graflex7/clsh06.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.04, -0.00, 1.03 peak 1.54, 0.41, -0.35 (1.28)
ACCEL: -0.02, -0.07, 1.03 peak -0.67, -0.18, 0.22 (0.85)
ACCEL: -0.00, -0.02, 0.92 peak -0.71, -0.08, 0.14 (0.85)
ACCEL: -0.16, -0.08, 1.07 peak -0.55, -0.08, 0.21 (0.77)
ACCEL: -0.40, -0.09, 1.09 peak -0.45, -0.03, 0.01 (0.67)
ACCEL: 0.20, 0.02, 0.96 peak 0.63, 0.13, -0.21 (0.82)
ACCEL: -0.31, -0.09, 1.09 peak -0.67, -0.12, 0.24 (0.85)
ACCEL: 0.34, 0.06, 0.88 peak 0.72, 0.12, -0.18 (0.87)
ACCEL: -0.22, -0.04, 1.07 peak 0.74, 0.14, -0.13 (0.87)
ACCEL: 0.39, 0.05, 0.95 peak -0.82, -0.16, 0.19 (0.93)
ACCEL: -0.42, -0.09, 1.08 peak -0.82, -0.12, 0.07 (0.91)
ACCEL: -0.15, -0.06, 0.99 peak 0.75, 0.13, -0.12 (0.88)
ACCEL: -0.08, -0.02, 0.99 peak -0.64, -0.09, -0.01 (0.80)
ACCEL: 0.10, 0.02, 0.95 peak 0.71, 0.15, -0.14 (0.86)
ACCEL: -0.18, -0.06, 1.00 peak -0.64, -0.13, 0.11 (0.82)
ACCEL: -0.13, -0.09, 0.98 peak 0.49, 0.10, -0.13 (0.72)
ACCEL: 0.06, -0.04, 0.95 peak -0.59, -0.11, 0.09 (0.78)
ACCEL: -0.04, -0.08, 1.01 peak 0.59, 0.12, -0.06 (0.78)
ACCEL: -0.06, -0.04, 1.04 peak -0.69, -0.11, 0.15 (0.85)
ACCEL: 0.16, 0.04, 0.98 peak -0.57, -0.11, 0.15 (0.77)
ACCEL: -0.12, -0.08, 1.06 peak 0.63, 0.11, -0.15 (0.81)
ACCEL: 0.05, -0.02, 0.96 peak 0.67, 0.15, -0.21 (0.85)
ACCEL: -0.29, -0.09, 1.02 peak 0.61, 0.18, -0.05 (0.80)
ACCEL: 0.36, 0.07, 0.89 peak 0.73, 0.12, -0.25 (0.89)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh11.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.02, 0.09, 0.95 peak -1.42, -0.26, 0.31 (1.21)
ACCEL: -0.07, -0.03, 1.14 peak 1.59, 0.31, -0.13 (1.27)
ACCEL: -0.25, -0.04, 1.04 peak -1.39, 0.00, 0.00 (1.18)
ACCEL: 0.16, -0.02, 0.97 peak -0.83, -0.23, 0.20 (0.94)
ACCEL: -0.20, -0.06, 1.04 peak -0.70, -0.10, 0.12 (0.85)
ACCEL: -0.06, -0.04, 0.92 peak -0.63, -0.19, 0.15 (0.82)
ACCEL: 0.03, -0.01, 1.01 peak 0.49, 0.17, -0.11 (0.73)
ACCEL: -0.10, -0.08, 1.07 peak 0.54, 0.15, -0.22 (0.78)
ACCEL: 0.45, 0.10, 0.90 peak -0.76, -0.23, 0.19 (0.90)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh15.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.67, -0.16, 0.86 peak 1.43, 0.31, -0.33 (1.22)
ACCEL: -0.33, -0.07, 0.94 peak -1.27, -0.24, 0.06 (1.14)
ACCEL: 0.21, 0.05, 1.00 peak -1.11, -0.27, -0.07 (1.07)
ACCEL: -0.33, -0.12, 0.93 peak -0.91, -0.25, -0.04 (0.97)
ACCEL: -0.05, -0.07, 0.99 peak -0.86, -0.25, 0.02 (0.95)
ACCEL: 0.29, 0.06, 0.99 peak -0.80, -0.23, 0.11 (0.92)
ACCEL: 0.30, -0.08, 1.05 peak 0.69, 0.16, -0.06 (0.84)
ACCEL: -0.16, -0.02, 1.05 peak -0.84, -0.15, 0.07 (0.93)
ACCEL: -0.11, -0.01, 1.02 peak -0.82, -0.17, 0.14 (0.92)
ACCEL: 0.25, 0.05, 0.98 peak 0.92, 0.20, -0.14 (0.98)
ACCEL: -0.25, -0.10, 1.02 peak 0.86, 0.18, -0.08 (0.94)
ACCEL: -0.22, -0.10, 0.99 peak 0.68, 0.18, 0.03 (0.84)
ACCEL: -0.18, -0.06, 1.00 peak -0.87, -0.19, 0.12 (0.95)
ACCEL: -0.25, -0.10, 0.98 peak -0.93, -0.17, 0.14 (0.98)
ACCEL: -0.27, -0.10, 1.01 peak -0.82, -0.17, 0.11 (0.92)
ACCEL: -0.06, -0.04, 1.01 peak 0.86, 0.20, -0.04 (0.94)
ACCEL: -0.18, -0.09, 1.02 peak 0.67, 0.13, -0.10 (0.83)
ACCEL: -0.01, -0.09, 0.99 peak -0.83, -0.19, 0.05 (0.92)
ACCEL: -0.03, -0.08, 1.02 peak 0.90, 0.19, -0.05 (0.96)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: 0.07, 0.06, 1.02 peak 1.37, 0.11, 0.10 (1.17)
ACCEL: -0.09, 0.02, 0.95 peak 0.88, 0.23, -0.04 (0.96)
EVENT: Clash ON
unit = 2 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.14, -0.01, 1.06 peak -1.06, -0.20, -0.00 (1.04)
EVENT: Clash ON
unit = 3 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.35, -0.05, 1.02 peak -1.07, -0.17, -0.01 (1.04)
ACCEL: 0.49, 0.03, 1.14 peak -0.98, -0.18, 0.25 (1.01)
ACCEL: 0.37, 0.04, 1.00 peak -0.78, -0.12, 0.09 (0.89)
ACCEL: 0.10, -0.01, 0.99 peak -0.86, -0.19, 0.09 (0.94)
ACCEL: -0.19, -0.06, 1.03 peak 0.70, 0.12, 0.03 (0.85)
ACCEL: -0.28, -0.09, 1.07 peak 0.64, 0.17, 0.04 (0.82)
ACCEL: -0.07, -0.08, 1.03 peak 0.72, 0.13, 0.07 (0.86)
ACCEL: -0.01, 0.01, 0.96 peak -0.52, -0.06, 0.07 (0.73)
ACCEL: -0.04, -0.04, 1.00 peak 0.60, 0.14, 0.01 (0.79)
ACCEL: -0.16, -0.07, 1.07 peak -0.78, -0.15, -0.01 (0.89)
ACCEL: -0.30, -0.06, 1.03 peak -0.62, -0.14, 0.04 (0.80)
ACCEL: 0.18, -0.01, 0.96 peak -0.75, -0.16, 0.04 (0.88)
ACCEL: -0.08, -0.08, 0.98 peak 0.67, 0.10, 0.00 (0.82)
ACCEL: 0.19, 0.02, 1.02 peak -0.73, -0.13, 0.05 (0.86)
ACCEL: -0.21, -0.04, 1.06 peak -0.83, -0.13, 0.11 (0.92)
ACCEL: -0.06, -0.00, 1.02 peak -0.74, -0.15, 0.06 (0.87)
ACCEL: -0.22, -0.09, 0.97 peak -0.79, -0.16, 0.07 (0.90)
ACCEL: 0.07, -0.02, 0.99 peak 0.66, 0.13, -0.09 (0.82)
ACCEL: 0.06, -0.02, 0.98 peak 0.61, 0.08, 0.02 (0.79)
ACCEL: 0.13, -0.02, 0.98 peak 0.43, 0.13, 0.01 (0.67)
ACCEL: -0.25, -0.07, 0.98 peak -0.65, -0.09, -0.02 (0.81)
ACCEL: -0.15, -0.07, 0.99 peak 0.72, 0.11, -0.07 (0.86)
ACCEL: -0.13, -0.04, 1.00 peak 0.53, 0.11, 0.10 (0.74)
ACCEL: -0.15, -0.07, 0.96 peak -0.73, -0.16, -0.00 (0.87)
Playing Fonts/Graflex7/hum01.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.09, -0.06, 0.98 peak 0.59, 0.09, -0.04 (0.77)
ACCEL: -0.02, 0.01, 1.02 peak -0.87, -0.16, 0.14 (0.95)
ACCEL: 0.21, 0.04, 1.01 peak -0.82, -0.03, -0.03 (0.91)
ACCEL: 0.39, 0.05, 0.97 peak 0.93, 0.16, -0.13 (0.98)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh05.wav
channels: 1 rate: 22050 bits: 16
ACCEL: -0.29, -0.15, 1.06 peak 1.07, 0.19, -0.05 (1.05)
ACCEL: 0.04, 0.00, 1.01 peak 0.93, 0.18, -0.01 (0.97)
ACCEL: -0.02, -0.01, 1.04 peak 0.75, 0.16, 0.13 (0.88)
ACCEL: -0.31, -0.09, 1.06 peak 0.93, 0.15, 0.04 (0.97)
ACCEL: 0.04, 0.01, 0.99 peak -0.75, -0.10, -0.06 (0.87)
ACCEL: -0.32, -0.09, 0.99 peak -0.85, -0.19, -0.03 (0.93)
EVENT: Clash ON
unit = 1 vol = 0.50, Playing Fonts/Graflex7/clsh07.wav
channels: 1 rate: 22050 bits: 16
ACCEL: 0.25, 0.04, 0.96 peak -1.00, -0.19, -0.01 (1.01)
ACCEL: -0.55, -0.12, 1.02 peak -1.57, -0.28, 0.15 (1.27)
ACCEL: -0.64, -0.13, 0.91 peak 0.95, 0.16, 0.13 (0.99)
ACCEL: 0.18, -0.00, 0.98 peak -0.93, -0.17, -0.11 (0.98)
EVENT: Clash ON

This is a snippet of what the monitor clash is saying. It just decides to clash with no input or movement from me....

Regards,

GMcIvor


That's pretty weird. For some reason it seems like the X axis is getting a lot of noise, but the others are fine. It's possible that this could be caused by the board being loose and getting rattled by the sound. Have you tried going back to an earlier version of the code to see if that helps? (Although I don't remember changing anything that could cause this recently.)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 02:41:18 PM

Quote

That's pretty weird. For some reason it seems like the X axis is getting a lot of noise, but the others are fine. It's possible that this could be caused by the board being loose and getting rattled by the sound. Have you tried going back to an earlier version of the code to see if that helps? (Although I don't remember changing anything that could cause this recently.)

It worked before the update to 1.191 once I updated the software it seemed to go wonky.

I can update to 1.175 I will download that code and see if that helps the problem.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 02:50:47 PM
I downloaded the 1.175 and was getting voice error on the teensy. I checked again and I cannot get the saber to swing I can hit the blade get it to clash but no swing.... It still clashes without any input...
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 13, 2018, 02:59:10 PM
I downloaded the 1.175 and was getting voice error on the teensy. I checked again and I cannot get the saber to swing I can hit the blade get it to clash but no swing.... It still clashes without any input...

If it still clashes with no input, it's probably not a software error.
(Unless you're consistently doing something weird to the configuration or code.)
What was the voice error you got? (may be unrelated though.)
Did you use the right config file with 1.175?

Kind of sounds like something's up with the hardware, but I don't know what.
Did you make sure to cut the power for a few seconds after you used the right config file?
Sometimes the accel/gyro chips go a little weird, but removing power fixes it.
(I have not seen this particular kind of weird before though.)

Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 13, 2018, 02:59:54 PM
FWIW, I noticed no change in clash sensitivity updating to 1.191 and above. Way back when I assembled my saber I had to bump the CLASH_THRESHOLD_G up to 1.2 to prevent sounds from the speaker triggering clashes. Higher CLASH_THRESHOLD_G means less sensitive, right?
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 03:18:58 PM
FWIW, I noticed no change in clash sensitivity updating to 1.191 and above. Way back when I assembled my saber I had to bump the CLASH_THRESHOLD_G up to 1.2 to prevent sounds from the speaker triggering clashes. Higher CLASH_THRESHOLD_G means less sensitive, right?

I bumped it up to 1.5 and it seems to fix that problem... Does the smoothswing work with the V1 electronics? It doesn't seem to be doing what the demo video showed...

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 13, 2018, 03:36:12 PM
FWIW, I noticed no change in clash sensitivity updating to 1.191 and above. Way back when I assembled my saber I had to bump the CLASH_THRESHOLD_G up to 1.2 to prevent sounds from the speaker triggering clashes. Higher CLASH_THRESHOLD_G means less sensitive, right?

I bumped it up to 1.5 and it seems to fix that problem... Does the smoothswing work with the V1 electronics? It doesn't seem to be doing what the demo video showed...

Regards,

GMcIvor

Yes, it should work with V1 electronics.
Do you have a smoothswing V2 font?
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 03:50:09 PM

Quote

Yes, it should work with V1 electronics.
Do you have a smoothswing V2 font?

That might be the problem. How do I tell if that Fonts I have are smoothswing V2 or do I need special fonts to purchase ?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: KanyonKris on February 13, 2018, 03:54:02 PM
That might be the problem. How do I tell if that Fonts I have are smoothswing V2 or do I need special fonts to purchase ?
thexter made some SoothSwing V2 fonts, smoothgrey and smoothjedi. Get them here - SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread?page=3)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 04:16:56 PM

Quote
thexter made some SoothSwing V2 fonts, smoothgrey and smoothjedi. Get them here - SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread?page=3)

I downloaded the fonts and added them to my SD card updated the code but when I switch to that preset it says bad image failure.... it is only on the swoothswing V2 Fonts....

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 13, 2018, 04:23:25 PM

Quote
thexter made some SoothSwing V2 fonts, smoothgrey and smoothjedi. Get them here - SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread?page=3)

I downloaded the fonts and added them to my SD card updated the code but when I switch to that preset it says bad image failure.... it is only on the swoothswing V2 Fonts....

Regards,

GMcIvor

Did you rename the directories to something 8 characters or less?
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 13, 2018, 04:26:01 PM
Quote

Did you rename the directories to something 8 characters or less?

I forgot about that small detail I will rename and test it.. Most likely the issue.

** Yes that was the issue...

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 14, 2018, 08:48:21 AM
Are many people making smoothswing V2 fonts? or is it few and far between? Is there a way to make other fonts you have compatible with smoothswing?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 14, 2018, 10:41:12 AM
Are many people making smoothswing V2 fonts? or is it few and far between? Is there a way to make other fonts you have compatible with smoothswing?

Regards,

GMcIvor

I don't know how many people are working on smoothswing V2 fonts, but it's at least two.
Yes, you can add smoothswing files to an existing font, there is a thread about it here:
SmoothSwing V2 Font Creators' Discussion Thread | The Rebel Armory (http://therebelarmory.com/thread/9176/smoothswing-font-creators-discussion-thread)
Title: Re: Error notifications
Post by: profezzorn on February 15, 2018, 03:17:45 PM
profezzorn, I've been thinking and playing around a bit with error notifications.

Currently there are 3-4 errors that have talkie voice notifications. While it's cool to have voice messages with a pretty low memory footprint, they don't sound very good (and are often hard to make out) and the message itself is not exactly what the error is (ie Bank Open means a file was not found).

I wondered about putting recorded audio messages in program memory.  Paul Stoffgren (Mr. Teensy) has done some work on this. Paul estimated that you could put 20 seconds of audio in program memory of a Teensy 3.2. I made 4 error messages using a test-to-speech website and came up with 4 seconds of total audio, so that would take 1/5 of program memory. Is this a direction you think is worth pursuing? The plus side is the audio error messages would sound better and be exactly what you want, but is it worth 1/5 of the program space? Let me know what you think.

Another option would be to put error audio files on the SD card. Of course this doesn't work for SD card or file errors. Perhaps beeps could be used if the SD card can't be read (ie 1 beep means low battery, 2 beeps means no SD card, 3 beeps means file not found, 4 beeps means bad blade). Or maybe just use beeps and no voice messages. Again, your thoughts?

Almost forgot to reply to this...
Let le's do some Math (tm).

We have 256kB of ROM. For error messages, phone quality would be sufficient, which is 8-bit 8kHz audio, or 8 kb / s,  256 / 8 = 32 seconds of audio.
I'd feel silly if I didn't apply some sort of compression to that though. A simple linear-predictive-encoding can double the amount of audio with relatively little loss in quality, which means 64 seconds of audio, or 4kb / s.
We probably only need 10 seconds of audio though, which would take up ~40kb.  40kb is not that much, but I can pretty much guarantee that it'll be the first thing to go if we start running low on space.

Another alternative would be to simply generate new error messages using the current speech synthesizer. The original talkie script comes with a matlab script that is supposed to be able to generate talkie data. Maybe it's possible to tweak that a little to make it generate higher quality. (Like, maybe by upping the sampling rate to 11kHz)

I found a program that can make LPC codes from WAV files, so I think I'm just going to record my own error messages, as the current voice data makes it hard to do good error messages. (I started out trying to make an error message for "font directory name too long", but it's pretty much impossible to express that with the words available.)

I don't suppose someone has talk-like-darth-vader filter or something that I could use? :)
Title: Re: Error notifications
Post by: KanyonKris on February 15, 2018, 04:14:20 PM
profezzorn, I've been thinking and playing around a bit with error notifications.

Currently there are 3-4 errors that have talkie voice notifications. While it's cool to have voice messages with a pretty low memory footprint, they don't sound very good (and are often hard to make out) and the message itself is not exactly what the error is (ie Bank Open means a file was not found).

I wondered about putting recorded audio messages in program memory.  Paul Stoffgren (Mr. Teensy) has done some work on this. Paul estimated that you could put 20 seconds of audio in program memory of a Teensy 3.2. I made 4 error messages using a test-to-speech website and came up with 4 seconds of total audio, so that would take 1/5 of program memory. Is this a direction you think is worth pursuing? The plus side is the audio error messages would sound better and be exactly what you want, but is it worth 1/5 of the program space? Let me know what you think.

Another option would be to put error audio files on the SD card. Of course this doesn't work for SD card or file errors. Perhaps beeps could be used if the SD card can't be read (ie 1 beep means low battery, 2 beeps means no SD card, 3 beeps means file not found, 4 beeps means bad blade). Or maybe just use beeps and no voice messages. Again, your thoughts?

Almost forgot to reply to this...
Let le's do some Math (tm).

We have 256kB of ROM. For error messages, phone quality would be sufficient, which is 8-bit 8kHz audio, or 8 kb / s,  256 / 8 = 32 seconds of audio.
I'd feel silly if I didn't apply some sort of compression to that though. A simple linear-predictive-encoding can double the amount of audio with relatively little loss in quality, which means 64 seconds of audio, or 4kb / s.
We probably only need 10 seconds of audio though, which would take up ~40kb.  40kb is not that much, but I can pretty much guarantee that it'll be the first thing to go if we start running low on space.

Another alternative would be to simply generate new error messages using the current speech synthesizer. The original talkie script comes with a matlab script that is supposed to be able to generate talkie data. Maybe it's possible to tweak that a little to make it generate higher quality. (Like, maybe by upping the sampling rate to 11kHz)

I found a program that can make LPC codes from WAV files, so I think I'm just going to record my own error messages, as the current voice data makes it hard to do good error messages. (I started out trying to make an error message for "font directory name too long", but it's pretty much impossible to express that with the words available.)

I don't suppose someone has talk-like-darth-vader filter or something that I could use? :)
I've been working on this too. I used some text-to-speech websites to generate the voice messages. Male voices seemed to work best. Then I tried some matlab (or freemat or Octave) scripts, but none of them produced very good talkie voice quality. From forum posts, most agreed Blue Wizard (https://github.com/patrick99e99/BlueWizard) produced the best voice quality (and allows tweaking of frames), but it's for MacOS only (Objective C). ptwz made a python script (https://github.com/ptwz/python_wizard) from the Blue Wizard source, and it works pretty well, but I still get a fair amount of squealing and scratchiness in the talkie output. I spent some trying to make a serial command that would allow me to paste talkie byte code into Serial Monitor and have the saber play it (so I don't have to keep compiling and uploading new firmware for each test), but I couldn't figure it out and gave up. I'm going to play with it a bit more, but I'm running out of ideas and hitting up against the wall of my limited coding skills. I can send you the WAV files I have if that would be helpful, but that's not the hard part. Let me know if I can help in some way.
Title: Re: Error notifications
Post by: profezzorn on February 15, 2018, 04:22:41 PM
profezzorn, I've been thinking and playing around a bit with error notifications.

Currently there are 3-4 errors that have talkie voice notifications. While it's cool to have voice messages with a pretty low memory footprint, they don't sound very good (and are often hard to make out) and the message itself is not exactly what the error is (ie Bank Open means a file was not found).

I wondered about putting recorded audio messages in program memory.  Paul Stoffgren (Mr. Teensy) has done some work on this. Paul estimated that you could put 20 seconds of audio in program memory of a Teensy 3.2. I made 4 error messages using a test-to-speech website and came up with 4 seconds of total audio, so that would take 1/5 of program memory. Is this a direction you think is worth pursuing? The plus side is the audio error messages would sound better and be exactly what you want, but is it worth 1/5 of the program space? Let me know what you think.

Another option would be to put error audio files on the SD card. Of course this doesn't work for SD card or file errors. Perhaps beeps could be used if the SD card can't be read (ie 1 beep means low battery, 2 beeps means no SD card, 3 beeps means file not found, 4 beeps means bad blade). Or maybe just use beeps and no voice messages. Again, your thoughts?

Almost forgot to reply to this...
Let le's do some Math (tm).

We have 256kB of ROM. For error messages, phone quality would be sufficient, which is 8-bit 8kHz audio, or 8 kb / s,  256 / 8 = 32 seconds of audio.
I'd feel silly if I didn't apply some sort of compression to that though. A simple linear-predictive-encoding can double the amount of audio with relatively little loss in quality, which means 64 seconds of audio, or 4kb / s.
We probably only need 10 seconds of audio though, which would take up ~40kb.  40kb is not that much, but I can pretty much guarantee that it'll be the first thing to go if we start running low on space.

Another alternative would be to simply generate new error messages using the current speech synthesizer. The original talkie script comes with a matlab script that is supposed to be able to generate talkie data. Maybe it's possible to tweak that a little to make it generate higher quality. (Like, maybe by upping the sampling rate to 11kHz)

I found a program that can make LPC codes from WAV files, so I think I'm just going to record my own error messages, as the current voice data makes it hard to do good error messages. (I started out trying to make an error message for "font directory name too long", but it's pretty much impossible to express that with the words available.)

I don't suppose someone has talk-like-darth-vader filter or something that I could use? :)
I've been working on this too. I used some text-to-speech websites to generate the voice messages. Male voices seemed to work best. Then I tried some matlab (or freemat or Octave) scripts, but none of them produced very good talkie voice quality. From forum posts, most agreed Blue Wizard (https://github.com/patrick99e99/BlueWizard) produced the best voice quality (and allows tweaking of frames), but it's for MacOS only (Objective C). ptwz made a python script (https://github.com/ptwz/python_wizard) from the Blue Wizard source, and it works pretty well, but I still get a fair amount of squealing and scratchiness in the talkie output. I spent some trying to make a serial command that would allow me to paste talkie byte code into Serial Monitor and have the saber play it (so I don't have to keep compiling and uploading new firmware for each test), but I couldn't figure it out and gave up. I'm going to play with it a bit more, but I'm running out of ideas and hitting up against the wall of my limited coding skills. I can send you the WAV files I have if that would be helpful, but that's not the hard part. Let me know if I can help in some way.

Nice! I had not seen the python script before.
I have a mac, so i can test if BlueWWizard works better than the python script or not.
It's possible that the scratchiness comes from my talkie implementation, as there seems to be a lot of disagreement on what some of the coefficents should be.
My implementation uses some that I found on a forum somewhere, but I don't know if they are actually accurate, or what the python script expects.
Title: Re: Error notifications
Post by: KanyonKris on February 15, 2018, 05:04:50 PM
Nice! I had not seen the python script before.
I have a mac, so i can test if BlueWWizard works better than the python script or not.
It's possible that the scratchiness comes from my talkie implementation, as there seems to be a lot of disagreement on what some of the coefficents should be.
My implementation uses some that I found on a forum somewhere, but I don't know if they are actually accurate, or what the python script expects.
Did you start with the Talkie code adapted to the Teensy (https://github.com/PaulStoffregen/Talkie)? I'm guessing so because there are a lot of similarities. If not you might want to look over the Teensy code. It was discussed here - Talkie speech library (https://forum.pjrc.com/threads/33446-Talkie-speech-library)
Title: Re: Error notifications
Post by: profezzorn on February 15, 2018, 05:15:54 PM
Nice! I had not seen the python script before.
I have a mac, so i can test if BlueWWizard works better than the python script or not.
It's possible that the scratchiness comes from my talkie implementation, as there seems to be a lot of disagreement on what some of the coefficents should be.
My implementation uses some that I found on a forum somewhere, but I don't know if they are actually accurate, or what the python script expects.
Did you start with the Talkie code adapted to the Teensy (https://github.com/PaulStoffregen/Talkie)? I'm guessing so because there are a lot of similarities. If not you might want to look over the Teensy code. It was discussed here - Talkie speech library (https://forum.pjrc.com/threads/33446-Talkie-speech-library)

No I worked from the regular talkie library.
Btw, I think I figured out how to sound like vader, but I don't know if the effect will survive LPC coding. :)

Title: Re: Error notifications
Post by: KanyonKris on February 15, 2018, 06:05:30 PM
No I worked from the regular talkie library.
Btw, I think I figured out how to sound like vader, but I don't know if the effect will survive LPC coding. :)
Hehe, Vader voice would be cool.

In case it's useful, here are some talkie phrases I made using the python script:

Code: [Select]
const uint8_t spBADBLADETOM[] PROGMEM = {0x00,0x00,0x00,0x20,0xEA,0xEE,0xD5,0xDD,0xA3,0x4E,0xC9,0x8B,0xD1,0xA8,0xE8,0xD2,0x23,0x2F,0x4E,0xB3,0x72,0x42,0x8F,0xAC,0x78,0xAB,0xCA,0xB1,0xBC,0xD2,0xE2,0xAC,0xB2,0x3A,0xCA,0x48,0xB2,0xF3,0xCA,0x6A,0x2B,0x23,0x4E,0x3E,0x2A,0x6B,0xAC,0x8C,0x24,0x6B,0xCF,0xCA,0x31,0x13,0x92,0xA2,0x34,0x32,0x2A,0x32,0xC9,0xAD,0x8A,0x48,0x0B,0x61,0x28,0x27,0x21,0x33,0xD4,0xA8,0xA1,0x02,0xD9,0xC9,0x30,0x13,0x0D,0x20,0xF2,0x4E,0x2D,0x43,0x35,0x91,0x29,0x0B,0xAA,0x0D,0xE4,0x4D,0xAE,0xCC,0xB8,0x27,0x48,0x5E,0xA5,0xB2,0x92,0x69,0x15,0x7F,0xD8,0xCA,0x46,0x32,0x53,0x63,0x56,0x2B,0x3B,0x73,0xCF,0xC8,0x59,0xAD,0x1A,0x5C,0x2D,0x2B,0x2B,0x95,0x66,0x4A,0x95,0xE8,0x2A,0x95,0xBA,0x29,0x55,0x62,0xAA,0x74,0xE0,0x87,0x14,0xAE,0xAD,0xD2,0x6E,0x1B,0x42,0xB8,0x2E,0x43,0x9B,0xA3,0x4B,0xA6,0xBE,0x0C,0xAD,0xAE,0xAE,0x51,0x66,0xD3,0x88,0x50,0xAA,0x20,0xDB,0x4B,0xC3,0xAC,0xA8,0x82,0x72,0xBB,0xC4,0x22,0xAE,0x52,0xB5,0x4A,0x93,0x23,0x80,0xC5,0xCD,0x11,0xDB,0xB8,0x78,0x46,0x18,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x07};
const uint8_t spBADBLADEJAMES[] PROGMEM = {0x00,0x00,0x00,0x68,0x04,0xB9,0x3C,0x2B,0x63,0xA0,0x09,0xB4,0xF2,0xCC,0x88,0xA0,0xE8,0xA8,0x5C,0xC3,0x33,0xD2,0xA8,0x8B,0x75,0x4B,0xAB,0xC9,0xA3,0xAE,0x41,0xDD,0x62,0xAA,0x8C,0xA2,0x5A,0xF3,0xCC,0x2E,0xBD,0xF2,0xA6,0xC2,0xB2,0x72,0xF4,0xCA,0x9A,0x0E,0xCB,0xCC,0xC9,0x2B,0x6B,0xC6,0x3C,0x23,0x27,0xAF,0xAC,0x19,0x8B,0xF4,0x9C,0x3C,0xF2,0xAA,0xDC,0xC2,0x6B,0x74,0xCA,0x8B,0x36,0x75,0xEF,0xD1,0x0C,0x63,0xBA,0xB2,0xC3,0x23,0xA3,0x0E,0xEC,0xF4,0xF0,0x90,0x82,0x06,0x90,0xA6,0x5C,0x23,0x91,0x69,0x83,0xA8,0x56,0xD6,0xD6,0xAE,0x4B,0x38,0x37,0x58,0x16,0xBB,0xCE,0xF3,0x1D,0xE1,0xB8,0x5D,0xBA,0x42,0xBB,0x8D,0xFC,0x61,0x1B,0x0A,0xAF,0x4A,0x8D,0x59,0x6D,0x2A,0xC6,0xC3,0x6C,0x26,0x96,0xA5,0x78,0xD5,0xA8,0xAE,0x55,0xB6,0x1A,0x45,0x2C,0x73,0x56,0xE2,0x9A,0x67,0x89,0xAA,0xD9,0x81,0x6F,0x91,0x34,0x3B,0x67,0xBB,0xA7,0x5A,0xD2,0x9A,0x9C,0x24,0xBE,0xEA,0xD0,0xA6,0xBA,0x34,0xFB,0xAB,0x26,0x9E,0x8E,0x42,0xE8,0x8F,0x34,0xAC,0x57,0x0B,0x81,0x02,0xA6,0x4C,0x11,0x42,0x33,0x2A,0x11,0x59,0x85,0x3D,0x3D,0xB8,0xB8,0x67,0x19,0xC4,0xF7,0xD8,0x22,0xE6,0x53,0x00,0x00,0x00,0x00,0xE0,0x01};
const uint8_t spLOWBATTERYTOM[] PROGMEM = {0x00,0x00,0x00,0x00,0x40,0xEA,0x0C,0xFC,0x88,0x23,0xB1,0x68,0x32,0xF0,0x33,0xF2,0xC6,0xAE,0xAE,0xC0,0x26,0x59,0x1B,0xB7,0xB2,0x91,0x98,0x24,0xFD,0xD8,0x8A,0x4E,0x63,0x82,0xE5,0x57,0xCB,0x0A,0xAF,0x31,0xF6,0x8F,0x85,0x4E,0xA2,0x47,0xD9,0x5F,0x86,0x22,0xB8,0x69,0xB4,0xBA,0xE4,0x4A,0x6F,0x7A,0x85,0xFD,0xB6,0xA8,0x9C,0xE9,0x15,0xB2,0x59,0xA8,0xE6,0xA6,0x2B,0x54,0x9C,0xA4,0xA6,0x49,0xB3,0x28,0x9F,0xD5,0x9A,0x26,0xDD,0x2B,0xBD,0xD2,0x68,0x9A,0xF2,0xE8,0xCC,0xCA,0xAD,0x6E,0xC6,0xB2,0x3C,0x23,0xB7,0x32,0xBB,0xA8,0xF0,0xAA,0x9C,0xCA,0x6C,0x7D,0x42,0xCB,0xB6,0x2B,0x52,0x91,0xF0,0x72,0x57,0xE1,0x89,0x99,0x3D,0x56,0x5A,0x05,0x2E,0x64,0xB1,0x7C,0xCB,0xE4,0xF8,0x10,0xC5,0xF3,0x2C,0x93,0x5B,0x93,0x13,0x8F,0xB3,0x56,0x6E,0x2F,0x86,0xCD,0x2E,0x1A,0xBA,0xA3,0x2B,0x56,0xDF,0xAA,0x69,0xEE,0x21,0x59,0xE3,0xAA,0xA2,0x82,0x86,0x61,0xB6,0xAB,0xC2,0xE2,0xED,0x9C,0xAC,0x3E,0x4D,0x0B,0x68,0x58,0x94,0xD8,0x2A,0xC5,0xFE,0x69,0x88,0xF3,0x2A,0x34,0x02,0xA6,0x21,0x02,0x00,0x00,0x00,0x80,0x07};
const uint8_t spLOWBATTERYJAMES[] PROGMEM = {0x00,0x00,0x00,0x28,0xCE,0xC8,0x2B,0x44,0x1D,0xAB,0x35,0xD0,0x1E,0x96,0x5C,0x65,0x46,0x23,0xA6,0x95,0x72,0x81,0x1B,0x3D,0xED,0x76,0x8C,0x45,0x65,0x48,0xA2,0xDA,0x29,0x56,0xB5,0x21,0x4B,0x9F,0x24,0xEF,0xDC,0xFA,0x2C,0x6D,0x55,0xBC,0x57,0xEB,0x92,0xB4,0x35,0xB1,0xDE,0xA5,0x8D,0x32,0xC6,0xC9,0xFA,0x96,0xD6,0xAB,0xEE,0x20,0xED,0x1A,0x5A,0x6D,0x2F,0x8D,0x6D,0x35,0x1B,0xA0,0xBB,0x50,0xF5,0x3A,0x64,0x00,0x39,0xBC,0xCC,0x1A,0x87,0x2C,0xE9,0xF4,0x50,0x9F,0xBC,0xEA,0xA2,0x23,0xC2,0x72,0xF2,0x6A,0xAB,0xCA,0x88,0xC8,0xC9,0xAB,0x2B,0x3A,0x23,0x22,0x47,0xAF,0xBE,0x9A,0x88,0xF0,0x1C,0x3D,0x86,0x6C,0x33,0x22,0x6B,0x4C,0xA1,0xB3,0x89,0x0C,0xCF,0xC9,0x69,0xAE,0x5E,0x42,0xC2,0x93,0x04,0x3E,0x36,0xCA,0x2C,0x4B,0x62,0xB6,0x30,0xA1,0x26,0x78,0xA5,0x38,0xFC,0xC4,0x1C,0x93,0xD6,0xE2,0xB2,0x83,0x6C,0x43,0x56,0x39,0x29,0x7A,0xA3,0x2E,0xD9,0xE8,0xFE,0xEA,0x14,0xAB,0x7D,0x95,0x81,0x7A,0x64,0xA8,0xCE,0x85,0x0A,0x6A,0x0E,0xB9,0xA7,0x2B,0x0A,0xA8,0x4A,0xB2,0x9D,0xB4,0x44,0xA0,0x6E,0x51,0x7A,0x3A,0x12,0x31,0x7A,0x40,0xCD,0x76,0x33,0xC8,0xE9,0x09,0x25,0x2B,0xC4,0x00,0x00,0x00,0x00,0x3C};
const uint8_t spSDCARDERRORTOM[] PROGMEM = {0x00,0xAE,0x29,0x46,0x63,0x2A,0x83,0x94,0x22,0x1B,0xAB,0xAE,0x32,0xD2,0xB2,0xE8,0xBD,0xAB,0x43,0x4A,0x4B,0x93,0xF5,0x8E,0x4E,0x31,0x29,0x2D,0xCA,0x3C,0xB2,0x44,0x3B,0xE0,0x6A,0x55,0x07,0xBC,0x58,0xEE,0x80,0x5F,0x3B,0x0C,0xF0,0x5B,0x07,0x01,0x7E,0xEB,0x60,0xC0,0x32,0x19,0x01,0x98,0x5A,0xA5,0x00,0xD3,0x30,0x35,0x60,0x05,0xA6,0x04,0xCC,0x48,0x68,0xDA,0x59,0x10,0x7D,0x66,0x10,0x9A,0xBA,0x44,0x8A,0xCD,0x2A,0x4A,0x69,0xB1,0x8B,0xDD,0xEA,0x04,0xBA,0xEA,0x0A,0x9C,0x98,0xEB,0x82,0x62,0x2B,0x25,0x35,0x4E,0x8B,0x63,0xCE,0xD2,0xD2,0xCC,0x23,0x89,0x29,0xD3,0xD3,0xB2,0x8E,0x2C,0xC5,0x72,0x0F,0x4F,0x5B,0xF2,0xD4,0x24,0x7C,0x25,0x73,0x2A,0x52,0xE2,0xF0,0xD5,0xCC,0xA6,0xCC,0x56,0x55,0x33,0xE2,0xB4,0x62,0x38,0x51,0x8D,0x5A,0x34,0x8A,0x61,0x55,0xB5,0x6A,0xD5,0x28,0x8A,0x36,0x8B,0xAE,0xD6,0xAD,0xC8,0x41,0xCD,0x36,0x3D,0xA5,0x2A,0x55,0x89,0x18,0x69,0xE9,0x9A,0x38,0xD8,0xA3,0xB8,0x95,0x6B,0xE3,0x62,0xCF,0xE6,0x4E,0x86,0x09,0x93,0x32,0x5B,0x3A,0x19,0x3A,0x4C,0xCA,0x6C,0xE9,0x64,0x8E,0x38,0x29,0xAB,0xB4,0x93,0x3A,0xE3,0xC4,0xEE,0xB4,0x96,0xE2,0x0E,0x83,0xA6,0xDD,0x5B,0x89,0x27,0x0C,0x9A,0xB1,0xA8,0xC5,0xDE,0xD0,0x39,0xBB,0xD5,0x15,0xF9,0x42,0x95,0xEC,0x12,0x57,0xC4,0xCE,0x45,0xBC,0xD2,0x6C,0x21,0xA7,0x84,0xD0,0x4A,0x93,0x04,0x00,0x00,0x00,0xF0};
const uint8_t spSDCARDERRORJAMES[] PROGMEM = {0x00,0x50,0xBA,0xEA,0xC5,0x23,0xA6,0xCC,0xCA,0x9A,0x37,0x0B,0xEF,0x29,0x2B,0x69,0xCE,0x35,0xAC,0x26,0x9F,0xA0,0xD9,0xD0,0xF0,0x9A,0xBD,0x82,0x66,0x52,0xDC,0x6A,0x72,0x0A,0x0A,0x4B,0xC9,0xC8,0x52,0x09,0x78,0x36,0x22,0x01,0x3F,0x56,0x26,0xE0,0xA6,0x76,0x07,0xBC,0x50,0x8E,0x80,0x17,0x23,0x05,0xB0,0x74,0x45,0x02,0x96,0x72,0x69,0xC0,0xD4,0x46,0x0D,0x58,0xD6,0xB1,0x94,0xC3,0x30,0xEA,0xE6,0xE4,0x52,0x76,0xC5,0xE8,0x57,0x93,0x42,0xD5,0x2D,0x83,0x5D,0x4E,0x24,0x5D,0x61,0xCC,0x75,0x1E,0x49,0x40,0x3D,0xAC,0x89,0x98,0xE3,0x22,0xB6,0x34,0x6A,0x1E,0x91,0x9D,0xD0,0x62,0xAB,0x99,0x27,0x31,0x5C,0x33,0xA3,0xE6,0x11,0x39,0x14,0x31,0xB4,0xA8,0x5B,0xAD,0x56,0xA4,0xB8,0xA6,0x25,0x0B,0x4B,0x19,0xEB,0xA8,0x97,0x2C,0x2A,0x75,0x6A,0x2D,0x51,0xB4,0xAA,0xB4,0xA9,0x3B,0x77,0x51,0xA7,0xD4,0xE5,0xCA,0x3C,0x2D,0x9D,0x5C,0x9F,0x3C,0xD3,0xA6,0xD7,0x75,0x5C,0xB5,0xAC,0x19,0x53,0xCB,0xF0,0xD5,0x8B,0x64,0xF6,0xA2,0x32,0x34,0xAF,0x94,0x95,0xB3,0x5A,0xDB,0xBC,0x48,0x74,0xD4,0x6C,0x6D,0x4D,0xC6,0x3A,0xB6,0xAA,0xF5,0x25,0x19,0xDB,0x68,0xEB,0x34,0xE4,0xA2,0x9C,0xC3,0x9D,0xDC,0x14,0x9B,0x70,0x0D,0x77,0x52,0x73,0x98,0xE8,0x9B,0xD4,0x51,0xAD,0x71,0xA0,0xEE,0x50,0x67,0xB3,0xC5,0x46,0xB2,0x4B,0xB9,0x0C,0x17,0x9B,0x70,0x2F,0xE7,0x32,0x77,0xEC,0xCC,0xB3,0xDC,0xC9,0x7C,0x69,0x13,0xCF,0x70,0x67,0x21,0xE4,0x0B,0x3E,0xC1,0xAB,0xC9,0x9A,0x37,0x53,0x74,0x24,0x03,0x00,0x00,0x78};
const uint8_t spFILENOTFOUNDTOM[] PROGMEM = {0x00,0x40,0x80,0x99,0x3B,0x85,0x35,0xFA,0x76,0xB8,0xA7,0x16,0xC0,0x0A,0xAE,0x0A,0x58,0xC1,0xDC,0x00,0x3B,0x67,0xB8,0x24,0xBA,0x69,0x13,0xAD,0xDD,0xD2,0x98,0xB6,0x54,0x7D,0xF6,0x48,0x93,0xDB,0x76,0xF5,0xC5,0x2B,0x29,0xAE,0x2B,0x34,0x16,0xAF,0xA4,0x5A,0xB3,0xCA,0xA8,0x3A,0xE2,0xE6,0x54,0xB2,0x73,0x52,0x8B,0xAB,0x53,0xAD,0xA8,0x5A,0x2D,0x2E,0x22,0x2B,0x24,0x6A,0xA7,0x24,0xF3,0x1A,0xC3,0x58,0x1C,0x92,0x4C,0x7A,0x0C,0xF5,0x55,0x4A,0x3B,0x8A,0x75,0x90,0x55,0x26,0x6B,0xC0,0x26,0x99,0xDB,0xA8,0x3C,0x11,0xCB,0x52,0x8F,0x9B,0xCA,0x2A,0x35,0xC5,0xAA,0x56,0x29,0x9B,0x8C,0x12,0xCD,0xD9,0xA5,0xAA,0x3A,0x5B,0x39,0x66,0x97,0xB2,0xEA,0x6C,0x65,0xAB,0xD2,0xCA,0xA6,0xAD,0x55,0xBD,0x4A,0x28,0x9B,0xD6,0x56,0xB7,0x32,0xC4,0xA9,0x5A,0x8B,0x2D,0x63,0x29,0x60,0x05,0x37,0x07,0xAC,0x34,0x65,0x80,0x55,0xBA,0x14,0x30,0x83,0xBB,0x89,0x93,0xEE,0x56,0xD3,0xB8,0xA5,0xC8,0x66,0x9B,0xCD,0x67,0xB5,0x32,0xDB,0x6B,0xB6,0x98,0x5D,0xCA,0xEC,0x2E,0xC9,0xB3,0x76,0xA9,0x8A,0xE9,0x10,0xCB,0x28,0x89,0x29,0xA6,0x82,0x22,0xA2,0x84,0x39,0xBB,0x49,0x0C,0xAB,0x63,0xB6,0x98,0x3A,0x28,0xBC,0xB1,0x3A,0x43,0xAE,0x20,0xCF,0xC4,0xEA,0x0A,0x29,0x9C,0xD3,0x63,0xB3,0xC7,0xA9,0x28,0x49,0x4F,0x88,0x5E,0xAD,0x62,0x2C,0x5C,0x16,0xF9,0x22,0xE3,0xCC,0x4A,0xDB,0x06,0x98,0xCE,0x5C,0xBC,0xC3,0xA9,0xB1,0xC5,0x44,0xF4,0x76,0xE3,0x46,0xE6,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0xE0,0x01};

Title: Dual LED Neopixel color not changing
Post by: canteen234 on February 23, 2018, 11:56:34 PM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.
Title: Re: Dual LED Neopixel color not changing
Post by: profezzorn on February 24, 2018, 10:17:43 AM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.

What kind of neopixel strips do you have? Where did you get them?
Do they turn on/off and extend properly?  Is it only one that doesn't work, or is it both of them?
Title: Re: Dual LED Neopixel color not changing
Post by: canteen234 on February 24, 2018, 12:02:07 PM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.

What kind of neopixel strips do you have? Where did you get them?
Do they turn on/off and extend properly?  Is it only one that doesn't work, or is it both of them?

I got them off Banggood
WS2812B 5050 RGB LED Changeable Strip 1M 144 Leds Non-waterproof Individual (https://www.banggood.com/WS2812B-5050-RGB-LED-Changeable-Strip-1M-144-Leds-Non-waterproof-Individual-Addressable-5V-p-1016394.html?rmmds=cart_middle_products&cur_warehouse=CN)
They turn on and off, but I am unable to get them to extend and it is for the both of them.
Title: Re: Dual LED Neopixel color not changing
Post by: profezzorn on February 24, 2018, 02:00:11 PM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.

What kind of neopixel strips do you have? Where did you get them?
Do they turn on/off and extend properly?  Is it only one that doesn't work, or is it both of them?

I got them off Banggood
WS2812B 5050 RGB LED Changeable Strip 1M 144 Leds Non-waterproof Individual (https://www.banggood.com/WS2812B-5050-RGB-LED-Changeable-Strip-1M-144-Leds-Non-waterproof-Individual-Addressable-5V-p-1016394.html?rmmds=cart_middle_products&cur_warehouse=CN)
They turn on and off, but I am unable to get them to extend and it is for the both of them.

Weird, it sounds like they default to white when powered, which is unusual.
The page says it's WS2812 chips, but the pictures seems to match SK6821s better.
Anyway, it kind of sound like you have a problem with the data line. Either the resistors are too big, or the chips don't like the signal generated by the teensy.
Before you try anything else, try chaning the WS2811_ACTUALLYY_800kHz to one of:

   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz

and see if any of those work better.

What size resistor do you have on the data line?
Title: Re: Error notifications
Post by: profezzorn on February 24, 2018, 04:35:40 PM
No I worked from the regular talkie library.
Btw, I think I figured out how to sound like vader, but I don't know if the effect will survive LPC coding. :)
Hehe, Vader voice would be cool.

In case it's useful, here are some talkie phrases I made using the python script:

Code: [Select]
const uint8_t spBADBLADETOM[] PROGMEM = {0x00,0x00,0x00,0x20,0xEA,0xEE,0xD5,0xDD,0xA3,0x4E,0xC9,0x8B,0xD1,0xA8,0xE8,0xD2,0x23,0x2F,0x4E,0xB3,0x72,0x42,0x8F,0xAC,0x78,0xAB,0xCA,0xB1,0xBC,0xD2,0xE2,0xAC,0xB2,0x3A,0xCA,0x48,0xB2,0xF3,0xCA,0x6A,0x2B,0x23,0x4E,0x3E,0x2A,0x6B,0xAC,0x8C,0x24,0x6B,0xCF,0xCA,0x31,0x13,0x92,0xA2,0x34,0x32,0x2A,0x32,0xC9,0xAD,0x8A,0x48,0x0B,0x61,0x28,0x27,0x21,0x33,0xD4,0xA8,0xA1,0x02,0xD9,0xC9,0x30,0x13,0x0D,0x20,0xF2,0x4E,0x2D,0x43,0x35,0x91,0x29,0x0B,0xAA,0x0D,0xE4,0x4D,0xAE,0xCC,0xB8,0x27,0x48,0x5E,0xA5,0xB2,0x92,0x69,0x15,0x7F,0xD8,0xCA,0x46,0x32,0x53,0x63,0x56,0x2B,0x3B,0x73,0xCF,0xC8,0x59,0xAD,0x1A,0x5C,0x2D,0x2B,0x2B,0x95,0x66,0x4A,0x95,0xE8,0x2A,0x95,0xBA,0x29,0x55,0x62,0xAA,0x74,0xE0,0x87,0x14,0xAE,0xAD,0xD2,0x6E,0x1B,0x42,0xB8,0x2E,0x43,0x9B,0xA3,0x4B,0xA6,0xBE,0x0C,0xAD,0xAE,0xAE,0x51,0x66,0xD3,0x88,0x50,0xAA,0x20,0xDB,0x4B,0xC3,0xAC,0xA8,0x82,0x72,0xBB,0xC4,0x22,0xAE,0x52,0xB5,0x4A,0x93,0x23,0x80,0xC5,0xCD,0x11,0xDB,0xB8,0x78,0x46,0x18,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x07};
const uint8_t spBADBLADEJAMES[] PROGMEM = {0x00,0x00,0x00,0x68,0x04,0xB9,0x3C,0x2B,0x63,0xA0,0x09,0xB4,0xF2,0xCC,0x88,0xA0,0xE8,0xA8,0x5C,0xC3,0x33,0xD2,0xA8,0x8B,0x75,0x4B,0xAB,0xC9,0xA3,0xAE,0x41,0xDD,0x62,0xAA,0x8C,0xA2,0x5A,0xF3,0xCC,0x2E,0xBD,0xF2,0xA6,0xC2,0xB2,0x72,0xF4,0xCA,0x9A,0x0E,0xCB,0xCC,0xC9,0x2B,0x6B,0xC6,0x3C,0x23,0x27,0xAF,0xAC,0x19,0x8B,0xF4,0x9C,0x3C,0xF2,0xAA,0xDC,0xC2,0x6B,0x74,0xCA,0x8B,0x36,0x75,0xEF,0xD1,0x0C,0x63,0xBA,0xB2,0xC3,0x23,0xA3,0x0E,0xEC,0xF4,0xF0,0x90,0x82,0x06,0x90,0xA6,0x5C,0x23,0x91,0x69,0x83,0xA8,0x56,0xD6,0xD6,0xAE,0x4B,0x38,0x37,0x58,0x16,0xBB,0xCE,0xF3,0x1D,0xE1,0xB8,0x5D,0xBA,0x42,0xBB,0x8D,0xFC,0x61,0x1B,0x0A,0xAF,0x4A,0x8D,0x59,0x6D,0x2A,0xC6,0xC3,0x6C,0x26,0x96,0xA5,0x78,0xD5,0xA8,0xAE,0x55,0xB6,0x1A,0x45,0x2C,0x73,0x56,0xE2,0x9A,0x67,0x89,0xAA,0xD9,0x81,0x6F,0x91,0x34,0x3B,0x67,0xBB,0xA7,0x5A,0xD2,0x9A,0x9C,0x24,0xBE,0xEA,0xD0,0xA6,0xBA,0x34,0xFB,0xAB,0x26,0x9E,0x8E,0x42,0xE8,0x8F,0x34,0xAC,0x57,0x0B,0x81,0x02,0xA6,0x4C,0x11,0x42,0x33,0x2A,0x11,0x59,0x85,0x3D,0x3D,0xB8,0xB8,0x67,0x19,0xC4,0xF7,0xD8,0x22,0xE6,0x53,0x00,0x00,0x00,0x00,0xE0,0x01};
const uint8_t spLOWBATTERYTOM[] PROGMEM = {0x00,0x00,0x00,0x00,0x40,0xEA,0x0C,0xFC,0x88,0x23,0xB1,0x68,0x32,0xF0,0x33,0xF2,0xC6,0xAE,0xAE,0xC0,0x26,0x59,0x1B,0xB7,0xB2,0x91,0x98,0x24,0xFD,0xD8,0x8A,0x4E,0x63,0x82,0xE5,0x57,0xCB,0x0A,0xAF,0x31,0xF6,0x8F,0x85,0x4E,0xA2,0x47,0xD9,0x5F,0x86,0x22,0xB8,0x69,0xB4,0xBA,0xE4,0x4A,0x6F,0x7A,0x85,0xFD,0xB6,0xA8,0x9C,0xE9,0x15,0xB2,0x59,0xA8,0xE6,0xA6,0x2B,0x54,0x9C,0xA4,0xA6,0x49,0xB3,0x28,0x9F,0xD5,0x9A,0x26,0xDD,0x2B,0xBD,0xD2,0x68,0x9A,0xF2,0xE8,0xCC,0xCA,0xAD,0x6E,0xC6,0xB2,0x3C,0x23,0xB7,0x32,0xBB,0xA8,0xF0,0xAA,0x9C,0xCA,0x6C,0x7D,0x42,0xCB,0xB6,0x2B,0x52,0x91,0xF0,0x72,0x57,0xE1,0x89,0x99,0x3D,0x56,0x5A,0x05,0x2E,0x64,0xB1,0x7C,0xCB,0xE4,0xF8,0x10,0xC5,0xF3,0x2C,0x93,0x5B,0x93,0x13,0x8F,0xB3,0x56,0x6E,0x2F,0x86,0xCD,0x2E,0x1A,0xBA,0xA3,0x2B,0x56,0xDF,0xAA,0x69,0xEE,0x21,0x59,0xE3,0xAA,0xA2,0x82,0x86,0x61,0xB6,0xAB,0xC2,0xE2,0xED,0x9C,0xAC,0x3E,0x4D,0x0B,0x68,0x58,0x94,0xD8,0x2A,0xC5,0xFE,0x69,0x88,0xF3,0x2A,0x34,0x02,0xA6,0x21,0x02,0x00,0x00,0x00,0x80,0x07};
const uint8_t spLOWBATTERYJAMES[] PROGMEM = {0x00,0x00,0x00,0x28,0xCE,0xC8,0x2B,0x44,0x1D,0xAB,0x35,0xD0,0x1E,0x96,0x5C,0x65,0x46,0x23,0xA6,0x95,0x72,0x81,0x1B,0x3D,0xED,0x76,0x8C,0x45,0x65,0x48,0xA2,0xDA,0x29,0x56,0xB5,0x21,0x4B,0x9F,0x24,0xEF,0xDC,0xFA,0x2C,0x6D,0x55,0xBC,0x57,0xEB,0x92,0xB4,0x35,0xB1,0xDE,0xA5,0x8D,0x32,0xC6,0xC9,0xFA,0x96,0xD6,0xAB,0xEE,0x20,0xED,0x1A,0x5A,0x6D,0x2F,0x8D,0x6D,0x35,0x1B,0xA0,0xBB,0x50,0xF5,0x3A,0x64,0x00,0x39,0xBC,0xCC,0x1A,0x87,0x2C,0xE9,0xF4,0x50,0x9F,0xBC,0xEA,0xA2,0x23,0xC2,0x72,0xF2,0x6A,0xAB,0xCA,0x88,0xC8,0xC9,0xAB,0x2B,0x3A,0x23,0x22,0x47,0xAF,0xBE,0x9A,0x88,0xF0,0x1C,0x3D,0x86,0x6C,0x33,0x22,0x6B,0x4C,0xA1,0xB3,0x89,0x0C,0xCF,0xC9,0x69,0xAE,0x5E,0x42,0xC2,0x93,0x04,0x3E,0x36,0xCA,0x2C,0x4B,0x62,0xB6,0x30,0xA1,0x26,0x78,0xA5,0x38,0xFC,0xC4,0x1C,0x93,0xD6,0xE2,0xB2,0x83,0x6C,0x43,0x56,0x39,0x29,0x7A,0xA3,0x2E,0xD9,0xE8,0xFE,0xEA,0x14,0xAB,0x7D,0x95,0x81,0x7A,0x64,0xA8,0xCE,0x85,0x0A,0x6A,0x0E,0xB9,0xA7,0x2B,0x0A,0xA8,0x4A,0xB2,0x9D,0xB4,0x44,0xA0,0x6E,0x51,0x7A,0x3A,0x12,0x31,0x7A,0x40,0xCD,0x76,0x33,0xC8,0xE9,0x09,0x25,0x2B,0xC4,0x00,0x00,0x00,0x00,0x3C};
const uint8_t spSDCARDERRORTOM[] PROGMEM = {0x00,0xAE,0x29,0x46,0x63,0x2A,0x83,0x94,0x22,0x1B,0xAB,0xAE,0x32,0xD2,0xB2,0xE8,0xBD,0xAB,0x43,0x4A,0x4B,0x93,0xF5,0x8E,0x4E,0x31,0x29,0x2D,0xCA,0x3C,0xB2,0x44,0x3B,0xE0,0x6A,0x55,0x07,0xBC,0x58,0xEE,0x80,0x5F,0x3B,0x0C,0xF0,0x5B,0x07,0x01,0x7E,0xEB,0x60,0xC0,0x32,0x19,0x01,0x98,0x5A,0xA5,0x00,0xD3,0x30,0x35,0x60,0x05,0xA6,0x04,0xCC,0x48,0x68,0xDA,0x59,0x10,0x7D,0x66,0x10,0x9A,0xBA,0x44,0x8A,0xCD,0x2A,0x4A,0x69,0xB1,0x8B,0xDD,0xEA,0x04,0xBA,0xEA,0x0A,0x9C,0x98,0xEB,0x82,0x62,0x2B,0x25,0x35,0x4E,0x8B,0x63,0xCE,0xD2,0xD2,0xCC,0x23,0x89,0x29,0xD3,0xD3,0xB2,0x8E,0x2C,0xC5,0x72,0x0F,0x4F,0x5B,0xF2,0xD4,0x24,0x7C,0x25,0x73,0x2A,0x52,0xE2,0xF0,0xD5,0xCC,0xA6,0xCC,0x56,0x55,0x33,0xE2,0xB4,0x62,0x38,0x51,0x8D,0x5A,0x34,0x8A,0x61,0x55,0xB5,0x6A,0xD5,0x28,0x8A,0x36,0x8B,0xAE,0xD6,0xAD,0xC8,0x41,0xCD,0x36,0x3D,0xA5,0x2A,0x55,0x89,0x18,0x69,0xE9,0x9A,0x38,0xD8,0xA3,0xB8,0x95,0x6B,0xE3,0x62,0xCF,0xE6,0x4E,0x86,0x09,0x93,0x32,0x5B,0x3A,0x19,0x3A,0x4C,0xCA,0x6C,0xE9,0x64,0x8E,0x38,0x29,0xAB,0xB4,0x93,0x3A,0xE3,0xC4,0xEE,0xB4,0x96,0xE2,0x0E,0x83,0xA6,0xDD,0x5B,0x89,0x27,0x0C,0x9A,0xB1,0xA8,0xC5,0xDE,0xD0,0x39,0xBB,0xD5,0x15,0xF9,0x42,0x95,0xEC,0x12,0x57,0xC4,0xCE,0x45,0xBC,0xD2,0x6C,0x21,0xA7,0x84,0xD0,0x4A,0x93,0x04,0x00,0x00,0x00,0xF0};
const uint8_t spSDCARDERRORJAMES[] PROGMEM = {0x00,0x50,0xBA,0xEA,0xC5,0x23,0xA6,0xCC,0xCA,0x9A,0x37,0x0B,0xEF,0x29,0x2B,0x69,0xCE,0x35,0xAC,0x26,0x9F,0xA0,0xD9,0xD0,0xF0,0x9A,0xBD,0x82,0x66,0x52,0xDC,0x6A,0x72,0x0A,0x0A,0x4B,0xC9,0xC8,0x52,0x09,0x78,0x36,0x22,0x01,0x3F,0x56,0x26,0xE0,0xA6,0x76,0x07,0xBC,0x50,0x8E,0x80,0x17,0x23,0x05,0xB0,0x74,0x45,0x02,0x96,0x72,0x69,0xC0,0xD4,0x46,0x0D,0x58,0xD6,0xB1,0x94,0xC3,0x30,0xEA,0xE6,0xE4,0x52,0x76,0xC5,0xE8,0x57,0x93,0x42,0xD5,0x2D,0x83,0x5D,0x4E,0x24,0x5D,0x61,0xCC,0x75,0x1E,0x49,0x40,0x3D,0xAC,0x89,0x98,0xE3,0x22,0xB6,0x34,0x6A,0x1E,0x91,0x9D,0xD0,0x62,0xAB,0x99,0x27,0x31,0x5C,0x33,0xA3,0xE6,0x11,0x39,0x14,0x31,0xB4,0xA8,0x5B,0xAD,0x56,0xA4,0xB8,0xA6,0x25,0x0B,0x4B,0x19,0xEB,0xA8,0x97,0x2C,0x2A,0x75,0x6A,0x2D,0x51,0xB4,0xAA,0xB4,0xA9,0x3B,0x77,0x51,0xA7,0xD4,0xE5,0xCA,0x3C,0x2D,0x9D,0x5C,0x9F,0x3C,0xD3,0xA6,0xD7,0x75,0x5C,0xB5,0xAC,0x19,0x53,0xCB,0xF0,0xD5,0x8B,0x64,0xF6,0xA2,0x32,0x34,0xAF,0x94,0x95,0xB3,0x5A,0xDB,0xBC,0x48,0x74,0xD4,0x6C,0x6D,0x4D,0xC6,0x3A,0xB6,0xAA,0xF5,0x25,0x19,0xDB,0x68,0xEB,0x34,0xE4,0xA2,0x9C,0xC3,0x9D,0xDC,0x14,0x9B,0x70,0x0D,0x77,0x52,0x73,0x98,0xE8,0x9B,0xD4,0x51,0xAD,0x71,0xA0,0xEE,0x50,0x67,0xB3,0xC5,0x46,0xB2,0x4B,0xB9,0x0C,0x17,0x9B,0x70,0x2F,0xE7,0x32,0x77,0xEC,0xCC,0xB3,0xDC,0xC9,0x7C,0x69,0x13,0xCF,0x70,0x67,0x21,0xE4,0x0B,0x3E,0xC1,0xAB,0xC9,0x9A,0x37,0x53,0x74,0x24,0x03,0x00,0x00,0x78};
const uint8_t spFILENOTFOUNDTOM[] PROGMEM = {0x00,0x40,0x80,0x99,0x3B,0x85,0x35,0xFA,0x76,0xB8,0xA7,0x16,0xC0,0x0A,0xAE,0x0A,0x58,0xC1,0xDC,0x00,0x3B,0x67,0xB8,0x24,0xBA,0x69,0x13,0xAD,0xDD,0xD2,0x98,0xB6,0x54,0x7D,0xF6,0x48,0x93,0xDB,0x76,0xF5,0xC5,0x2B,0x29,0xAE,0x2B,0x34,0x16,0xAF,0xA4,0x5A,0xB3,0xCA,0xA8,0x3A,0xE2,0xE6,0x54,0xB2,0x73,0x52,0x8B,0xAB,0x53,0xAD,0xA8,0x5A,0x2D,0x2E,0x22,0x2B,0x24,0x6A,0xA7,0x24,0xF3,0x1A,0xC3,0x58,0x1C,0x92,0x4C,0x7A,0x0C,0xF5,0x55,0x4A,0x3B,0x8A,0x75,0x90,0x55,0x26,0x6B,0xC0,0x26,0x99,0xDB,0xA8,0x3C,0x11,0xCB,0x52,0x8F,0x9B,0xCA,0x2A,0x35,0xC5,0xAA,0x56,0x29,0x9B,0x8C,0x12,0xCD,0xD9,0xA5,0xAA,0x3A,0x5B,0x39,0x66,0x97,0xB2,0xEA,0x6C,0x65,0xAB,0xD2,0xCA,0xA6,0xAD,0x55,0xBD,0x4A,0x28,0x9B,0xD6,0x56,0xB7,0x32,0xC4,0xA9,0x5A,0x8B,0x2D,0x63,0x29,0x60,0x05,0x37,0x07,0xAC,0x34,0x65,0x80,0x55,0xBA,0x14,0x30,0x83,0xBB,0x89,0x93,0xEE,0x56,0xD3,0xB8,0xA5,0xC8,0x66,0x9B,0xCD,0x67,0xB5,0x32,0xDB,0x6B,0xB6,0x98,0x5D,0xCA,0xEC,0x2E,0xC9,0xB3,0x76,0xA9,0x8A,0xE9,0x10,0xCB,0x28,0x89,0x29,0xA6,0x82,0x22,0xA2,0x84,0x39,0xBB,0x49,0x0C,0xAB,0x63,0xB6,0x98,0x3A,0x28,0xBC,0xB1,0x3A,0x43,0xAE,0x20,0xCF,0xC4,0xEA,0x0A,0x29,0x9C,0xD3,0x63,0xB3,0xC7,0xA9,0x28,0x49,0x4F,0x88,0x5E,0xAD,0x62,0x2C,0x5C,0x16,0xF9,0x22,0xE3,0xCC,0x4A,0xDB,0x06,0x98,0xCE,0x5C,0xBC,0xC3,0xA9,0xB1,0xC5,0x44,0xF4,0x76,0xE3,0x46,0xE6,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0xE0,0x01};

These actually sound pretty good.
Are they generated with explicit stop code?

Title: Re: Dual LED Neopixel color not changing
Post by: canteen234 on February 24, 2018, 11:41:18 PM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.

What kind of neopixel strips do you have? Where did you get them?
Do they turn on/off and extend properly?  Is it only one that doesn't work, or is it both of them?

I got them off Banggood
WS2812B 5050 RGB LED Changeable Strip 1M 144 Leds Non-waterproof Individual (https://www.banggood.com/WS2812B-5050-RGB-LED-Changeable-Strip-1M-144-Leds-Non-waterproof-Individual-Addressable-5V-p-1016394.html?rmmds=cart_middle_products&cur_warehouse=CN)
They turn on and off, but I am unable to get them to extend and it is for the both of them.

Weird, it sounds like they default to white when powered, which is unusual.
The page says it's WS2812 chips, but the pictures seems to match SK6821s better.
Anyway, it kind of sound like you have a problem with the data line. Either the resistors are too big, or the chips don't like the signal generated by the teensy.
Before you try anything else, try chaning the WS2811_ACTUALLYY_800kHz to one of:

   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz

and see if any of those work better.

What size resistor do you have on the data line?
I was wondering about the resister. That might be the issue. The site says to calculate the resister with  (BatteryVoltage - LedVoltage) * LedAmps watts but wouldn't that lead to a negative value since the LEDs need 5V per the description of the seller and the battery voltage being 3.7V?
Title: Re: Dual LED Neopixel color not changing
Post by: profezzorn on February 25, 2018, 12:48:52 AM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.

What kind of neopixel strips do you have? Where did you get them?
Do they turn on/off and extend properly?  Is it only one that doesn't work, or is it both of them?

I got them off Banggood
WS2812B 5050 RGB LED Changeable Strip 1M 144 Leds Non-waterproof Individual (https://www.banggood.com/WS2812B-5050-RGB-LED-Changeable-Strip-1M-144-Leds-Non-waterproof-Individual-Addressable-5V-p-1016394.html?rmmds=cart_middle_products&cur_warehouse=CN)
They turn on and off, but I am unable to get them to extend and it is for the both of them.

Weird, it sounds like they default to white when powered, which is unusual.
The page says it's WS2812 chips, but the pictures seems to match SK6821s better.
Anyway, it kind of sound like you have a problem with the data line. Either the resistors are too big, or the chips don't like the signal generated by the teensy.
Before you try anything else, try chaning the WS2811_ACTUALLYY_800kHz to one of:

   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz

and see if any of those work better.

What size resistor do you have on the data line?
I was wondering about the resister. That might be the issue. The site says to calculate the resister with  (BatteryVoltage - LedVoltage) * LedAmps watts but wouldn't that lead to a negative value since the LEDs need 5V per the description of the seller and the battery voltage being 3.7V?

The resistor calculations are only for plain LEDs, not for neopixels.
For neopixels, positive and negative goes directly to power, and the data line should have a 100-300 ohm resistor.
Title: Re: Dual LED Neopixel color not changing
Post by: canteen234 on February 25, 2018, 12:50:09 PM
Hello. I built a TeensySaber 3.0 and the hardware seems to work, but I can't get my dual LEDs to change colors. They are always of a white color and I tried to change it through a file called "my_config." The code is the same as the code from the configurator. I tried deleting all except for 1 of the presets.


#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 2
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   
   { "fontdir", "track.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   
};
BladeConfig blades[] = {
 { 0, WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB>(),
    WS2811BladePtr<144, WS2811_ACTUALLY_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4, bladePowerPin5, bladePowerPin6> >(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif


In the console, I get

Sdcard found..
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
WS2811 Blade with 144 leds
WS2811 Blade with 144 leds
Scanning sound font: font1 done
Activating monophonic font.
unit = 0 vol = 0.50, Playing font1/boot.wav
channels: 1 rate: 22050 bits: 16
Motion setup ... done.
Amplifier off.
Welcome to TeensySaber, type 'help' for more info.

The resistance value seems quite strange.
I connected the LED strips according to the configuration on the website for 2 Neopixels and 1 momentary button.
Can someone please help? I haven't been able to find the solution.

What kind of neopixel strips do you have? Where did you get them?
Do they turn on/off and extend properly?  Is it only one that doesn't work, or is it both of them?

I got them off Banggood
WS2812B 5050 RGB LED Changeable Strip 1M 144 Leds Non-waterproof Individual (https://www.banggood.com/WS2812B-5050-RGB-LED-Changeable-Strip-1M-144-Leds-Non-waterproof-Individual-Addressable-5V-p-1016394.html?rmmds=cart_middle_products&cur_warehouse=CN)
They turn on and off, but I am unable to get them to extend and it is for the both of them.

Weird, it sounds like they default to white when powered, which is unusual.
The page says it's WS2812 chips, but the pictures seems to match SK6821s better.
Anyway, it kind of sound like you have a problem with the data line. Either the resistors are too big, or the chips don't like the signal generated by the teensy.
Before you try anything else, try chaning the WS2811_ACTUALLYY_800kHz to one of:

   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz

and see if any of those work better.

What size resistor do you have on the data line?
I was wondering about the resister. That might be the issue. The site says to calculate the resister with  (BatteryVoltage - LedVoltage) * LedAmps watts but wouldn't that lead to a negative value since the LEDs need 5V per the description of the seller and the battery voltage being 3.7V?

The resistor calculations are only for plain LEDs, not for neopixels.
For neopixels, positive and negative goes directly to power, and the data line should have a 100-300 ohm resistor.

Okay. I just ordered some resisters and they should arrive in a few days. I'll update once I install them. Thank you for the help so far.
Title: Re: Error notifications
Post by: KanyonKris on February 26, 2018, 08:05:04 AM
In case it's useful, here are some talkie phrases I made using the python script:
Code: [Select]
const uint8_t spBADBLADETOM[] PROGMEM = {0x00,0x00,0x00,0x20,0xEA,0xEE,0xD5,0xDD,0xA3,0x4E,0xC9,0x8B,0xD1,0xA8,0xE8,0xD2,0x23,0x2F,0x4E,0xB3,0x72,0x42,0x8F,0xAC,0x78,0xAB,0xCA,0xB1,0xBC,0xD2,0xE2,0xAC,0xB2,0x3A,0xCA,0x48,0xB2,0xF3,0xCA,0x6A,0x2B,0x23,0x4E,0x3E,0x2A,0x6B,0xAC,0x8C,0x24,0x6B,0xCF,0xCA,0x31,0x13,0x92,0xA2,0x34,0x32,0x2A,0x32,0xC9,0xAD,0x8A,0x48,0x0B,0x61,0x28,0x27,0x21,0x33,0xD4,0xA8,0xA1,0x02,0xD9,0xC9,0x30,0x13,0x0D,0x20,0xF2,0x4E,0x2D,0x43,0x35,0x91,0x29,0x0B,0xAA,0x0D,0xE4,0x4D,0xAE,0xCC,0xB8,0x27,0x48,0x5E,0xA5,0xB2,0x92,0x69,0x15,0x7F,0xD8,0xCA,0x46,0x32,0x53,0x63,0x56,0x2B,0x3B,0x73,0xCF,0xC8,0x59,0xAD,0x1A,0x5C,0x2D,0x2B,0x2B,0x95,0x66,0x4A,0x95,0xE8,0x2A,0x95,0xBA,0x29,0x55,0x62,0xAA,0x74,0xE0,0x87,0x14,0xAE,0xAD,0xD2,0x6E,0x1B,0x42,0xB8,0x2E,0x43,0x9B,0xA3,0x4B,0xA6,0xBE,0x0C,0xAD,0xAE,0xAE,0x51,0x66,0xD3,0x88,0x50,0xAA,0x20,0xDB,0x4B,0xC3,0xAC,0xA8,0x82,0x72,0xBB,0xC4,0x22,0xAE,0x52,0xB5,0x4A,0x93,0x23,0x80,0xC5,0xCD,0x11,0xDB,0xB8,0x78,0x46,0x18,0x01,0x00,0x00,0x00,0x00,0x00,0x80,0x07};
const uint8_t spBADBLADEJAMES[] PROGMEM = {0x00,0x00,0x00,0x68,0x04,0xB9,0x3C,0x2B,0x63,0xA0,0x09,0xB4,0xF2,0xCC,0x88,0xA0,0xE8,0xA8,0x5C,0xC3,0x33,0xD2,0xA8,0x8B,0x75,0x4B,0xAB,0xC9,0xA3,0xAE,0x41,0xDD,0x62,0xAA,0x8C,0xA2,0x5A,0xF3,0xCC,0x2E,0xBD,0xF2,0xA6,0xC2,0xB2,0x72,0xF4,0xCA,0x9A,0x0E,0xCB,0xCC,0xC9,0x2B,0x6B,0xC6,0x3C,0x23,0x27,0xAF,0xAC,0x19,0x8B,0xF4,0x9C,0x3C,0xF2,0xAA,0xDC,0xC2,0x6B,0x74,0xCA,0x8B,0x36,0x75,0xEF,0xD1,0x0C,0x63,0xBA,0xB2,0xC3,0x23,0xA3,0x0E,0xEC,0xF4,0xF0,0x90,0x82,0x06,0x90,0xA6,0x5C,0x23,0x91,0x69,0x83,0xA8,0x56,0xD6,0xD6,0xAE,0x4B,0x38,0x37,0x58,0x16,0xBB,0xCE,0xF3,0x1D,0xE1,0xB8,0x5D,0xBA,0x42,0xBB,0x8D,0xFC,0x61,0x1B,0x0A,0xAF,0x4A,0x8D,0x59,0x6D,0x2A,0xC6,0xC3,0x6C,0x26,0x96,0xA5,0x78,0xD5,0xA8,0xAE,0x55,0xB6,0x1A,0x45,0x2C,0x73,0x56,0xE2,0x9A,0x67,0x89,0xAA,0xD9,0x81,0x6F,0x91,0x34,0x3B,0x67,0xBB,0xA7,0x5A,0xD2,0x9A,0x9C,0x24,0xBE,0xEA,0xD0,0xA6,0xBA,0x34,0xFB,0xAB,0x26,0x9E,0x8E,0x42,0xE8,0x8F,0x34,0xAC,0x57,0x0B,0x81,0x02,0xA6,0x4C,0x11,0x42,0x33,0x2A,0x11,0x59,0x85,0x3D,0x3D,0xB8,0xB8,0x67,0x19,0xC4,0xF7,0xD8,0x22,0xE6,0x53,0x00,0x00,0x00,0x00,0xE0,0x01};
const uint8_t spLOWBATTERYTOM[] PROGMEM = {0x00,0x00,0x00,0x00,0x40,0xEA,0x0C,0xFC,0x88,0x23,0xB1,0x68,0x32,0xF0,0x33,0xF2,0xC6,0xAE,0xAE,0xC0,0x26,0x59,0x1B,0xB7,0xB2,0x91,0x98,0x24,0xFD,0xD8,0x8A,0x4E,0x63,0x82,0xE5,0x57,0xCB,0x0A,0xAF,0x31,0xF6,0x8F,0x85,0x4E,0xA2,0x47,0xD9,0x5F,0x86,0x22,0xB8,0x69,0xB4,0xBA,0xE4,0x4A,0x6F,0x7A,0x85,0xFD,0xB6,0xA8,0x9C,0xE9,0x15,0xB2,0x59,0xA8,0xE6,0xA6,0x2B,0x54,0x9C,0xA4,0xA6,0x49,0xB3,0x28,0x9F,0xD5,0x9A,0x26,0xDD,0x2B,0xBD,0xD2,0x68,0x9A,0xF2,0xE8,0xCC,0xCA,0xAD,0x6E,0xC6,0xB2,0x3C,0x23,0xB7,0x32,0xBB,0xA8,0xF0,0xAA,0x9C,0xCA,0x6C,0x7D,0x42,0xCB,0xB6,0x2B,0x52,0x91,0xF0,0x72,0x57,0xE1,0x89,0x99,0x3D,0x56,0x5A,0x05,0x2E,0x64,0xB1,0x7C,0xCB,0xE4,0xF8,0x10,0xC5,0xF3,0x2C,0x93,0x5B,0x93,0x13,0x8F,0xB3,0x56,0x6E,0x2F,0x86,0xCD,0x2E,0x1A,0xBA,0xA3,0x2B,0x56,0xDF,0xAA,0x69,0xEE,0x21,0x59,0xE3,0xAA,0xA2,0x82,0x86,0x61,0xB6,0xAB,0xC2,0xE2,0xED,0x9C,0xAC,0x3E,0x4D,0x0B,0x68,0x58,0x94,0xD8,0x2A,0xC5,0xFE,0x69,0x88,0xF3,0x2A,0x34,0x02,0xA6,0x21,0x02,0x00,0x00,0x00,0x80,0x07};
const uint8_t spLOWBATTERYJAMES[] PROGMEM = {0x00,0x00,0x00,0x28,0xCE,0xC8,0x2B,0x44,0x1D,0xAB,0x35,0xD0,0x1E,0x96,0x5C,0x65,0x46,0x23,0xA6,0x95,0x72,0x81,0x1B,0x3D,0xED,0x76,0x8C,0x45,0x65,0x48,0xA2,0xDA,0x29,0x56,0xB5,0x21,0x4B,0x9F,0x24,0xEF,0xDC,0xFA,0x2C,0x6D,0x55,0xBC,0x57,0xEB,0x92,0xB4,0x35,0xB1,0xDE,0xA5,0x8D,0x32,0xC6,0xC9,0xFA,0x96,0xD6,0xAB,0xEE,0x20,0xED,0x1A,0x5A,0x6D,0x2F,0x8D,0x6D,0x35,0x1B,0xA0,0xBB,0x50,0xF5,0x3A,0x64,0x00,0x39,0xBC,0xCC,0x1A,0x87,0x2C,0xE9,0xF4,0x50,0x9F,0xBC,0xEA,0xA2,0x23,0xC2,0x72,0xF2,0x6A,0xAB,0xCA,0x88,0xC8,0xC9,0xAB,0x2B,0x3A,0x23,0x22,0x47,0xAF,0xBE,0x9A,0x88,0xF0,0x1C,0x3D,0x86,0x6C,0x33,0x22,0x6B,0x4C,0xA1,0xB3,0x89,0x0C,0xCF,0xC9,0x69,0xAE,0x5E,0x42,0xC2,0x93,0x04,0x3E,0x36,0xCA,0x2C,0x4B,0x62,0xB6,0x30,0xA1,0x26,0x78,0xA5,0x38,0xFC,0xC4,0x1C,0x93,0xD6,0xE2,0xB2,0x83,0x6C,0x43,0x56,0x39,0x29,0x7A,0xA3,0x2E,0xD9,0xE8,0xFE,0xEA,0x14,0xAB,0x7D,0x95,0x81,0x7A,0x64,0xA8,0xCE,0x85,0x0A,0x6A,0x0E,0xB9,0xA7,0x2B,0x0A,0xA8,0x4A,0xB2,0x9D,0xB4,0x44,0xA0,0x6E,0x51,0x7A,0x3A,0x12,0x31,0x7A,0x40,0xCD,0x76,0x33,0xC8,0xE9,0x09,0x25,0x2B,0xC4,0x00,0x00,0x00,0x00,0x3C};
const uint8_t spSDCARDERRORTOM[] PROGMEM = {0x00,0xAE,0x29,0x46,0x63,0x2A,0x83,0x94,0x22,0x1B,0xAB,0xAE,0x32,0xD2,0xB2,0xE8,0xBD,0xAB,0x43,0x4A,0x4B,0x93,0xF5,0x8E,0x4E,0x31,0x29,0x2D,0xCA,0x3C,0xB2,0x44,0x3B,0xE0,0x6A,0x55,0x07,0xBC,0x58,0xEE,0x80,0x5F,0x3B,0x0C,0xF0,0x5B,0x07,0x01,0x7E,0xEB,0x60,0xC0,0x32,0x19,0x01,0x98,0x5A,0xA5,0x00,0xD3,0x30,0x35,0x60,0x05,0xA6,0x04,0xCC,0x48,0x68,0xDA,0x59,0x10,0x7D,0x66,0x10,0x9A,0xBA,0x44,0x8A,0xCD,0x2A,0x4A,0x69,0xB1,0x8B,0xDD,0xEA,0x04,0xBA,0xEA,0x0A,0x9C,0x98,0xEB,0x82,0x62,0x2B,0x25,0x35,0x4E,0x8B,0x63,0xCE,0xD2,0xD2,0xCC,0x23,0x89,0x29,0xD3,0xD3,0xB2,0x8E,0x2C,0xC5,0x72,0x0F,0x4F,0x5B,0xF2,0xD4,0x24,0x7C,0x25,0x73,0x2A,0x52,0xE2,0xF0,0xD5,0xCC,0xA6,0xCC,0x56,0x55,0x33,0xE2,0xB4,0x62,0x38,0x51,0x8D,0x5A,0x34,0x8A,0x61,0x55,0xB5,0x6A,0xD5,0x28,0x8A,0x36,0x8B,0xAE,0xD6,0xAD,0xC8,0x41,0xCD,0x36,0x3D,0xA5,0x2A,0x55,0x89,0x18,0x69,0xE9,0x9A,0x38,0xD8,0xA3,0xB8,0x95,0x6B,0xE3,0x62,0xCF,0xE6,0x4E,0x86,0x09,0x93,0x32,0x5B,0x3A,0x19,0x3A,0x4C,0xCA,0x6C,0xE9,0x64,0x8E,0x38,0x29,0xAB,0xB4,0x93,0x3A,0xE3,0xC4,0xEE,0xB4,0x96,0xE2,0x0E,0x83,0xA6,0xDD,0x5B,0x89,0x27,0x0C,0x9A,0xB1,0xA8,0xC5,0xDE,0xD0,0x39,0xBB,0xD5,0x15,0xF9,0x42,0x95,0xEC,0x12,0x57,0xC4,0xCE,0x45,0xBC,0xD2,0x6C,0x21,0xA7,0x84,0xD0,0x4A,0x93,0x04,0x00,0x00,0x00,0xF0};
const uint8_t spSDCARDERRORJAMES[] PROGMEM = {0x00,0x50,0xBA,0xEA,0xC5,0x23,0xA6,0xCC,0xCA,0x9A,0x37,0x0B,0xEF,0x29,0x2B,0x69,0xCE,0x35,0xAC,0x26,0x9F,0xA0,0xD9,0xD0,0xF0,0x9A,0xBD,0x82,0x66,0x52,0xDC,0x6A,0x72,0x0A,0x0A,0x4B,0xC9,0xC8,0x52,0x09,0x78,0x36,0x22,0x01,0x3F,0x56,0x26,0xE0,0xA6,0x76,0x07,0xBC,0x50,0x8E,0x80,0x17,0x23,0x05,0xB0,0x74,0x45,0x02,0x96,0x72,0x69,0xC0,0xD4,0x46,0x0D,0x58,0xD6,0xB1,0x94,0xC3,0x30,0xEA,0xE6,0xE4,0x52,0x76,0xC5,0xE8,0x57,0x93,0x42,0xD5,0x2D,0x83,0x5D,0x4E,0x24,0x5D,0x61,0xCC,0x75,0x1E,0x49,0x40,0x3D,0xAC,0x89,0x98,0xE3,0x22,0xB6,0x34,0x6A,0x1E,0x91,0x9D,0xD0,0x62,0xAB,0x99,0x27,0x31,0x5C,0x33,0xA3,0xE6,0x11,0x39,0x14,0x31,0xB4,0xA8,0x5B,0xAD,0x56,0xA4,0xB8,0xA6,0x25,0x0B,0x4B,0x19,0xEB,0xA8,0x97,0x2C,0x2A,0x75,0x6A,0x2D,0x51,0xB4,0xAA,0xB4,0xA9,0x3B,0x77,0x51,0xA7,0xD4,0xE5,0xCA,0x3C,0x2D,0x9D,0x5C,0x9F,0x3C,0xD3,0xA6,0xD7,0x75,0x5C,0xB5,0xAC,0x19,0x53,0xCB,0xF0,0xD5,0x8B,0x64,0xF6,0xA2,0x32,0x34,0xAF,0x94,0x95,0xB3,0x5A,0xDB,0xBC,0x48,0x74,0xD4,0x6C,0x6D,0x4D,0xC6,0x3A,0xB6,0xAA,0xF5,0x25,0x19,0xDB,0x68,0xEB,0x34,0xE4,0xA2,0x9C,0xC3,0x9D,0xDC,0x14,0x9B,0x70,0x0D,0x77,0x52,0x73,0x98,0xE8,0x9B,0xD4,0x51,0xAD,0x71,0xA0,0xEE,0x50,0x67,0xB3,0xC5,0x46,0xB2,0x4B,0xB9,0x0C,0x17,0x9B,0x70,0x2F,0xE7,0x32,0x77,0xEC,0xCC,0xB3,0xDC,0xC9,0x7C,0x69,0x13,0xCF,0x70,0x67,0x21,0xE4,0x0B,0x3E,0xC1,0xAB,0xC9,0x9A,0x37,0x53,0x74,0x24,0x03,0x00,0x00,0x78};
const uint8_t spFILENOTFOUNDTOM[] PROGMEM = {0x00,0x40,0x80,0x99,0x3B,0x85,0x35,0xFA,0x76,0xB8,0xA7,0x16,0xC0,0x0A,0xAE,0x0A,0x58,0xC1,0xDC,0x00,0x3B,0x67,0xB8,0x24,0xBA,0x69,0x13,0xAD,0xDD,0xD2,0x98,0xB6,0x54,0x7D,0xF6,0x48,0x93,0xDB,0x76,0xF5,0xC5,0x2B,0x29,0xAE,0x2B,0x34,0x16,0xAF,0xA4,0x5A,0xB3,0xCA,0xA8,0x3A,0xE2,0xE6,0x54,0xB2,0x73,0x52,0x8B,0xAB,0x53,0xAD,0xA8,0x5A,0x2D,0x2E,0x22,0x2B,0x24,0x6A,0xA7,0x24,0xF3,0x1A,0xC3,0x58,0x1C,0x92,0x4C,0x7A,0x0C,0xF5,0x55,0x4A,0x3B,0x8A,0x75,0x90,0x55,0x26,0x6B,0xC0,0x26,0x99,0xDB,0xA8,0x3C,0x11,0xCB,0x52,0x8F,0x9B,0xCA,0x2A,0x35,0xC5,0xAA,0x56,0x29,0x9B,0x8C,0x12,0xCD,0xD9,0xA5,0xAA,0x3A,0x5B,0x39,0x66,0x97,0xB2,0xEA,0x6C,0x65,0xAB,0xD2,0xCA,0xA6,0xAD,0x55,0xBD,0x4A,0x28,0x9B,0xD6,0x56,0xB7,0x32,0xC4,0xA9,0x5A,0x8B,0x2D,0x63,0x29,0x60,0x05,0x37,0x07,0xAC,0x34,0x65,0x80,0x55,0xBA,0x14,0x30,0x83,0xBB,0x89,0x93,0xEE,0x56,0xD3,0xB8,0xA5,0xC8,0x66,0x9B,0xCD,0x67,0xB5,0x32,0xDB,0x6B,0xB6,0x98,0x5D,0xCA,0xEC,0x2E,0xC9,0xB3,0x76,0xA9,0x8A,0xE9,0x10,0xCB,0x28,0x89,0x29,0xA6,0x82,0x22,0xA2,0x84,0x39,0xBB,0x49,0x0C,0xAB,0x63,0xB6,0x98,0x3A,0x28,0xBC,0xB1,0x3A,0x43,0xAE,0x20,0xCF,0xC4,0xEA,0x0A,0x29,0x9C,0xD3,0x63,0xB3,0xC7,0xA9,0x28,0x49,0x4F,0x88,0x5E,0xAD,0x62,0x2C,0x5C,0x16,0xF9,0x22,0xE3,0xCC,0x4A,0xDB,0x06,0x98,0xCE,0x5C,0xBC,0xC3,0xA9,0xB1,0xC5,0x44,0xF4,0x76,0xE3,0x46,0xE6,0x15,0x01,0x00,0x00,0x00,0x00,0x00,0xE0,0x01};
These actually sound pretty good.
Are they generated with explicit stop code?
I only ran the WAV files through python_wizard, didn't do any editing afterward.
Because these came from text-to-speech engines, that may help as there would be no noise (as when recording with a mic).
Title: Re: TeensySaber Software Discussion
Post by: nobunaga on February 27, 2018, 04:08:39 AM
Hi. Excuse me. Can I ask a question about make a config and solder two Neopixel strips?

Normally, Neopixel blade is using two strips. These two strips are glued both back side.
I would like to use two LED strips to a TeensySaber V3.

Then, Must I choose 'Neopixel Dual' in the 2nd listbox by config generator?

Or, Can I choose 'WS2811/Neopixel' in the first listbox and 'None' in the 2nd listbox by config generator? And Can I connect two soldered in parallel LED strips to a LED-pin 1,2,3?
Is it Ok?

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 27, 2018, 08:39:10 AM
Hi. Excuse me. Can I ask a question about make a config and solder two Neopixel strips?

Normally, Neopixel blade is using two strips. These two strips are glued both back side.
I would like to use two LED strips to a TeensySaber V3.

Then, Must I choose 'Neopixel Dual' in the 2nd listbox by config generator?

Or, Can I choose 'WS2811/Neopixel' in the first listbox and 'None' in the 2nd listbox by config generator? And Can I connect two soldered in parallel LED strips to a LED-pin 1,2,3?
Is it Ok?

You can do either one. The dual let's you control the strips individually, with the other configuration they will always look the same.
Title: Dual NeoPixel
Post by: canteen234 on February 27, 2018, 02:53:37 PM
I tried using the values you suggested:
   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz
and they still get the same result. I also soldered a 150 Ohm resister to each of the data lines and nothing has changed.
The serial monitor has :
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
which is an odd value for resistance.
Title: Re: Dual NeoPixel
Post by: profezzorn on February 27, 2018, 03:26:05 PM
I tried using the values you suggested:
   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz
and they still get the same result. I also soldered a 150 Ohm resister to each of the data lines and nothing has changed.
The serial monitor has :
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
which is an odd value for resistance.


The blade ID is measured between GND and DATA, if you don't have a blade ID resistor, then a large value is expected.
The inability to control the strips is weird though.
Can you maybe share some pictures that shows how everything is connected?
Title: Re: Dual NeoPixel
Post by: canteen234 on February 27, 2018, 06:03:23 PM
(https://thumb.ibb.co/iBfAnc/20180227_180106.jpg) (https://ibb.co/iBfAnc)(https://thumb.ibb.co/cFxZDH/20180227_180136.jpg) (https://ibb.co/cFxZDH)(https://thumb.ibb.co/cdvMtH/20180227_175907.jpg) (https://ibb.co/cdvMtH)
I tried using the values you suggested:
   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz
and they still get the same result. I also soldered a 150 Ohm resister to each of the data lines and nothing has changed.
The serial monitor has :
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
which is an odd value for resistance.


The blade ID is measured between GND and DATA, if you don't have a blade ID resistor, then a large value is expected.
The inability to control the strips is weird though.
Can you maybe share some pictures that shows how everything is connected?
Title: Re: TeensySaber Software Discussion
Post by: canteen234 on February 27, 2018, 06:13:45 PM
(https://thumb.ibb.co/kAKvnc/20180227_181233.jpg) (https://ibb.co/kAKvnc)
Title: Re: Dual NeoPixel
Post by: profezzorn on February 27, 2018, 07:27:55 PM
(https://thumb.ibb.co/iBfAnc/20180227_180106.jpg) (https://ibb.co/iBfAnc)(https://thumb.ibb.co/cFxZDH/20180227_180136.jpg) (https://ibb.co/cFxZDH)(https://thumb.ibb.co/cdvMtH/20180227_175907.jpg) (https://ibb.co/cdvMtH)
I tried using the values you suggested:
   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz
and they still get the same result. I also soldered a 150 Ohm resister to each of the data lines and nothing has changed.
The serial monitor has :
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
which is an odd value for resistance.


The blade ID is measured between GND and DATA, if you don't have a blade ID resistor, then a large value is expected.
The inability to control the strips is weird though.
Can you maybe share some pictures that shows how everything is connected?

The wires *look* good.
Except that the blue wire seems to be hooked up to pin 8 instead of pin 7 on the teensy. That's not a problem, but it's also not what your config file says.
(Just change the 7 to an 8 in the second WS2811 invocation and you should be fine.)

Next step: Measure. I don't suppose you have an oscilloscope? No, ok, well, just hook up a multimeter between GND and the data on the strip and turn it on.
Once it's on, you should measure a slightly fluctuating voltage somewhere around 1.7 volts or something. If you switch the multimeter to AC, you should also see a value in the same range I think.
If you don't see these values, try measuring on the teensy itself. If you see something different at the beginning of the wire from the end of the wire, your wiring is bad.
If the signal seems to make it to the strips, then maybe you have weird strips that work differently somehow? (Try a different strip)
If the signal doesn't seem to make it out of the teensy at all, try re-programming and/or a different teensy. (There has been at least one person who managed to fry a teensy in such a way that a pin stopped working, but everything else seemed normal, a sure sign of this is that the blade ID stays the same regardless of any resistors you hook up to it.)

Title: Re: Dual NeoPixel
Post by: canteen234 on February 27, 2018, 10:19:19 PM
(https://thumb.ibb.co/iBfAnc/20180227_180106.jpg) (https://ibb.co/iBfAnc)(https://thumb.ibb.co/cFxZDH/20180227_180136.jpg) (https://ibb.co/cFxZDH)(https://thumb.ibb.co/cdvMtH/20180227_175907.jpg) (https://ibb.co/cdvMtH)
I tried using the values you suggested:
   WS2811_800kHz
   WS2811_400kHz
   WS2811_540kHz
   WS2813_800kHz
and they still get the same result. I also soldered a 150 Ohm resister to each of the data lines and nothing has changed.
The serial monitor has :
ID: 1023 volts 3.30 resistance= 33758500.00
blade= 0
which is an odd value for resistance.


The blade ID is measured between GND and DATA, if you don't have a blade ID resistor, then a large value is expected.
The inability to control the strips is weird though.
Can you maybe share some pictures that shows how everything is connected?

The wires *look* good.
Except that the blue wire seems to be hooked up to pin 8 instead of pin 7 on the teensy. That's not a problem, but it's also not what your config file says.
(Just change the 7 to an 8 in the second WS2811 invocation and you should be fine.)

Next step: Measure. I don't suppose you have an oscilloscope? No, ok, well, just hook up a multimeter between GND and the data on the strip and turn it on.
Once it's on, you should measure a slightly fluctuating voltage somewhere around 1.7 volts or something. If you switch the multimeter to AC, you should also see a value in the same range I think.
If you don't see these values, try measuring on the teensy itself. If you see something different at the beginning of the wire from the end of the wire, your wiring is bad.
If the signal seems to make it to the strips, then maybe you have weird strips that work differently somehow? (Try a different strip)
If the signal doesn't seem to make it out of the teensy at all, try re-programming and/or a different teensy. (There has been at least one person who managed to fry a teensy in such a way that a pin stopped working, but everything else seemed normal, a sure sign of this is that the blade ID stays the same regardless of any resistors you hook up to it.)

Hey, I switched the value from 7 to 8 and resoldered an LED on the strip and it worked! Thank you for all the help!
Title: Flash when ignited
Post by: canteen234 on February 28, 2018, 11:59:16 AM
So everything seems to work except that the LEDs initially flash for a fraction of a second whenever the blade is ignited. This also happens whenever I plug in the battery.
Title: Re: Flash when ignited
Post by: profezzorn on February 28, 2018, 12:09:04 PM
So everything seems to work except that the LEDs initially flash for a fraction of a second whenever the blade is ignited. This also happens whenever I plug in the battery.

Having the neopixels come on during bootup, up to a few seconds is normal.
The flash when turning the saber on is not.

It sounds like the particular neopixels you have default to on, which makes it difficult to power them on without having a flash. The code tries to work around this by telling the neopiels what to do as soon as possible when we turn them on, but this might not be fast enough. A workaround would be to just hook up the negative side directly to the battery / kill switch (just bypass the FETs). This would would reduce the standby time a lot unfortunately, but the flash would go away.


Title: Re: Flash when ignited
Post by: canteen234 on February 28, 2018, 01:18:11 PM
So everything seems to work except that the LEDs initially flash for a fraction of a second whenever the blade is ignited. This also happens whenever I plug in the battery.

Having the neopixels come on during bootup, up to a few seconds is normal.
The flash when turning the saber on is not.

It sounds like the particular neopixels you have default to on, which makes it difficult to power them on without having a flash. The code tries to work around this by telling the neopiels what to do as soon as possible when we turn them on, but this might not be fast enough. A workaround would be to just hook up the negative side directly to the battery / kill switch (just bypass the FETs). This would would reduce the standby time a lot unfortunately, but the flash would go away.

I feared that was the solution. It is currently set up so that removing the battery is the only way to completely turn off the TeensySaber, so it's not too big of an issue. Thank you for all your help so far! Is there a way I can donate a bit since I didn't buy a board directly from you?
Title: Re: Flash when ignited
Post by: profezzorn on February 28, 2018, 01:27:53 PM
So everything seems to work except that the LEDs initially flash for a fraction of a second whenever the blade is ignited. This also happens whenever I plug in the battery.

Having the neopixels come on during bootup, up to a few seconds is normal.
The flash when turning the saber on is not.

It sounds like the particular neopixels you have default to on, which makes it difficult to power them on without having a flash. The code tries to work around this by telling the neopiels what to do as soon as possible when we turn them on, but this might not be fast enough. A workaround would be to just hook up the negative side directly to the battery / kill switch (just bypass the FETs). This would would reduce the standby time a lot unfortunately, but the flash would go away.

I feared that was the solution. It is currently set up so that removing the battery is the only way to completely turn off the TeensySaber, so it's not too big of an issue. Thank you for all your help so far! Is there a way I can donate a bit since I didn't buy a board directly from you?

No need. I'd rather you pay it forward by documenting what you're doing and contribute any improvements you make. :)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on February 28, 2018, 09:16:24 PM
How does adding a latching button to the saber effect operation over a momentary? I know with a momentary its one click on, one click off. when off long click plays track. When one and long click play sound effect. And when on and a click/hold and clash it will play lockup. Does this change with a latching button?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on February 28, 2018, 09:58:06 PM
How does adding a latching button to the saber effect operation over a momentary? I know with a momentary its one click on, one click off. when off long click plays track. When one and long click play sound effect. Does this change with a latching button?

Regards,

GMcIvor

Yeah, there is no such thing as a "long click" for a latching button, so track playing and other stuff has to be on another button.
Not sure if things needs to be reconfigured much, I haven't built anything with a latching button myself.
I think the easy way to do it is just to make the AUX button the latching one, that way most of the functions remain, and I think the aux button can still turn the saber on and off.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on March 02, 2018, 08:31:14 AM
Was looking through the custom saber shop for some parts for a couple sabers I was building and came across this http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx (http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx). Would this be something that could be used instead of a blade connector? its nice that it doesn't have to align to have a connection and makes it easier for an end user to use.

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on March 02, 2018, 09:47:54 AM
Was looking through the custom saber shop for some parts for a couple sabers I was building and came across this http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx (http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx). Would this be something that could be used instead of a blade connector? its nice that it doesn't have to align to have a connection and makes it easier for an end user to use.

Regards,

GMcIvor

I haven't tried it myself, but yes, it should work.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on March 05, 2018, 11:24:10 AM
Using something like this http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx (http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx). from the previous comment. If I follow the diagram associated (Neopixel / WS2811 saber circuit diagram) with a recharge port do I need a kill key to for the recharge port to deactivate the saber completely or no?

Regards,

GMcIvor
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on March 05, 2018, 11:28:54 AM
Using something like this http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx (http://www.thecustomsabershop.com/NeoPixel-PCB-connector-and-pin-set-P1338.aspx). from the previous comment. If I follow the diagram associated (Neopixel / WS2811 saber circuit diagram) with a recharge port do I need a kill key to for the recharge port to deactivate the saber completely or no?

Regards,

GMcIvor

Yes, you would need a kill key.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on April 19, 2018, 08:35:54 PM
Hello Profezzorn,

I am building a V3 teensysaber and I had a slight issue not sure if it is software or hardware.

I only have a battery and speaker hooked up to the V3 and the teensy. When I first built it to check if the kil key was working everythinf was working beautifully. I moved the board section place to be glued in the chassis. I thought I should check to see if it still works... to my surprise it stopped working... No more boot sounds when the kill key is removed.

I checked for loose wires and my solder joints everything looks A ok. But the weird part is I can pull the kill key out squeeze the sides of the teensy board and bam it works nearly everytime.

The link provided is a video of it happening. Microsoft OneDrive - Access files anywhere. Create docs with free Office Online. (https://1drv.ms/v/s!Arw3lMvnTTVenz8NUE0OOY6mzKKN)

Any insight into the problem would be appreciated as I am baffled....


Regards,

GMcIvor 
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on April 19, 2018, 09:01:19 PM
Hello Profezzorn,

I am building a V3 teensysaber and I had a slight issue not sure if it is software or hardware.

I only have a battery and speaker hooked up to the V3 and the teensy. When I first built it to check if the kil key was working everythinf was working beautifully. I moved the board section place to be glued in the chassis. I thought I should check to see if it still works... to my surprise it stopped working... No more boot sounds when the kill key is removed.

I checked for loose wires and my solder joints everything looks A ok. But the weird part is I can pull the kill key out squeeze the sides of the teensy board and bam it works nearly everytime.

The link provided is a video of it happening. Microsoft OneDrive - Access files anywhere. Create docs with free Office Online. (https://1drv.ms/v/s!Arw3lMvnTTVenz8NUE0OOY6mzKKN)

Any insight into the problem would be appreciated as I am baffled....


Regards,

GMcIvor

Well that's kind of weird. You're sure it's not just booting slowly?
My best guess is cold solder joints. It's hard to tell from the video, but the solder looks blobby like it's sitting on top of the board instead of actually connecting to it.
A "cozy magnifier" picture might show if they are really cold solders or not.
Also see Common Soldering Problems | Adafruit Guide To Excellent Soldering | Adafruit (https://learn.adafruit.com/adafruit-guide-excellent-soldering/common-problems)
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on April 19, 2018, 09:32:29 PM

Quote

Well that's kind of weird. You're sure it's not just booting slowly?
My best guess is cold solder joints. It's hard to tell from the video, but the solder looks blobby like it's sitting on top of the board instead of actually connecting to it.
A "cozy magnifier" picture might show if they are really cold solders or not.
Also see Common Soldering Problems | Adafruit Guide To Excellent Soldering | Adafruit (https://learn.adafruit.com/adafruit-guide-excellent-soldering/common-problems)

I went over them again followed some of the tips in the adafruit article.

Here are a couple pics zoomed in. (https://www.fx-sabers.com/forum/proxy.php?request=http%3A%2F%2F%5Burl%3Dhttps%3A%2F%2Fibb.co%2FfVegCS%5D%5Bimg%5Dhttps%3A%2F%2Fthumb.ibb.co%2FfVegCS%2F20180419_212642.jpg&hash=2b9f518b31455acfad7476caf9bb10e2)[/url][/img]
(https://thumb.ibb.co/eF2q6n/20180419_212653.jpg) (https://ibb.co/eF2q6n)(https://thumb.ibb.co/b5zWCS/15241986366341068196933.jpg) (https://ibb.co/b5zWCS)(https://thumb.ibb.co/fDuWCS/1524198701431184274942.jpg) (https://ibb.co/fDuWCS)
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on April 19, 2018, 09:43:35 PM

Quote

Well that's kind of weird. You're sure it's not just booting slowly?
My best guess is cold solder joints. It's hard to tell from the video, but the solder looks blobby like it's sitting on top of the board instead of actually connecting to it.
A "cozy magnifier" picture might show if they are really cold solders or not.
Also see Common Soldering Problems | Adafruit Guide To Excellent Soldering | Adafruit (https://learn.adafruit.com/adafruit-guide-excellent-soldering/common-problems)

I went over them again followed some of the tips in the adafruit article.

Here are a couple pics zoomed in. (https://www.fx-sabers.com/forum/proxy.php?request=http%3A%2F%2F%5Burl%3Dhttps%3A%2F%2Fibb.co%2FfVegCS%5D%5Bimg%5Dhttps%3A%2F%2Fthumb.ibb.co%2FfVegCS%2F20180419_212642.jpg&hash=2b9f518b31455acfad7476caf9bb10e2)[/url][/img]
(https://thumb.ibb.co/eF2q6n/20180419_212653.jpg) (https://ibb.co/eF2q6n)(https://thumb.ibb.co/b5zWCS/15241986366341068196933.jpg) (https://ibb.co/b5zWCS)(https://thumb.ibb.co/fDuWCS/1524198701431184274942.jpg) (https://ibb.co/fDuWCS)


Did it help?
They look good to me at least.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on April 19, 2018, 09:45:08 PM

Quote


Did it help?
They look good to me at least.

No, it did not help. It is very puzzling....
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on April 19, 2018, 09:59:53 PM

Quote


Did it help?
They look good to me at least.

No, it did not help. It is very puzzling....

Is the battery charged? (It seems like you might be touching the vtest pin, maybe the voltage cutoff is preventing it from starting.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on April 20, 2018, 08:11:56 AM

Quote


Did it help?
They look good to me at least.

No, it did not help. It is very puzzling....

Is the battery charged? (It seems like you might be touching the vtest pin, maybe the voltage cutoff is preventing it from starting.

It was a brand new battery... Never thought to check I am charging right now to see if it makes a difference.
Title: Re: TeensySaber Software Discussion
Post by: gmcivor on April 20, 2018, 09:11:02 AM

Quote
Is the battery charged? (It seems like you might be touching the vtest pin, maybe the voltage cutoff is preventing it from starting.

Quote
It was a brand new battery... Never thought to check I am charging right now to see if it makes a difference.

Well right now it seems be working... I will let it charge more.. but that seems to be doing the trick... I never thought a brand new battery would cause the problem....

Thanks for the suggestion.

Title: Re: TeensySaber Software Discussion
Post by: Smodtactical on July 27, 2018, 11:42:16 AM
I tried to search for an answer and look at the original teensy docs but couldn't find this.

How many saberfonts can be stored on the saber at one time?

The fact NBV4 is only 3 is quite annoying.
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 27, 2018, 12:19:05 PM
I tried to search for an answer and look at the original teensy docs but couldn't find this.

How many saberfonts can be stored on the saber at one time?

The fact NBV4 is only 3 is quite annoying.

Not sure, hundreds. Navigating that many fonts would be impractical though.
Title: Re: TeensySaber Software Discussion
Post by: Smodtactical on July 27, 2018, 04:08:10 PM
I tried to search for an answer and look at the original teensy docs but couldn't find this.

How many saberfonts can be stored on the saber at one time?

The fact NBV4 is only 3 is quite annoying.

Not sure, hundreds. Navigating that many fonts would be impractical though.

Awesome. I totally agree with you but 3 is just not enough. Also you can't even change saber color in NBV4 for a specific font. Also no blue tooth configuration.

It seems Teensy solves all these problems.
Title: Re: TeensySaber Software Discussion
Post by: Seth Skywalker on July 27, 2018, 04:31:28 PM
How many color profiles per font?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on July 27, 2018, 07:13:25 PM
How many color profiles per font?

Teensysaber doesn't really work like that. There is an unlimited number or presets, each preset specifies which fonts to use and what colors/effects to use.
Title: Re: TeensySaber Software Discussion
Post by: Seth Skywalker on July 27, 2018, 07:41:14 PM
How many color profiles per font?

Teensysaber doesn't really work like that. There is an unlimited number or presets, each preset specifies which fonts to use and what colors/effects to use.
Ah, I see. TY
Title: Re: TeensySaber Software Discussion
Post by: Valereandota on August 18, 2018, 12:49:45 PM
Hello there,

I got a Teensy 3.2 and have a problem with the crossguard, it's probably something dumb for someone experienced lol.
1. As soon as I pull out the kill key the crossguards light up. Wiring triple checked. 2. Aux button doesn't seem to work. Appreciate any help.



#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 3
#define NUM_BUTTONS 2
#define VOLUME 800
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS


// Fire speed, valid values are 1 - 10
#define FIRE1_SPEED 2
// How long to wait before firing up crossguards.
#define FIRE1_DELAY 800

// Each of these have three values: A, B, C
// A = non-random intensity
// B = random intensity
// C = cooling
// The first two control temperature, and as we add
// A + rnd(B) to the base of the blade each animation frame.
// The second controls how rapidly the fire cools down

// This is used during normal operation.
#define FIRE1_NORMAL 0, 1000, 2

// This is used when a clash occurs
#define FIRE1_CLASH  3000, 0, 0

// This is used during lockup.
#define FIRE1_LOCKUP 0, 5000, 10

// Helper
#define FIRE1PTR(NUM, DELAY) \
  StyleFirePtr<RED, YELLOW, NUM, DELAY, FIRE1_SPEED, \
    FIRE1_NORMAL, FIRE1_CLASH, FIRE1_LOCKUP>()


Preset presets[] = {
  { "TeensySF", "tracks/mars.wav",
    FIRE1PTR(0, 0),
    FIRE1PTR(1, FIRE1_DELAY),
    FIRE1PTR(2, FIRE1_DELAY),
  },
  { "SmthJedi", "track..wav",
    StyleNormalPtr<RED, WHITE, 200, 300>(),
    StyleNormalPtr<RED, WHITE, 200, 300>(),
    StyleNormalPtr<RED, WHITE, 200, 300>()
  },
  { "SmthGrey", "tracks/venus.wav",
    StyleRainbowPtr<300, 800>(),
    StyleRainbowPtr<300, 800>(),
    StyleRainbowPtr<300, 800>()
  },
  { "SmthFuzz", "tracks/mars.wav",
    StyleNormalPtr<CYAN, WHITE, 300, 800>(),
    StyleNormalPtr<CYAN, WHITE, 300, 800>(),
     StyleNormalPtr<CYAN, WHITE, 300, 800>()
  },
  { "RgueCmdr", "tracks/mercury.wav",
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >()
  },
  { "TthCrstl", "tracks/uranus.wav",
    StyleFirePtr<BLUE, CYAN, 0>(),
    StyleFirePtr<BLUE, CYAN, 1>(),
    StyleFirePtr<BLUE, CYAN, 2>()
  },
  { "TeensySF", "tracks/venus.wav",
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(),
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(),
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >()
  },
  { "SmthJedi", "tracks/mars.wav",
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(),
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(),
    StyleNormalPtr<WHITE, RED, 300, 800, RED>()
  },
  { "SmthGrey", "tracks/mercury.wav",
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(),
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(),
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>()
  },
  { "SmthFuzz", "tracks/uranus.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(),
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >()
  },
  { "RgueCmdr", "tracks/venus.wav",
    StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(),
    StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>(),
    StyleNormalPtr<Gradient<RED, BLUE>, Gradient<CYAN, YELLOW>, 300, 800>()
  },
  { "TthCrstl", "tracks/mars.wav",
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(),
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(),
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>()
  },
  { "TeensySF", "tracks/mercury.wav",
    &style_pov,
    StyleNormalPtr<BLACK, BLACK, 100,100>(),
    StyleNormalPtr<BLACK, BLACK, 100,100>(),
  },
  { "charging", "notrack.wav",
    &style_charging,
    StyleNormalPtr<BLACK, BLACK, 100,100>(),
    StyleNormalPtr<BLACK, BLACK, 100,100>(),
  },
};


// Hook up the main blade as normal.
// Hook up one of the crossguards like this:
//  NEOPIXEL  +    <--> positive power (probably from charge port)
//  NEOPIXEL  -    <--> LED4 pad on the bottom of the teensysaber
//  NEOPIXEL data  <--> Pin 7 on the teensy  (through a 100ohm resistor)
// Hook up the other crossguards like this:
//  NEOPIXEL  +    <--> positive power (probably from charge port)
//  NEOPIXEL  -    <--> LED5 pad on the bottom of the teensysaber
//  NEOPIXEL data  <--> Pin 8 on the teensy  (through a 100ohm resistor)

BladeConfig blades[] = {
  { 0, // blade ID resistor not used
    // Main blade, 144 LEDs
    WS2811BladePtr<12, WS2811_800kHz | WS2811_GRB>(),
    // First crossguard, 26 LEDS, power on LED4, data on pin 7
    WS2811BladePtr<21, WS2811_800kHz | WS2811_GRB, 7, PowerPINS<bladePowerPin4> >(),
    // First crossguard, 26 LEDS, power on LED5, data on pin 8
    WS2811BladePtr<21, WS2811_800kHz | WS2811_GRB, 8, PowerPINS<bladePowerPin5> >(),
    CONFIGARRAY(presets)
  },
};

#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
Button AuxButton(BUTTON_AUX, auxPin, "aux");
#endif
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on August 19, 2018, 11:21:49 AM
Hello there,

I got a Teensy 3.2 and have a problem with the crossguard, it's probably something dumb for someone experienced lol.
1. As soon as I pull out the kill key the crossguards light up. Wiring triple checked. 2. Aux button doesn't seem to work. Appreciate any help.


Configuration looks fine as far as I can tell.
First question: Are you sure this configuration is actually what the saber is using?
(did you upload it? Did you modify lightsaber.ino to use this configuration?)

Second question: Can you post some pictures of the wiring? Ideally it should show where everything is going, but that can be difficult if it's in the hilt.
Title: Re: TeensySaber Software Discussion
Post by: piccolo831 on August 20, 2018, 10:08:24 AM
Greetings all

First time on the forums and I am learning the Teensy setup. So I am attempting to compile the code and I get the following Error:

lightsaber:723: error: #error NUM_BLADES is too big
 #error NUM_BLADES is too big
  ^
Multiple libraries were found for "SD.h"
 Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
 Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
#error NUM_BLADES is too big

*******************

the config file I am using is from the Teensy Saber Electronics V3 page

#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   { "TeensySF", "tracks/venus.wav",
    StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan"},
   { "SmthJedi", "tracks/mars.wav",
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(), "blue"},
   { "SmthGrey", "tracks/mercury.wav",
    StyleNormalPtr<RED, WHITE, 300, 800>(), "red"},
   { "SmthFuzz", "tracks/uranus.wav",
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "green"},
   { "RgueCmdr", "tracks/venus.wav",
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white"},
   { "TthCrstl", "tracks/mars.wav",
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow"},
   { "TeensySF", "tracks/mercury.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   { "SmthJedi", "tracks/uranus.wav",
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"}
};
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXPE2White, CreeXPE2Blue, CreeXPE2Blue, NoLED>(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif

**************

So what am I missing here?

I selected from the dropdown

Blades / LEDs   Buttons
3-Channel Star LED / Momentary Button
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on August 21, 2018, 07:21:14 PM
Greetings all

First time on the forums and I am learning the Teensy setup. So I am attempting to compile the code and I get the following Error:

lightsaber:723: error: #error NUM_BLADES is too big
 #error NUM_BLADES is too big
  ^
Multiple libraries were found for "SD.h"
 Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
 Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
#error NUM_BLADES is too big

*******************

the config file I am using is from the Teensy Saber Electronics V3 page

#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   { "TeensySF", "tracks/venus.wav",
    StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan"},
   { "SmthJedi", "tracks/mars.wav",
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(), "blue"},
   { "SmthGrey", "tracks/mercury.wav",
    StyleNormalPtr<RED, WHITE, 300, 800>(), "red"},
   { "SmthFuzz", "tracks/uranus.wav",
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "green"},
   { "RgueCmdr", "tracks/venus.wav",
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white"},
   { "TthCrstl", "tracks/mars.wav",
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow"},
   { "TeensySF", "tracks/mercury.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   { "SmthJedi", "tracks/uranus.wav",
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"}
};
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXPE2White, CreeXPE2Blue, CreeXPE2Blue, NoLED>(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif

**************

So what am I missing here?

I selected from the dropdown

Blades / LEDs   Buttons
3-Channel Star LED / Momentary Button

I think the error is somewhere else, the config file looks fine.
Did you update lightsaber.ino to point to your config file?
Did you make any other changes?
Title: Re: TeensySaber Software Discussion
Post by: piccolo831 on August 22, 2018, 06:35:44 AM
Greetings all

First time on the forums and I am learning the Teensy setup. So I am attempting to compile the code and I get the following Error:

lightsaber:723: error: #error NUM_BLADES is too big
 #error NUM_BLADES is too big
  ^
Multiple libraries were found for "SD.h"
 Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
 Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
#error NUM_BLADES is too big

*******************

the config file I am using is from the Teensy Saber Electronics V3 page

#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   { "TeensySF", "tracks/venus.wav",
    StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan"},
   { "SmthJedi", "tracks/mars.wav",
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(), "blue"},
   { "SmthGrey", "tracks/mercury.wav",
    StyleNormalPtr<RED, WHITE, 300, 800>(), "red"},
   { "SmthFuzz", "tracks/uranus.wav",
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "green"},
   { "RgueCmdr", "tracks/venus.wav",
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white"},
   { "TthCrstl", "tracks/mars.wav",
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow"},
   { "TeensySF", "tracks/mercury.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   { "SmthJedi", "tracks/uranus.wav",
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"}
};
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXPE2White, CreeXPE2Blue, CreeXPE2Blue, NoLED>(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif

**************

So what am I missing here?

I selected from the dropdown

Blades / LEDs   Buttons
3-Channel Star LED / Momentary Button

I think the error is somewhere else, the config file looks fine.
Did you update lightsaber.ino to point to your config file?
Did you make any other changes?

Yeah I did

/ You can have multiple configuration files, and specify which one
// to use here.

#define CONFIG_FILE "config/mysaber_config.h"
//#define CONFIG_FILE "config/default_v3_config.h"

So I am not sure why it is failing either...
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on August 22, 2018, 07:24:36 AM
Greetings all

First time on the forums and I am learning the Teensy setup. So I am attempting to compile the code and I get the following Error:

lightsaber:723: error: #error NUM_BLADES is too big
 #error NUM_BLADES is too big
  ^
Multiple libraries were found for "SD.h"
 Used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
 Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
#error NUM_BLADES is too big

*******************

the config file I am using is from the Teensy Saber Electronics V3 page

#ifdef CONFIG_TOP
#include "v3_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
#define VOLUME 1000
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 1.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#endif

#ifdef CONFIG_PRESETS
Preset presets[] = {
   { "TeensySF", "tracks/venus.wav",
    StyleNormalPtr<CYAN, WHITE, 300, 800>(), "cyan"},
   { "SmthJedi", "tracks/mars.wav",
    StylePtr<InOutSparkTip<EASYBLADE(BLUE, WHITE), 300, 800> >(), "blue"},
   { "SmthGrey", "tracks/mercury.wav",
    StyleNormalPtr<RED, WHITE, 300, 800>(), "red"},
   { "SmthFuzz", "tracks/uranus.wav",
    StylePtr<InOutHelper<EASYBLADE(OnSpark<GREEN>, WHITE), 300, 800> >(), "green"},
   { "RgueCmdr", "tracks/venus.wav",
    StyleNormalPtr<WHITE, RED, 300, 800, RED>(), "white"},
   { "TthCrstl", "tracks/mars.wav",
    StyleNormalPtr<AudioFlicker<YELLOW, WHITE>, BLUE, 300, 800>(), "yellow"},
   { "TeensySF", "tracks/mercury.wav",
    StylePtr<InOutSparkTip<EASYBLADE(MAGENTA, WHITE), 300, 800> >(), "magenta"},
   { "SmthJedi", "tracks/uranus.wav",
    StyleStrobePtr<WHITE, Rainbow, 15, 300, 800>(), "strobe"}
};
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXPE2White, CreeXPE2Blue, CreeXPE2Blue, NoLED>(), CONFIGARRAY(presets) },
};
#endif

#ifdef CONFIG_BUTTONS
Button PowerButton(BUTTON_POWER, powerButtonPin, "pow");
#endif

**************

So what am I missing here?

I selected from the dropdown

Blades / LEDs   Buttons
3-Channel Star LED / Momentary Button

I think the error is somewhere else, the config file looks fine.
Did you update lightsaber.ino to point to your config file?
Did you make any other changes?

Yeah I did

/ You can have multiple configuration files, and specify which one
// to use here.

#define CONFIG_FILE "config/mysaber_config.h"
//#define CONFIG_FILE "config/default_v3_config.h"

So I am not sure why it is failing either...

Try downloading the latest proffieos version and add your config file to it.
Maybe your cat walked over the keyboard or something, and starting over will fix it?
If that doesn't help, zip up the whole lightsaber directory and send it to hubbe@hubbe.net (and then drop a note here so I can find it in my spam folder) and I'll take a look at it.
Title: Re: TeensySaber Software Discussion
Post by: Timski on October 24, 2018, 04:55:02 PM
Hello everybody.

I am new here. First of all i want to thank everybody in advance! I am a novice to programming and Controlling things with Arduino/Teensy. But i've fallen deep into te rabbithole :)

I am a photographer and especially love to lightpaint. After years of of using generic ledcontrollers with a battery strapped to them as tools to lightpaint. I think it is time for something new! And offcourse; lightsabers are just AWESOME!

My build is a Teensy 3.6 + Propshield driving a ws2812 144p/m neopixel ledstrip. Still on USB power, going to order a good battery soon.
But everything is working like it's supposed to now. It took me a couple of tries but together with all the information here and of Profezzorn his website, i managed to get it to work pretty easy.

Everything is connected as it is supposed to be between the Teensy 3.6 and the prop shield. (the teens 3.6 has an onboard sd-slot, so the sd-breakoutboard is out of the equation.) It all pretty much speaks for itself,
Just don't forget to make a wire connection between the DAC0/PinA21 and the AUDIO-IN on the Propshield! 

With my first attempt i tried to use the 'prop_shield_fastled_v1_config.h' it compiled, uploaded, but on the serial-monitor i saw there was an 'SPI CONFLICT' After some  reading about the problem i came to the conclusion that is is because Pin11/13 on the propshield for Dotstar shares a Pin with the SD-slot. And i'm not certain if i can fix that.

So my 2nd attempt i tried the 'Graflex_v1_config' and after setting up the sd-card/sound-fonts correctly everything worked like a charm! (only using a single blade of 144 p/m Neopixels.. maybe later i will expand with the ledstar & Mosfets options.)
I only tweaked the Pins for the Power/AUX1/AUX2 buttons to Pin36/37/38 because since the Teensy3.6 is a bit longer why not use the extra space? + i wanted to connect a Teensyview display (sorry i can't post links but there is a good teensyview-hookup-guide online)
Somewhere on this forum i've read that somebody was going to try to use one of these.. But i think at the moment it is easier to connect a I2C display then a SPI variant (and the Teensyview unfortunately is SPI.)
Probably because of the same SPI conflict the Dotstar and SD-slot have i suppose :(

Is there anyway or anybody who made it work?

the breakout pins are connected like:

RST      15 (Std.)
D/C      21 (Alt.)
CS           10 (Std.)
SCLK   13 (Std.)
DATA   11 (Std.)

The same problem i have with my Bluetooth, the Adafruit bluefruit LE..(the same can't post a link but: /getting-started-with-the-nrf8001-bluefruit-le-breakout/introduction) So SPI aswell.. I wished i found the Teensysaber website and this forum before i ordered the part i have :(
Maybe it is possible to connect it to a different SPI bus on the Teensy3.6? It has extra right? I have sadly no idea where to start.

Last but not least question; Would it be possible to add a rotary encoder? For lightpainting i would love to have a quick way to change color-hue/brghtness/strobe/speed or something like that. it would be amazing if that is possible during a picture!

Again i am a novice and without the tons of information online i would never came this far! Thanks to everybody here for that aswel!
Coding for me is the biggest challenge.. i understand how to adjust some little things etc, but when it comes to really writing code i have a LOT to learn!

With kind regards,
Timski

Title: Re: TeensySaber Software Discussion
Post by: profezzorn on October 24, 2018, 05:04:53 PM
Hmm, I think you should be able to work around the SPI conflicts, since you probably want to use SD card that's on the 3.6. If you do that, sound will be read from SDIO instaed of SPI, which means that SPI spi should be free for bluetooth, fastled, etc. Start by making sure that your sdEnablePin is set to -1.
Title: Re: TeensySaber Software Discussion
Post by: Timski on October 24, 2018, 06:36:05 PM
So starting with adding a line with:

sdEnable = -1

to the V1_config.h?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on October 24, 2018, 08:24:33 PM
So starting with adding a line with:

sdEnable = -1

to the V1_config.h?

Actually never mind. The variable is called sdCardSelectPin, but there is no need to set it to -1, because the code already
defaults to using the builtin SD card. That also means that you can ignore the SPI conflict message. It will print it, but it's wrong.
Title: Re: TeensySaber Software Discussion
Post by: Jaelous on November 11, 2018, 04:25:27 PM
under tools I have selected:

Board: "proffieboard"
USB Type: "serial"
DOSFS: "SDCARD (SPI)"
CPU Speed: "Smallest Code"
Port (grayed out)
Programmer: "STM32 BOOTLOADER"

I'm trying to upload the lightsaber.ino to the proffieboard and I'm getting this error. Though it does say done uploading at the top.

Sketch uses 203112 bytes (82%) of program storage space. Maximum is 245760 bytes.
Cannot open DFU device 0483:df11
1
Cannot open DFU device 0483:df11
2
Cannot open DFU device 0483:df11
3
Cannot open DFU device 0483:df11
4
Cannot open DFU device 0483:df11
5
Cannot open DFU device 0483:df11
6
Cannot open DFU device 0483:df11
7
Cannot open DFU device 0483:df11
8
Cannot open DFU device 0483:df11
9
Cannot open DFU device 0483:df11
10
Cannot open DFU device 0483:df11
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 11, 2018, 05:42:22 PM
under tools I have selected:

Board: "proffieboard"
USB Type: "serial"
DOSFS: "SDCARD (SPI)"
CPU Speed: "Smallest Code"
Port (grayed out)
Programmer: "STM32 BOOTLOADER"

I'm trying to upload the lightsaber.ino to the proffieboard and I'm getting this error. Though it does say done uploading at the top.

Sketch uses 203112 bytes (82%) of program storage space. Maximum is 245760 bytes.
Cannot open DFU device 0483:df11
1
Cannot open DFU device 0483:df11
2
Cannot open DFU device 0483:df11
3
Cannot open DFU device 0483:df11
4
Cannot open DFU device 0483:df11
5
Cannot open DFU device 0483:df11
6
Cannot open DFU device 0483:df11
7
Cannot open DFU device 0483:df11
8
Cannot open DFU device 0483:df11
9
Cannot open DFU device 0483:df11
10
Cannot open DFU device 0483:df11


The solution is on this page: GitHub - profezzorn/arduino-proffieboard (https://github.com/profezzorn/arduino-proffieboard)

If you're on windows, run Zadig to install a compatible STM32 BOOTLOADER driver.
If you're on linux, make sure to install the udev rules.
Title: Re: TeensySaber Software Discussion
Post by: jediguy770 on November 13, 2018, 09:05:02 PM
hey, I'm new to this whole proffieboard discussion, and my linux computer isn't recognizing the Proffieboard, so I can't upload anything to it. The link above on the GitHub site gave Linux instructions, but I was unable to figure out what they meant(it's been a few years since I touched a Linux OS.) Any chance someone could tell me in detail what to do?
Title: Re: TeensySaber Software Discussion
Post by: profezzorn on November 13, 2018, 09:56:48 PM
hey, I'm new to this whole proffieboard discussion, and my linux computer isn't recognizing the Proffieboard, so I can't upload anything to it. The link above on the GitHub site gave Linux instructions, but I was unable to figure out what they meant(it's been a few years since I touched a Linux OS.) Any chance someone could tell me in detail what to do?

Open up a shell/xterm/gterm/console whatever it's called in your linux dist.

Cut-n-paste the following two commands:
Code: [Select]
cd ~/.arduino15/packages/profezzorn/hardware/stm32l4/*/drivers/linux/
sudo cp *.rules /etc/udev/rules.d

You'll need to enter the root password when it asks you to.
If you don't have sudo installed, you'll need to run "su", enter the password and then run "cp *.rules /etc/udev/rules.d" after you are root.

Then restart the computer.