OnStepX buzzer issues


Drew 🔭📷🚴‍♂️
 

This is probably simple, just some variable mix up. I started using the buzzer on my MaxESP3. Set all buzzer options on but then had problems were the buzzer would "hang" on after several slews. Started out by turning the STATUS_LED     OFF and got this:

In file included from sketch\src/Config.common.h:11,
                 from sketch\src/Common.h:13,
                 from C:\Users\Sheba\Documents\Arduino\Telescope\OnStepX\OnStepX.ino:50:
sketch\src/Config.defaults.h:219: warning: "STATUS_BUZZER_MEMORY" redefined
 #define STATUS_BUZZER_MEMORY          OFF
 
In file included from sketch\src/Config.common.h:5,
                 from sketch\src/Common.h:13,
                 from C:\Users\Sheba\Documents\Arduino\Telescope\OnStepX\OnStepX.ino:50:
c:\users\sheba\appdata\local\temp\arduino_build_558800\sketch\extended.config.h:104: note: this is the location of the previous definition
 #define STATUS_BUZZER_MEMORY          ON //    OFF, ON to remember buzzer setting across power cycles.                       Option


Ken Hunter
 

Drew...

On my MaxESP32 I followed Howards suggestion to hard wire the buzzer to AUX2 by
using some wirewrap wire. Just remove the 220 ohm resistor and put the AUX2 wire
on the buzzer + pin where the 220 was connected. Then added #Define Tone    4.
This is on the 4.24k3 release I don't know if X is different.

Ken

On Thu, Oct 21, 2021 at 2:19 PM Drew 🔭📷🚴‍♂️ <drewbolce@...> wrote:
This is probably simple, just some variable mix up. I started using the buzzer on my MaxESP3. Set all buzzer options on but then had problems were the buzzer would "hang" on after several slews. Started out by turning the STATUS_LED     OFF and got this:

In file included from sketch\src/Config.common.h:11,
                 from sketch\src/Common.h:13,
                 from C:\Users\Sheba\Documents\Arduino\Telescope\OnStepX\OnStepX.ino:50:
sketch\src/Config.defaults.h:219: warning: "STATUS_BUZZER_MEMORY" redefined
 #define STATUS_BUZZER_MEMORY          OFF
 
In file included from sketch\src/Config.common.h:5,
                 from sketch\src/Common.h:13,
                 from C:\Users\Sheba\Documents\Arduino\Telescope\OnStepX\OnStepX.ino:50:
c:\users\sheba\appdata\local\temp\arduino_build_558800\sketch\extended.config.h:104: note: this is the location of the previous definition
 #define STATUS_BUZZER_MEMORY          ON //    OFF, ON to remember buzzer setting across power cycles.                       Option


Howard Dutton
 

That error was due to a typo, the #ifndef wasn't picking up the prior buzzer setting.

Also, confirm that the status LED's (telescope and mount) were OFF.

The buzzer uses the same /lib/analog class as OnStep which provides Arduino style tone() and analogWrite() functionality.  That in-turn relies on the ESP32 ledc calls and pwm channels so I guess if something else were touching those who knows.

I also tested here with quite a few gotos and no buzzer hang.


Howard Dutton
 

On Fri, Oct 22, 2021 at 04:25 AM, Howard Dutton wrote:
The buzzer uses the same /lib/analog class as OnStep
Well, I did add AnalogWriteResolution() and AnalogWriteFrequency() for servos.


Drew 🔭📷🚴‍♂️
 

This is a side issue. With

STATUS_BUZZER                 ON
STATUS_BUZZER_DEFAULT         ON
STATUS_BUZZER_MEMORY          ON

I get the following compiler warning:

sketch\src\telescope\mount\status\Status.command.cpp: In member function 'bool Status::command(char*, char*, char*, bool*, bool*, CommandError*)':
sketch\src\telescope\mount\status\Status.command.cpp:131:9: error: 'misc' was not declared in this scope
         misc.buzzer = sound.enabled;
         ^~~~
sketch\src\telescope\mount\status\Status.command.cpp:132:24: error: 'NV_MOUNT_MISC_BASE' was not declared in this scope
         nv.updateBytes(NV_MOUNT_MISC_BASE, &misc, MiscSize);
                        ^~~~~~~~~~~~~~~~~~
sketch\src\telescope\mount\status\Status.command.cpp:132:24: note: suggested alternative: 'NV_MOUNT_PEC_BASE'
         nv.updateBytes(NV_MOUNT_MISC_BASE, &misc, MiscSize);
                        ^~~~~~~~~~~~~~~~~~
                        NV_MOUNT_PEC_BASE
sketch\src\telescope\mount\status\Status.command.cpp:132:51: error: 'MiscSize' was not declared in this scope
         nv.updateBytes(NV_MOUNT_MISC_BASE, &misc, MiscSize);
                                                   ^~~~~~~~
sketch\src\telescope\mount\status\Status.command.cpp:132:51: note: suggested alternative: 'PierSide'
         nv.updateBytes(NV_MOUNT_MISC_BASE, &misc, MiscSize);
                                                   ^~~~~~~~
                                                   PierSide
sketch\src\telescope\mount\status\Status.cpp: In member function 'void Status::init()':
sketch\src\telescope\mount\status\Status.cpp:32:21: error: 'misc' was not declared in this scope
     sound.enabled = misc.buzzer;
                     ^~~~

If I turn: STATUS_BUZZER_MEMORY          OFF
it goes away.


Howard Dutton
 

Probably broken/removed during refactoring at some point.

I added code for remembering the setting in the "status" class, so give it a try now.


Drew 🔭📷🚴‍♂️
 

Does this mean I should start out fresh? The new NV key makes me think so.

BTW, I am still able to hang the buzzer on. However, I think I am cheating a little. My bench setup has no motors attached. I am doing GoTo's from SkySafari and can go from one to the other fairly fast. I do wait until the buzzer is off. Still I can hang it. Makes me think something in the code is not happening as fast as it should.


Howard Dutton
 

Is this with the buzzer ON or set to a frequency?


Howard Dutton
 

I'm guessing ON...

I wasn't using OnTask correctly.  Creating a task to stop the buzzer which is fine it runs once and stops the buzzer.  Problem is the task was not disposed of after it runs once.  Keep that up for long and you run out of tasks and the buzzer stays on since the task to stop it is never created.

Not so much random but rather you reach a certain point and buzzer stays on forever.

Just need to set the task duration so it's disposed automatically later.

Try again now, again. :)


Howard Dutton
 

On Fri, Oct 22, 2021 at 07:36 AM, Howard Dutton wrote:
Problem is the task was not disposed of after it runs once
This is by design.  So you don't have to incur the overhead of task creation and disposal, if you want to run the task again set the period non-zero and it'll run then stop again.  If you want the task disposed of after it runs (for however long, even just once) use duration.