fiduciary

Author Topic: TeensySaber Software Discussion  (Read 67050 times)

0 Members and 1 Guest are viewing this topic.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #30 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.

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #31 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

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #32 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.

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #33 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

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #34 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.


Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #35 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
« Last Edit: June 04, 2017, 05:35:54 PM by gmcivor »

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #36 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?

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #37 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

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #38 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 :)

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #39 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

Offline bobi-one

  • No Force
  • *
  • Posts: 43
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #40 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.

Offline bobi-one

  • No Force
  • *
  • Posts: 43
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #41 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 :D

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #42 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 :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.

Offline bobi-one

  • No Force
  • *
  • Posts: 43
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #43 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?

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #44 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.

 

retrousse