Git Product home page Git Product logo

firmware's Introduction

NexDome firmware for Arduino

This firmware was professionally developed for NexDome by Tigra Astronomy. The code is open-source and is licensed under the Tigra Astronomy MIT license.

Table of Contents {ignore=true}

[TOC]

Development Environment

The Arduino IDE is great for casual experimentation but is rather limiting for serious software development. This project was developed using Microsoft Visual Studio, with the VisualMicro Arduino extension, which makes it easy to have local libraries and shared code projects and reference them in exactly the same way you would in a C# project, without having to install the library or move it to some aesoteric location.

Therefore, to compile this project, you will need Microsoft Visual Studio 2017 or later, and the VisualMicro Arduino extension. Both products have free versions that can be used to build this solution.

One useful feature of the Arduino IDE is that it includes the ability to compile and upload sketches to the target device in one operation. However, the process of installing the Arduino IDE, plus all of the libraries required, downloading the source code, compiling it and finally uploading the compiled sketch is too risky and complicated for non-technical end users. This also would have tied the project to the Arduino IDE, which would have restricted our development practices. We have therefore produced a firmware uploader utility written in C# within the same solution. This enables distribution of pre-compiled firmware in Intel Hex format (*.hex) and these files can be directly uploaded to the Arduino using a simple command.

Design Philosophy

Within the limitations of the Arduino platform (a resource-constrained embedded system), we have tried to apply the SOLID principles of object oriented design:

S - Single responsibility principle; each class should have only one responsibility
O - Open/Closed principle; open for extension, closed for modification
L - Liskov substitution principle; superclasses and subclasses classes should be interchangeable
I - Interface segregation principle
D - Dependency inversion principle; depend on abstractions not details

Well-factored object oriented code that adheres to the SOLID principles should be loosely coupled, highly cohesive, testable and have low viscosity for future maintenance.

Due to severe resource constraints imposed by the target platform, we have had to compromise somewhat on this ideal and use a more procedural style in order to save memory and code space. Due to lack of a unit testing framework for the Arduino platform, we have also not produced unit tests.

Memory Management

Dynamic memory allocations have been agressively avoided. As a resource-constrained embedded system with just 2Kb of data memory, there is not much space available for a heap and we can't tolerate "Out Of Memory" errors at runtime. The system must be stable for days, months or even years at a time so the memory management strategy must be frugal, deterministic and stable.

Our solution to this is to statically pre-allocate as many objects as possible once, in global scope, then never delete them. The top level .ino sketch file contains these allocations either as statically initialized global variables or in the setup() method and this essentially forms the Composition Root for the system. The main exception to this rule is in the XBee state machine classes, which are created and destroyed as necessary - however the system will usually remain in the Online state so there will be a stable configuration most of the time.

Since we can assume that most objects are never freed, there is little to be gained from the use of smart pointers and we have chosen to avoid the overhead and use "raw" pointers where necessary. Where possible, we have used references (&) and pass-by-reference, and these references typically resolve to one of the objects defined in global scope in the main sketch file.

We make use of the C++ standard template library defined in namespace std:: and provided by the library ArduinoSTL. This is perhaps unusual in the context of an Arduino sketch, for reasons we don't really understand. Perhaps many Arduino programmers are not familiar with the full capabilities fo th C++ language (a situation that the Arduino IDE and approach to programming seems to propagate). Perhaps it is because many people believe that these classes require more memory and the Arduino is somehow "not powerful enough" to use them. In fact, these classes are highly optimised and do not incur much, if any, overhead. What they do provide is algorithms and data structures that have been highly polished over many years, and a degree of readability and modularity to the code. We think that the trade-off of a slight memory and performance overhead is more than worth the extra readability and maintainability that it gives the code. We make good use of the std::vector<T> class to manage collections and in particular for sending, receiving and manipulating XBee API data frames. Typically we construct vectors with a reserved capacity, so that re-allocation of memory is not necessary, and we never free these structures so they remain permanently allocated (note: passing by reference does not copy the data). We also make use of std::string.

Motor Control

The stepper motors have a Direction/Step/Enable hardware interface and are driven by generating a square wave onto the Step pin while the Enable pin is asserted. Direction of movement is controlled, self evidently, by the Direction pin. Negating the Enable pin removes energy from the motor coils and releases holding torque.

The stepping process is time sensitive and demands high throughput speeds and consistent step pulse train generation for smooth motor operation. Tigra Astronomy has developed a control library for stepper motors that ensures that steps can be delivered at high speed and with consistent timing, regardless of what is happening in the Arduino main loop. The popular AccelStepper library does not achieve this because it relies on being called within the Arduino main loop and mingles all of the acceleration computations in with the step generation.

Here we see a clear advantage in paying attention to the Single Responsibility Principle. Tigra's stepper driver logically divides stepping into two parts:

Step Generator

A step generator (implements: IStepGenerator) is responsible for generating a pulse train where each rising edge causes the motor to make one step. The step generator is responsible for timing (step speed) and has no concept of position, direction or the type of steps (whole steps, microsteps, etc.)

We have provided a single implementation, CounterTimer1StepGenerator, which uses the Timer 1 block of the AVR processor to generate accurately timed pulses with 50% duty cycle. The timer is configured to generate interrupts using the OCR1A compare register. The timing source is the undivided system clock, which allows for a theoretical stepping bandwidth of about 244 steps/second up to 16,000,000 steps/second.

Step Sequencer

The step sequencer (implements: IStepSequencer) carries the responsibility of writing the correct hardware signals to the motor driver and keeping track of the step position.

Our MicrosteppingMotor class provides the IStepSequencer implementation and allows for acceleration and deceleration. MicrosteppingMotor also keeps track of the current step position and enforces limits of travel on the motors.

Acceleration

The MicrosteppingMotor class implements acceleration and deceleration based on the equation of uniform acceleration, $v = u + at$. This reduces the risk of stalling, especially when moving heavy loads.

The ComputeAcceleratedVelocity method is called once per Arduino main loop to recompute the motor velocity and acceleration curves. We have found that acceleration can be treated as a lower priority task and does not need to be computed for every step. This allows us to schedule it in the main loop with other tasks and maintain a clean separation of concerns in the code.

The "Ramp Time" (the time taken to accelerate from rest to maximum speed) is configurable by the user. Ramp time is specified in milliseconds. 250 to 500 milliseconds is usually sufficient for moderate loads but for more massive loads this can be increased.

Speed and Power Considerations

The NexDome controllers us a 15.3:1 gearing arrangement to drive both the rotator and shutter mechanisms. This arrangement provides a naturally stable system at rest which means that holding torque in the stepper motors is unnecessary. Therefore, the step drivers are disabled once motion has ceased. This reduces power consuption and keeps the motors and step drivers cool when not actively driving the mechanism.

While the AdvancedStepper code is capable of very high step rates, there is a trade-off between maximum stepping speed, available torque and power consumption and mechanical considerations inherent to the structure. The firmware provides commands for reading and writing the maximum step rate (@VR, @VW) and acceleration ramp time (@AR,@AW) so that the end user can manage this speed/torque/power tradeoff to suit local conditions. Conservative defaults are provided.

The Tigra AdvancedStepper code is capable of driving steps at a theoretical rate of at least 50,000 microsteps per second on an Arduino AVR family CPU (UNO, Leonardo). In practice the motors and driver modules used will dictate the maximum possible speed beyond which the motors may be unable to provide sufficient torque and may stall. Sensible factory defaults have been carefully chosen and we do not advise adjusting the motor parameters away the factory defaults without good reason.

Command Processor

Command processing is handled by the CommandProcessor class. This is actually a port of a more object-oriented library (also developed by Tigra Astronomy) but is one area where we found it necessary to favour smaller resource usage over code structure. Therefore our object oriented design has been collapsed into more procedural code in this implementation.

When a well formed command is received from the serial communications channel it is passed to DispatchCommand() which decides whether it is a local or remote command. If local, it is passed on to CommandProcessor::HandleCommand(). Otherwise it is passed to teh XBee state machine for transmission on to the remote device.

Each command verb has its own handler method. CommandProcessor::HandleCommand() decides which handler method to call based on the command verb.

All command handlers return a Response structure, which contains the text (if any) to be transmitted back to the client application.

Command Protocol

For details of the firmware commands and responses, please refer to the Firmware Protocol page of the ASCOM driver wiki.

Arduino Libraries Used

  • ArduinoSTL - standard template library (install from library manager)
  • eeprom - for reading and writing the nonvolatile storage (install from library manager)
  • AdvancedStepper - Tigra Astronomy's advanced stepper motor control (included/local)
  • XBeeAPI - NexDome specific, used for sending, receiving and parsing XBee API data frames (included/local)
  • XBeeStateMachine - NexDome specific, used to control the sate of XBee communications (included/local)
  • Timer - Tigra Astronomy's timer utility, used primarily for monitoring timeouts. (included/local)

@import "Markdown\XBee.md"

XBee State Machine

The XBee communications is managed by a state machine that controls startup, configuration and ongoing monitoring of the connection to the remote device.

The framework of the state machine is common to both rotator and shutter, so it is contained in a shared library called XBeeStateMachine. The operation of the two modules differs as the Rotator module must act as coordinator and the Shutter module as an endpoint. The states are therefore implemented directly in each sketch.

Rotator XBee State Machine

@import "Markdown\RotatorXBeeStatemachine.md"

Shutter XBee State Machine

@import "Markdown\ShutterXBeeStatemachine.md"

firmware's People

Contributors

nameofthedragon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

firmware's Issues

Req way to force close into the negative on the percent open

It would be really ideal to have a way to do this.. every once in awhile this happens..
a way to force close the shutter when it stutters and loses position due to a stutter/slip on closing..

IE: it closes, stutters, then stops 3/4 of the way down, because it thinks its at 0% open (or vice versa it goes up all the way but is now at 90%)
A simple way to override the close button to keep going into the negative would be ideal. In this example -10% would be fully closed.

No response to @PRS commands

Hi Tim.
Based on a few lofs for 2 users I see timeout every time I request the shutter position 👍

[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] sending : @PRR


[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] response : ':PRR20196'
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::getDomeAz] szResp = PRR20196
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::getDomeAz] m_nNbStepPerRev = 55080
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::getDomeAz] m_nCurrentRotatorPos = 20196
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::getDomeAz] dDomeAz = 132.00

[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] sending : @PRS
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] response : ':PRR20196'

[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] sending : @PRS
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] response : 'XB->Online'
[Thu Nov 14 20:26:08 2019] [CNexDomeV3::domeCommand] XBee status : 'XB->Online'
[Thu Nov 14 20:26:09 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:10 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:12 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:13 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:14 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:16 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:17 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:18 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:18 2019] [CNexDomeV3::domeCommand] response : 'XB->Online'
[Thu Nov 14 20:26:18 2019] [CNexDomeV3::domeCommand] XBee status : 'XB->Online'
[Thu Nov 14 20:26:19 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Thu Nov 14 20:26:20 2019] [CNexDomeV3::getDomeEl] ERROR = PRR20196

as you can see I do get some of the inline messages, like the XBee online status and no actual :PRSxxxxx response to the @prs command, but I do get the same response as the previous command (which was a @prr in this case).
So there is either a timeout in the XBee communication with the shutter or in the firmware somewhere.
Is there a minimum amount of time required between commands ?

close ( or stop) should immediately stop if the shutter is trying to open

I just performed "open" on my observatory remotely with the nexdome control software on windows. Unfortunately something was stuck and I'm at a distance so I don't know what that is. However the shutter kept trying to open, despite commanding close, a few times. The state then ended up in "close" state but I had to have somebody shut off the shutter for me. Loud racket, probably not good on the battery or motor to do indefinitely.

Can you add an emergency stop, at least that is recognized to the xbee comm frequency?

Telescope aperture vignetting caused by 1 degree dome azimuth command resolution

Due to the 1 degree default azimuth command resolution, telescopes with large apertures can experience vignetting of the aperture by the edge of the dome slit as the telescope/mount moves continuously but the dome only moves on 1 degree changes. For astronomers doing non-differential photometry this issue creates discontinuities in the light curves that are difficult to correct for. Problem observed with a Celestron C14 EdgeHD with a 0.7 reducer.

TA.Nexdome.Server-2019-11-30-MSI_dolphinzilla-MSI.log
TA.Nexdome.Server-2019-11-29-MSI_dolphinzilla-MSI.log

Events question

Thank you for the great documentation. I'm developing the INDI driver for NexDome v3 and the documentation is pretty detailed and straight forward.

Regarding the events, what's the delimiter? Is it <CR><LF>

And just to confirm, the XBee, Rotation, and Shutter events are not terminated by a '#'?

Investigate use of XBee Series 3 devices

During development of release 3.0.0, XBee Series 3 devices were tried and found not to be 100% backward compatible with the XBee Series 1 devices. Although they are pin-compatible and the API is very similar, there are some minor differences and the firmware as currently designed will not work with them.

XBee series 1 has been discontinued by the manufacturer and although they are still available, clearly this is not going to hold true forever and we will need to move over to the XBee series 3 devices.

@nexdome has requested that @NameOfTheDragon investigates what changes would be needed to make the firmware compatible with both S1 and S3 XBees.

Assess XBee options and compatibility

Examine which XBee modules and options are supported and in production from the manufacturer, and which ones will work with the current firmware.

Shutter status after manual activation

When the software closes the shutter it appropiately shows "Closed" at the end of the cycle. However, if you use the manual control to tweak the shutter just a bit further closed, the software reports "Open" even though the magnetic switch is still in the closed position. Disconnect and reconnect and the software once again shows "Closed." I'm running the latest 3.3 version firmware on both shtter and rotator.

slipping sprocket won't close shutter

I posted this in the wrong version. Reposting here. (may be it's fixed already) as a update was just released?

I had an issue where my shutter sprocket slipped a few turns. (I think due to friction build up in the shutter panel). Once the sprocket slipped the shutter position count was in error. When the driver showed and stated the shutter was closed. (it was in reality very much open). There was no way for me to RESET and close the shutter without going out there manually. If this had happened the week before (I was 800 miles away) and it would have been open for days. !!!!

It did it a week later again. I got up at 3am from bed and closed it manually. In doing so (not sure why) pressing the rocker on the shutter box to close would only do so in about 2-3inch increments and then stop. A release and repress of the rocker continued another 2-3 inches and after 20 or so presses it was closed.

@GAR to a position that is the current position

Not quite sure how to qualify this one.. but, if I'm at position 108 and do a @gar;108, I get a :GAR response but I would also hope to get a :SER response after to indicate the end of the move even if there was no move and will not get a :left or :right
So it's not a bug per say, more of a behavior question.
Thanks
Rodolphe

Shutter commands are sometimes not acknowledged

Reported by @rpineau

The find home now works very well at all speed.
But .. There might be a new issue with this firmware.
As expected we can get status message between a command and its response but usually the response comes back fairly quickly after.
With the new firmware I see huge timeout between the command, status messages and the actual response :

[Sat Oct 26 16:37:08 2019] [CNexDomeV3::domeCommand] sending : @PRS

[Sat Oct 26 16:37:08 2019] [CNexDomeV3::domeCommand] response : 'XB->Online'
[Sat Oct 26 16:37:08 2019] [CNexDomeV3::domeCommand] XBee status : 'XB->Online'
[Sat Oct 26 16:37:10 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:12 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
^X[Sat Oct 26 16:37:14 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:14 2019] [CNexDomeV3::domeCommand] response : ':BV823'
[Sat Oct 26 16:37:14 2019] [CNexDomeV3::domeCommand] m_dShutterVolts : 12.07
[Sat Oct 26 16:37:16 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:18 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:18 2019] [CNexDomeV3::domeCommand] response : 'XB->Online'
[Sat Oct 26 16:37:18 2019] [CNexDomeV3::domeCommand] XBee status : 'XB->Online'
[Sat Oct 26 16:37:20 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:22 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:24 2019] CNexDomeV3::readResponse Timeout while waiting for response from controller
[Sat Oct 26 16:37:24 2019] [CNexDomeV3::getDomeEl] ERROR = PRR0

As you can see the @prs command is sent at 16:37:08, then we get 2 "event notifications" (XB status and shutter voltage) at 16:37:08 and 16:37:14
and then another XB status at 16:37:18
and a response arrives at 16:37:24 , that's 16 seconds after sending the command, and it's not the proper responser (hence the ERROR label).
So there is something weird going on when requesting shutter states.
This is not happening often but I saw it once on connect and another time (above)

I see more response that do not match the command send :

[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] sending : @SWR

[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] response : 'STOP'
[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] response : 'Hstop 4'
[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] sending : @SWS

[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] response : ':SER,0,1,12347,0,30'  <==== This is not a proper response to @SWS
[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] sending : @PRR

[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] response : ':SWR'  <==== This is not a proper response to @PRR
[Sat Oct 26 16:37:24 2019] [CNexDomeV3::getDomeAz] szResp = SWR
[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] sending : @PRR

[Sat Oct 26 16:37:24 2019] [CNexDomeV3::domeCommand] response : ':PRR0'

Originally posted by @rpineau in #11 (comment)

@rpineau later commented:

I agree that this is potentially due to a XBee response being lost as I only see these on shutter commands. On my test rig the 2 XBee are about 15cm from each other so distance here is not the issues.
Between the 2 "XB->Online" status there are 10 seconds during which we also get a battery update. So could it also be that the Shutter XBee didn't receive the command and is therefore not responding to it.

Improve firmware settings integrity check

@NameOfTheDragon commented on Wed Oct 02 2019

On power-up, the firmware loads settings from EEPROM and performs an integrity check on the data. If the integrity check fails, then default settings are loaded.

In specific circumstances, EEPROM can be corrupted in a way that still allows it to pass integrity checks. In this situation, the device will behave erratically. Symptoms reported include the user needing to press the rocker switch repeatedly to get the dome/shutter to move.

The specific circumstances that lead to this corruption are when the user has upgraded to V3 firmware, downgraded to V2, then upgraded to V3 again. This happened a few times during alpha testing but should not be a problem post-release.

Workaround

  1. Download the EEClear.hex firmware image from the GitHub repository and drop it into C:\Nexdome-Firmware
  2. Open the driver SetupDialog and use the firmware update utility to uploed the EEClear.hex image. This will immediately clear the settings from EEPROM.
  3. Upload the normal operating firmware and continue to use the software as normal.

Proposed solution

Write the integrity check 'fingerprint' at the start of the settings instead of at the end. Then the 'fingerprint' will be the first thing to be overwritten instead of the last.

Does the shutter firmware crash after some time?

Shutter, but not dome is going unresponsive after some indeterminate time. Possibly more than a day. This is probably the 5th time now. Currently on 4.0.1 but happened on 4.0.0 as well. There's no way to reset it remotely...? How about a xbee based command to make it reboot? Magic packet or something - I have a spare xbee usb controller I could use to do such a thing.

Rotator loses pointing accuracy after many small nudges

Some users have reported a drift in azimuth over an observing session. User Christopher Duffey spent time troubleshooting this with me and showed me that the effect was real. We were able to provoke a drift of about 3 degrees in 10 minutes, using excessively high dome refresh period (~3 seonds) in TheSky X. Christopher seemed to intuitively know what was needed and made the process much easier, for which we owe him a debt of gratitude.

We tried various workarounds:

  • decreasing max motor speed and increasing acceleration ramp time - no effect
  • increasing firmware "dead zone" setting to 75 steps (~0.5°) - improved accuracy

The working hypothesis is that many small nudges somehow introduce lost steps. The exact mechanism isn't clear but it might be linked to the fact that the motors are de-energized after each slew, and somehow a lost step creeps in when there is no holding torque.

Increasing the "dead zone" in the firmware to 75 steps [@DWR,75] results in tiny movements being ignored by the firmware and seems to eliminate the problem.

Therefore, we should look at the possibility of:

  1. Not de-energizing the motors after each slew, or making this a user-settable option. This may or may not solve the problem and will probably make the motor run hot, so the impact needs to be assessed.
  2. Choose a better default value for dead-zone (it appears to be 1 step, currently, although the documentation has it much higher).
  3. Consider enforcing a minimum value for dead-zone.
  4. Raise user awareness of the importance of the dead-zone.

Limits for parameters

I apologize if this is not the correct place to ask such questions, but as I was developing the INDI driver, I needed some clarifications:

Max/Min limits for parameters:

  • Acceleration Ramp
  • Dead Zone
  • Travel Range
  • Velocity

Do you need to explicitly connect to shutter? or the firmware automatically connect to it? How do you open and close the shutter? By issuing steps 0 to fully open for example?

Incorrect values returned for `@RRS`

Testing of pull request #30 has revealed a puzzling issue as follows:

@FRS
FRS3.4.0-auto-close.5
@ZDS
ZDS
@RRS
RRS46000
@RWS,20000
RWS
@RRS
RRS200009

The final reading of @RRS returns the wrong value, always some extra data appended to the end.

Some thoughts on this:

  • The XBee isn't implicated because it happens when issuing the commands locally on the shutter (as above).
  • The command and payload appears to arrive intact when sent remotely from the rotator, as in this example:
    When sending @RWS,20000 from the rotator, the shutter emits Cmd @RWS,20000 which suggests that the data is arriving intact.
  • Reading the configuration and performing microsteps-to-steps conversion doesn't appear to be implicated, because reverting to factory defaults restores the correct value, which it then reported correctly.
  • The appended spurious data is always "09" so it doesn't seem to be a random memory corruption.

Conclusion: something is happening to the value between receiving it as a command and the value being written into the configuration structure.

This needs to be traced in detail to determine what's going wrong.

AtHome flag may be false when FindHome completes

This problem was raised when a user observed the dome apparently trying multiple times to find the home sensor. The user was using the X2 driver.

Rodolphe reports:

It retries because when it stops it’s not on the home magnet, it backs too much depending on speed and acceleration Even without myb plugin by using a simple serial terminal I can reproduce the home miss, When I get back home tonight I’ll make a small movie of what happens when the “dome” backs back to the home sensor and the speed is too high and/or acceleration is too long.
This is 100% reproducible and when you send a @rrr the atHome flag is 0.

To which I have replied:

OK so I think you’re checking the home flag at the end of all that and seeing it as false. That might be a bug, I’ll check into it. During the development I changed how homing worked because my original method didn’t work very well. The method I finally settled on works very well and has good repeatability, but It’s possible that I’m not handling the home flag correctly.

Changing slew destination without waiting for completion

I'm integrating NexDome into NINA, which is open source AP imaging software. I'd like to be able to change the destination of an active slew request, but it doesn't seem like there is a way to do it either in the ASCOM driver or the firmware. My observation so far is that the firmware ignores @gar commands if a slew is in progress, and the only way to stop it is to abort a slew first (@SWS). This has a few downsides:

  1. If a shutter operation is in progress, that is aborted to and the shutter is left in an error state (you have to fully close before you can try opening again)
  2. The movement is abrupt
  3. Perhaps the instant stop without deceleration is bad for the hardware if done regularly?

Would it be possible to add support for some combination of the following?

  1. Soft abort with deceleration
  2. Accepting new slew requests to change the destination without requiring a stop first
  3. Separating shutter stop from dome stop, so they can be controlled separately if needed

Xbee S2C

My rotator was missing the xbee and I can only find the Xbee S2C in the UAE.
Should the firmware and codes change to match this version of the Xbee?
Can I use the S2C on the rotator and S1 on the shutter?
If I change the shutter xbee s1 to the S2C version as well (both shutter and rotator will have S2C) would that work?

Dead Zone default is too high

The dead-zone default value is 300 steps (~2 degrees). This was put in when the slewing resolution was 1°, but now that we have precision slewing it should be much smaller. A value of 75 steps (~0.5 degrees) seems to work well and would be a good starting point.

When using manual control the home status is not updated

A user pinged me as there is an issue when using both computer control and the rocker switch to move the dome.
when moving the dome via the rocker switch the position is properly updated but the at home status is not.
Here is how the user tested this and what I got from my log :

1. Connect Dome = OK; Note the dome is starting out at home (Az164)

Yes.

2. MANUALLY GoTo Az146 (approximately)
Yes, I see it

3. Find Home = DOME DOES NOT MOVE!! Az changes to 164 and dome reports Finding home complete. No errors <<<===

This is where we see the issue
The position is :
[Sat Dec 7 08:15:03 2019] [CNexDomeV3::getDomeAz] dDomeAz = 145.95

I send the command to get the status :

[Sat Dec 7 08:15:03 2019] [CNexDomeV3::domeCommand] sending : @srr

The response is :
[Sat Dec 7 08:15:03 2019] [CNexDomeV3::readResponse] response = :SER,22331,1,55080,25092,150#

If we decode it :
SER : status response
22331 : position in tick counts
1: At home status , 1 means at home <==== THIS IS NOT TRUE as we moved.

4. Use Command to GoTo Az150 = Dome moves to what it thinks is Az150 which is now actually about Az132 or so

It’s like as you move manually some internal sync is not done and it’s lost !

5. Find Home = Dome goes all the way back to home sensor; Az reports 164 (position is now correct)
Yea, because this time it comes from the serial command so probably goes through a different code path.

So this is clearly a firmware bug when using manual control with computer control at the same time

TheSkyX v3 x2 slew getting stuck

I am running a Pointing model t-point and it is supposed to skew to several targets and take pictures. I did not have this problem when using the older x2 driver.

The problem is that it will get stuck at ‘slewing to target’ and will not move on to taking a picture and image linking. It will do one or two targets and then get stuck.

If I quit the Pointing model and do a normal slew to target it seems to act normally.

Also during this time it looks like it reports in the SkyX dome controller that the dome azimuth is 0.0 (zero) when it is not.

There is no way to perform a hard reset of the XBee

This is an issue for @nexdome to review and decide whether there is any feasible hardware remedy.

Problem

The DFRobot Arduino Leonardo with XBee socket leaves the XBee reset pin disconnected. This is OK technically because it has an internal 50K pullup, but it means there's no way for the Arduino to perform a hard reset of the XBee. This is a problem because the XBees sometimes get into a state where they either refuse to associate with another XBee, or refuse to enter command mode so that the firmware is unable to send configuration and the only fix seems to be to power-cycle the system.

As you can see from DFRobot's circuit schematic, the XBee reset pin is left open.
image

According to the XBee data sheet:
image

The /RESET signal is forbidden from being driven high and this is probably why it was left unconnected, since Arduino output pins might drive the signal high after a power-on reset.

However this creates a problem where XBees can sometimes get 'stuck' (despite the firmware issuing a soft reset) and there's no way to recover other than to power off the system, which is quite inconvenient for users.

Questions

Therefore, the questions I would like to raise for discussion are:

  • Would there be any point to connecting up this reset line? Would it in fact let us reset the device?
  • Could it be done in such a way that the Arduino can safely activate it?
  • If so then, would it be practical to modify the electronics to enable this as part of the production process?

ASCOM Driver should warn the user if the firmware major version is higher than expected

I uploaded the 4.0.1 firmware to both my rotator and my shutter. Both reported successful uploads. However now I cannot connect to the dome. I get the attached error message every time I try. The port# is correct. I've tried cycling the power on everything with no success. I also tried reinstalling 4.0.1 and also reverting to 4.0.0 with no success, although firmware is installed correctly according to the message.
I'm stumped. The log just shows a failure to connect. I have no problems installing the firmware.

Auto-close shutter on low battery volts

Requirements

  • When the battery voltage falls below a threshold, the shutter should auto-close

  • While the battery voltage is below the threshold, the shutter should ignore open commands.

  • The toggle switch should always work regardless of battery voltage

  • Auto-close should work regardless of the wireless connection to the rotator

Considerations

  • Different battery chemistries have different voltage discharge curves, so the threshold needs to be user-configurable

  • The default setting should err on the side of closing too soon (safe by default)

  • There is very little available code space and significant optimisation effort might be needed.

  • The ASCOM driver will need to be updated to allow the threshold to be set

  • Other drivers and plugins (X2, INDI) will also need to be updated (communication).

Shutter close sensor does not operate correctly if triggered multiple times

In normal use, we expect to see a single activation of the close sensor and in most domes, this appears to be the case. However there has been at least one case (Sylvain Lefebvre) where the close sensor appears to trigger multiple times, resulting in the close operation not stopping.

The mechanism is not fully understood, but during troubleshooting via Facebook, Sylvain was asked to remove the close sensor magnet and then the shutter did close and stop correctly.

So there is definitely a hardware component to this issue, but there is also a firmware component. When closing the shutter, multiple activations of the close sensor should be idempotent. The firmware needs to be improved in this area.

what is current version (3.2.1?) and is there a .hex for it

I am working from 3.2.1 beta and I am still having problems where the shutter gets dropped if the other controller is turned off.

I have been leaving the dome on but if power blinks or anything goofy happens, I have to go up and reset the shutter.

I saw there is a 3.2.1 firmware folder, but I could only find the rotator .ino files. Is there a compiled/ready to go .hex file for it?

Dave Compton

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.