2.0.2015010405

Working on FEATURE_AUTOCORRECT
This commit is contained in:
Anthony Good 2015-01-04 21:52:10 -05:00
parent 2920f3d324
commit c9fd5ef938
7 changed files with 99 additions and 10 deletions

View File

@ -293,9 +293,11 @@
Rolled FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE_2 into FEATURE_STEPPER_MOTOR
Working on FEATURE_AUTOCORRECT
*/
#define CODE_VERSION "2.0.2015010403"
#define CODE_VERSION "2.0.2015010405"
#include <avr/pgmspace.h>
#include <EEPROM.h>
@ -721,6 +723,17 @@ float elevation_calibration_from[] = ELEVATION_CALIBRATION_FROM_ARRAY;
float elevation_calibration_to[] = ELEVATION_CALIBRATION_TO_ARRAY;
#endif // FEATURE_ELEVATION_CORRECTION
#ifdef FEATURE_AUTOCORRECT
byte autocorrect_state_az = AUTOCORRECT_INACTIVE;
float autocorrect_az = 0;
unsigned long autocorrect_az_submit_time = 0;
#ifdef FEATURE_ELEVATION_CONTROL
byte autocorrect_state_el = AUTOCORRECT_INACTIVE;
float autocorrect_el = 0;
unsigned long autocorrect_el_submit_time = 0;
#endif //FEATURE_ELEVATION_CONTROL
#endif //FEATURE_AUTOCORRECT
/* ------------------ let's start doing some stuff now that we got the formalities out of the way --------------------*/
void setup() {
@ -4828,6 +4841,26 @@ void output_debug(){
//debug_println(service_stepper_motor_pulse_pins_count_temp);
#endif FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE_2
#ifdef FEATURE_AUTOCORRECT
debug_print("\t\Autocorrect: AZ:");
switch(autocorrect_state_az){
case AUTOCORRECT_INACTIVE: debug_print("INACTIVE"); break;
case AUTOCORRECT_WAITING_AZ: debug_print("AUTOCORRECT_WAITING_AZ: "); debug_print_float(autocorrect_az,2); break;
case AUTOCORRECT_WATCHING_AZ: debug_print("AUTOCORRECT_WATCHING_AZ: "); debug_print_float(autocorrect_az,2); break;
}
#ifdef FEATURE_ELEVATION_CONTROL
debug_print(" EL:");
switch(autocorrect_state_el){
case AUTOCORRECT_INACTIVE: debug_print("INACTIVE"); break;
case AUTOCORRECT_WAITING_EL: debug_print("AUTOCORRECT_WAITING_EL: "); debug_print_float(autocorrect_el,2); break;
case AUTOCORRECT_WATCHING_EL: debug_print("AUTOCORRECT_WATCHING_EL: "); debug_print_float(autocorrect_el,2); break;
}
#endif //FEATURE_ELEVATION_CONTROL
#endif //DEBUG_AUTOCORRECT
debug_println("\n\n\n");
//port_flush();
@ -11974,6 +12007,47 @@ void check_moon_pushbutton_calibration(){
}
#endif //defined(FEATURE_MOON_PUSHBUTTON_AZ_EL_CALIBRATION) && defined(FEATURE_MOON_TRACKING)
//-------------------------------------------------------
#ifdef FEATURE_AUTOCORRECT
void submit_autocorrect(byte axis,float heading){
#ifdef DEBUG_AUTOCORRECT
debug_print("submit_autocorrect: ");
#endif //DEBUG_AUTOCORRECT
if (axis == AZ){
autocorrect_state_az = AUTOCORRECT_WATCHING_AZ;
autocorrect_az = heading;
autocorrect_az_submit_time = millis();
#ifdef DEBUG_AUTOCORRECT
debug_print("AZ: ");
#endif //DEBUG_AUTOCORRECT
}
#ifdef FEATURE_ELEVATION_CONTROL
if (axis == EL){
autocorrect_state_el = AUTOCORRECT_WATCHING_EL;
autocorrect_el = heading;
autocorrect_el_submit_time = millis();
#ifdef DEBUG_AUTOCORRECT
debug_print("EL: ");
#endif //DEBUG_AUTOCORRECT
}
#endif //FEATURE_ELEVATION_CONTROL
#ifdef DEBUG_AUTOCORRECT
debug_print_float(heading,2);
debug_println("");
#endif //DEBUG_AUTOCORRECT
}
#endif //FEATURE_AUTOCORRECT
//-------------------------------------------------------
// that's all, folks !

View File

@ -153,5 +153,11 @@
#define ETHERNET_SLAVE_DISCONNECTED 0
#define ETHERNET_SLAVE_CONNECTED 1
#define AUTOCORRECT_INACTIVE 0
#define AUTOCORRECT_WAITING_AZ 1
#define AUTOCORRECT_WAITING_EL 2
#define AUTOCORRECT_WATCHING_AZ 3
#define AUTOCORRECT_WATCHING_EL 4
/* ------end of macros ------- */

View File

@ -6,7 +6,7 @@
*/
/* main features */
#define FEATURE_ELEVATION_CONTROL // uncomment this for AZ/EL rotators
//#define FEATURE_ELEVATION_CONTROL // uncomment this for AZ/EL rotators
#define FEATURE_YAESU_EMULATION // uncomment this for Yaesu GS-232 emulation on control port
//#define FEATURE_EASYCOM_EMULATION // Easycom protocol emulation on control port (undefine FEATURE_YAESU_EMULATION above)
@ -17,7 +17,8 @@
//#define FEATURE_RTC_DS1307
//#define FEATURE_RTC_PCF8583
//#define FEATURE_ETHERNET
#define FEATURE_STEPPER_MOTOR // requires this library: https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation
//#define FEATURE_STEPPER_MOTOR // requires this library: https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation
//#define FEATURE_AUTOCORRECT
#define LANGUAGE_ENGLISH
//#define LANGUAGE_SPANISH
@ -33,7 +34,7 @@
/* position sensors - pick one for azimuth and one for elevation if using an az/el rotator */
//#define FEATURE_AZ_POSITION_POTENTIOMETER //this is used for both a voltage from a rotator control or a homebrew rotator with a potentiometer
#define FEATURE_AZ_POSITION_POTENTIOMETER //this is used for both a voltage from a rotator control or a homebrew rotator with a potentiometer
//#define FEATURE_AZ_POSITION_ROTARY_ENCODER
//#define FEATURE_AZ_POSITION_PULSE_INPUT
//#define FEATURE_AZ_POSITION_HMC5883L // HMC5883L digital compass support
@ -41,9 +42,9 @@
//#define FEATURE_AZ_POSITION_ADAFRUIT_LSM303 // Uncomment for azimuth using LSM303 compass and Adafruit library (https://github.com/adafruit/Adafruit_LSM303) (also uncomment object declaration below)
//#define FEATURE_AZ_POSITION_POLOLU_LSM303 // Uncomment for azimuth using LSM303 compass and Polulu library
//#define FEATURE_AZ_POSITION_HH12_AS5045_SSI
#define FEATURE_AZ_POSITION_INCREMENTAL_ENCODER
//#define FEATURE_AZ_POSITION_INCREMENTAL_ENCODER
//#define FEATURE_EL_POSITION_POTENTIOMETER
#define FEATURE_EL_POSITION_POTENTIOMETER
//#define FEATURE_EL_POSITION_ROTARY_ENCODER
//#define FEATURE_EL_POSITION_PULSE_INPUT
//#define FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB // Uncomment for elevation ADXL345 accelerometer support using ADXL345 library
@ -52,7 +53,7 @@
//#define FEATURE_EL_POSITION_ADAFRUIT_LSM303 // Uncomment for elevation using LSM303 accelerometer and Adafruit library (https://github.com/adafruit/Adafruit_LSM303) (also uncomment object declaration below)
//#define FEATURE_EL_POSITION_POLOLU_LSM303 // Uncomment for elevation using LSM303 compass and Polulu library
//#define FEATURE_EL_POSITION_HH12_AS5045_SSI
#define FEATURE_EL_POSITION_INCREMENTAL_ENCODER
//#define FEATURE_EL_POSITION_INCREMENTAL_ENCODER
//#define FEATURE_EL_POSITION_MEMSIC_2125
//#define FEATURE_4_BIT_LCD_DISPLAY //Uncomment for classic 4 bit LCD display (most common)
@ -194,6 +195,7 @@
// #define DEBUG_HMC5883L
// #define DEBUG_POLOLU_LSM303_CALIBRATION
// #define DEBUG_STEPPER
// #define DEBUG_AUTOCORRECT

View File

@ -18,7 +18,7 @@
//#define FEATURE_RTC_PCF8583
//#define FEATURE_ETHERNET
#define FEATURE_STEPPER_MOTOR // requires this library: https://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation
#define FEATURE_AUTOCORRECT
#define LANGUAGE_ENGLISH
//#define LANGUAGE_SPANISH
@ -194,7 +194,7 @@
// #define DEBUG_HMC5883L
// #define DEBUG_POLOLU_LSM303_CALIBRATION
// #define DEBUG_STEPPER
#define DEBUG_AUTOCORRECT

View File

@ -6,4 +6,4 @@
//#define HARDWARE_M0UPU
//#define HARDWARE_EA4TX_ARS_USB // if using EA4TX ARS USB hardware, customize rotator_features_e4tx_ars_usb.h (not rotator_features.h)
#define HARDWARE_WB6KCN // customize rotator_features_wb6kcn.h, rotators_pins_wb6kcn.h, rotator_settings_wb6kcn.h
//#define HARDWARE_WB6KCN // customize rotator_features_wb6kcn.h, rotators_pins_wb6kcn.h, rotator_settings_wb6kcn.h

View File

@ -493,6 +493,10 @@ You can tweak these, but read the online documentation!
#define POLOLU_LSM_303_MIN_ARRAY {+59, +19, -731}
#define POLOLU_LSM_303_MAX_ARRAY {+909, +491, +14}
#define AUTOCORRECT_TIME_MS_AZ 1000
#define AUTOCORRECT_TIME_MS_EL 1000
/* ---------------------------- object declarations ----------------------------------------------

View File

@ -455,6 +455,9 @@ You can tweak these, but read the online documentation!
#define POLOLU_LSM_303_MIN_ARRAY {+59, +19, -731}
#define POLOLU_LSM_303_MAX_ARRAY {+909, +491, +14}
#define AUTOCORRECT_TIME_MS_AZ 1000
#define AUTOCORRECT_TIME_MS_EL 1000
/* ---------------------------- object declarations ----------------------------------------------