Skip to content

Commit

Permalink
Nine star align on Teensy3.5/3.6 & ESP32
Browse files Browse the repository at this point in the history
  • Loading branch information
hjd1964 committed Oct 29, 2018
1 parent 3c7a32b commit 6383bb2
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 45 deletions.
39 changes: 21 additions & 18 deletions AlignEq.ino
Original file line number Diff line number Diff line change
Expand Up @@ -281,35 +281,38 @@ void TGeoAlign::autoModel(int n) {
Ff=0; Df=1;
#endif

// only search for cone error if > 2 stars
int Do=0; if (num>2) Do=1;

// search, this can handle about 9 degrees of polar misalignment, and 4 degrees of cone error
// DoPdPzPeTfFf Df OdOh
do_search(16384,0,0,1,1,0, 0, 0,1,1);
do_search( 8192,1,0,1,1,0, 0, 0,1,1);
do_search( 4096,1,0,1,1,0, 0, 0,1,1);
do_search( 2048,1,0,1,1,0, 0, 0,1,1);
do_search( 1024,1,0,1,1,0, 0, 0,1,1);
do_search( 512,1,0,1,1,0, 0, 0,1,1);
do_search(16384,0 ,0,1,1,0, 0, 0,1,1);
do_search( 8192,Do,0,1,1,0, 0, 0,1,1);
do_search( 4096,Do,0,1,1,0, 0, 0,1,1);
do_search( 2048,Do,0,1,1,0, 0, 0,1,1);
do_search( 1024,Do,0,1,1,0, 0, 0,1,1);
do_search( 512,Do,0,1,1,0, 0, 0,1,1);
#ifdef HAL_SLOW_PROCESSOR
// DoPdPzPeTfFf Df OdOh
do_search( 256,1,0,1,1,0, 0, 0,1,1);
do_search( 128,1,0,1,1,0, 0, 0,1,1);
do_search( 256,Do,0,1,1,0, 0, 0,1,1);
do_search( 128,Do,0,1,1,0, 0, 0,1,1);
#else
if (num>4) {
// DoPdPzPeTfFf Df OdOh
do_search( 256,1,1,1,1,0,Ff,Df,1,1);
do_search( 128,1,1,1,1,1,Ff,Df,1,1);
do_search( 64,1,1,1,1,1,Ff,Df,1,1);
do_search( 256,Do,1,1,1,0,Ff,Df,1,1);
do_search( 128,Do,1,1,1,1,Ff,Df,1,1);
do_search( 64,Do,1,1,1,1,Ff,Df,1,1);
#ifdef HAL_FAST_PROCESSOR
do_search( 32,1,1,1,1,1,Ff,Df,1,1);
do_search( 16,1,1,1,1,1,Ff,Df,1,1);
do_search( 32,Do,1,1,1,1,Ff,Df,1,1);
do_search( 16,Do,1,1,1,1,Ff,Df,1,1);
#endif
} else {
do_search( 256,1,0,1,1,0, 0, 0,1,1);
do_search( 128,1,0,1,1,0, 0, 0,1,1);
do_search( 64,1,0,1,1,0, 0, 0,1,1);
do_search( 32,1,0,1,1,0, 0, 0,1,1);
do_search( 256,Do,0,1,1,0, 0, 0,1,1);
do_search( 128,Do,0,1,1,0, 0, 0,1,1);
do_search( 64,Do,0,1,1,0, 0, 0,1,1);
do_search( 32,Do,0,1,1,0, 0, 0,1,1);
#ifdef HAL_FAST_PROCESSOR
do_search( 16,1,0,1,1,0, 0, 0,1,1);
do_search( 16,Do,0,1,1,0, 0, 0,1,1);
#endif
}
#endif
Expand Down
39 changes: 21 additions & 18 deletions AlignHor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -291,36 +291,39 @@ void TGeoAlignH::autoModel(int n) {

// these don't apply for Alt/Az
Ff=0; Df=0;

// only search for cone error if > 2 stars
int Do=0; if (num>2) Do=1;

// search, this can handle about 9 degrees of polar misalignment, and 4 degrees of cone error
// DoPdPzPeTfFf Df OdOh
do_search(16384,0,0,1,1,0, 0, 0,1,1);
do_search( 8192,1,0,1,1,0, 0, 0,1,1);
do_search( 4096,1,0,1,1,0, 0, 0,1,1);
do_search( 2048,1,0,1,1,0, 0, 0,1,1);
do_search( 1024,1,0,1,1,0, 0, 0,1,1);
do_search( 512,1,0,1,1,0, 0, 0,1,1);
do_search(16384,0 ,0,1,1,0, 0, 0,1,1);
do_search( 8192,Do,0,1,1,0, 0, 0,1,1);
do_search( 4096,Do,0,1,1,0, 0, 0,1,1);
do_search( 2048,Do,0,1,1,0, 0, 0,1,1);
do_search( 1024,Do,0,1,1,0, 0, 0,1,1);
do_search( 512,Do,0,1,1,0, 0, 0,1,1);
#ifdef HAL_SLOW_PROCESSOR
// DoPdPzPeTfFf Df OdOh
do_search( 256,1,0,1,1,0, 0, 0,1,1);
do_search( 128,1,0,1,1,0, 0, 0,1,1);
do_search( 256,Do,0,1,1,0, 0, 0,1,1);
do_search( 128,Do,0,1,1,0, 0, 0,1,1);
#else
if (num>4) {
// DoPdPzPeTfFf Df OdOh
do_search( 256,1,1,1,1,0,Ff,Df,1,1);
do_search( 128,1,1,1,1,1,Ff,Df,1,1);
do_search( 64,1,1,1,1,1,Ff,Df,1,1);
do_search( 256,Do,1,1,1,0,Ff,Df,1,1);
do_search( 128,Do,1,1,1,1,Ff,Df,1,1);
do_search( 64,Do,1,1,1,1,Ff,Df,1,1);
#ifdef HAL_FAST_PROCESSOR
do_search( 32,1,1,1,1,1,Ff,Df,1,1);
do_search( 16,1,1,1,1,1,Ff,Df,1,1);
do_search( 32,Do,1,1,1,1,Ff,Df,1,1);
do_search( 16,Do,1,1,1,1,Ff,Df,1,1);
#endif
} else {
do_search( 256,1,0,1,1,0, 0, 0,1,1);
do_search( 128,1,0,1,1,0, 0, 0,1,1);
do_search( 64,1,0,1,1,0, 0, 0,1,1);
do_search( 32,1,0,1,1,0, 0, 0,1,1);
do_search( 256,Do,0,1,1,0, 0, 0,1,1);
do_search( 128,Do,0,1,1,0, 0, 0,1,1);
do_search( 64,Do,0,1,1,0, 0, 0,1,1);
do_search( 32,Do,0,1,1,0, 0, 0,1,1);
#ifdef HAL_FAST_PROCESSOR
do_search( 16,1,0,1,1,0, 0, 0,1,1);
do_search( 16,Do,0,1,1,0, 0, 0,1,1);
#endif
}
#endif
Expand Down
29 changes: 20 additions & 9 deletions Validate.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,26 @@
#endif

// figure out how many align star are allowed for the configuration
#if defined(MOUNT_TYPE_GEM)
#define MAX_NUM_ALIGN_STARS '6'
#elif defined(MOUNT_TYPE_FORK)
#define MAX_NUM_ALIGN_STARS '6'
#elif defined(MOUNT_TYPE_FORK_ALT)
#define MAX_NUM_ALIGN_STARS '6'
#elif defined(MOUNT_TYPE_ALTAZM)
#define MAX_NUM_ALIGN_STARS '6'
#if defined(HAL_FAST_PROCESSOR)
#if defined(MOUNT_TYPE_GEM)
#define MAX_NUM_ALIGN_STARS '9'
#elif defined(MOUNT_TYPE_FORK)
#define MAX_NUM_ALIGN_STARS '9'
#elif defined(MOUNT_TYPE_FORK_ALT)
#define MAX_NUM_ALIGN_STARS '9'
#elif defined(MOUNT_TYPE_ALTAZM)
#define MAX_NUM_ALIGN_STARS '9'
#endif
#else
#if defined(MOUNT_TYPE_GEM)
#define MAX_NUM_ALIGN_STARS '6'
#elif defined(MOUNT_TYPE_FORK)
#define MAX_NUM_ALIGN_STARS '6'
#elif defined(MOUNT_TYPE_FORK_ALT)
#define MAX_NUM_ALIGN_STARS '6'
#elif defined(MOUNT_TYPE_ALTAZM)
#define MAX_NUM_ALIGN_STARS '6'
#endif
#endif

// make both enable and disable values
Expand Down Expand Up @@ -348,7 +360,6 @@
#warning "Configuration: AXIS1_MICROSTEPS; This mode is supported in spreadCycle but without 256x interpolation: it's usually best to hard-wire the TMC2100 and use: _OFF here"
#elif AXIS1_DRIVER_MODEL == TMC2130
#define MODE_SWITCH_BEFORE_SLEW_SPI
#define MODE_SWITCH_SLEEP_ON
#if AXIS1_MICROSTEPS!=1 && AXIS1_MICROSTEPS!=2 && AXIS1_MICROSTEPS!=4 && AXIS1_MICROSTEPS!=8 && AXIS1_MICROSTEPS!=16 && AXIS1_MICROSTEPS!=32 && AXIS1_MICROSTEPS!=64 && AXIS1_MICROSTEPS!=128 && AXIS1_MICROSTEPS!=256
#error "Configuration: AXIS1_MICROSTEPS; TMC2130 invalid micro-step mode, use: 256,128,64,32,16,8,4,2,or 1"
#endif
Expand Down

0 comments on commit 6383bb2

Please sign in to comment.