2021.10.19.01

Increment Encoder Sensors: Attempt to get large EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV working correctly
This commit is contained in:
Anthony Good 2021-10-18 20:14:22 -04:00
parent 417f512eb9
commit 32ae1f1e0d
3 changed files with 20 additions and 32 deletions

View File

@ -1042,6 +1042,9 @@
2021.10.17.01
FEATURE_SATELLITE_TRACKING: I *believe* I fixed the issue with satellite tracking using DEFAULT_LATITUDE and DEFAULT_LONGITUDE rather than GPS-derived coordinates
2021.10.19.01
Increment Encoder Sensors: Attempt to get large EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV working correctly
All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc.
Anything rotator_*.* should be in the ino directory!
@ -1055,7 +1058,7 @@
*/
#define CODE_VERSION "2021.10.17.01"
#define CODE_VERSION "2021.10.19.01"
#include <avr/pgmspace.h>
@ -1740,7 +1743,6 @@ struct config_t {
byte service_calc_satellite_data_task;
Satellite sat;
//Observer obs("", DEFAULT_LATITUDE, DEFAULT_LONGITUDE, DEFAULT_ALTITUDE_M); //qqqqqq
SatDateTime sat_datetime;
struct satellite_list{
@ -9246,11 +9248,6 @@ void output_debug(){
#endif //OPTION_USE_OLD_TIME_CODE
// debug.print(F(" LA: ")); //qqqqq
// debug.print(obs.LA);
// debug.print(F(" LO: "));
// debug.print(obs.LO);
debug.print(F(" In Sat Calc Timeout: "));
for (int x = 0;x < SATELLITE_LIST_LENGTH;x++){
@ -9700,7 +9697,7 @@ void read_elevation(byte force_read){
#ifdef FEATURE_EL_POSITION_INCREMENTAL_ENCODER
elevation = ((((el_incremental_encoder_position) / (EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0));
elevation = ((((el_incremental_encoder_position) / (EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0));
#ifdef FEATURE_ELEVATION_CORRECTION
elevation = correct_elevation(elevation);
#endif // FEATURE_ELEVATION_CORRECTION
@ -13549,16 +13546,17 @@ void el_position_incremental_encoder_interrupt_handler(){
}
#ifndef OPTION_SCANCON_2RMHF3600_INC_ENCODER
if ((current_phase_a == LOW) && (current_phase_b == LOW) && (current_phase_z == LOW)) {
el_incremental_encoder_position = EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION;
} else {
if (el_incremental_encoder_position < 0) {
el_incremental_encoder_position = ((EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.) - 1);
el_incremental_encoder_position = (long(EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.) - 1L);
}
if (el_incremental_encoder_position >= (EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) {
if (el_incremental_encoder_position >= long(EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) {
el_incremental_encoder_position = 0;
}
@ -13568,14 +13566,17 @@ void el_position_incremental_encoder_interrupt_handler(){
el_incremental_encoder_position = EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION;
} else {
if (el_incremental_encoder_position < 0) {
el_incremental_encoder_position = ((EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.) - 1);
el_incremental_encoder_position = (long(EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L) - 1L);
}
if (el_incremental_encoder_position >= (EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) {
if (el_incremental_encoder_position >= long(EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) {
el_incremental_encoder_position = 0;
}
}
#endif //OPTION_SCANCON_2RMHF3600_INC_ENCODER
el_3_phase_encoder_last_phase_a_state = current_phase_a;
el_3_phase_encoder_last_phase_b_state = current_phase_b;
@ -16929,15 +16930,6 @@ Not implemented yet:
control_port->print(F("Satellite:"));
control_port->println(configuration.current_satellite);
// control_port->print(F("Location:"));
//control_port->print(obs.name);
//control_port->print(" (");
// control_port->print(obs.LA,4); //qqqqqq
// control_port->print(",");
// control_port->print(obs.LO,4);
// control_port->print(F(" "));
// control_port->print(obs.HT,0);
// control_port->println(F("m"));
control_port->print(F("AZ:"));
control_port->print(current_satellite_azimuth,DISPLAY_DECIMAL_PLACES);
control_port->print(F(" EL:"));
@ -20217,12 +20209,7 @@ void convert_polar_to_cartesian(byte coordinate_conversion,double azimuth_in,dou
byte pull_result = 0;
// obs.LA = latitude; //qqqqqq
// obs.LO = longitude;
// obs.HT = altitude_m;
Observer obs("",latitude,longitude,altitude_m); //qqqqqq
Observer obs("",latitude,longitude,altitude_m);
if (service_action == SERVICE_CALC_REPORT_STATE){return service_calc_satellite_data_service_state;}

View File

@ -84,7 +84,7 @@
// #define FEATURE_MIDAS_I2C_DISPLAY
// #define FEATURE_FABO_LCD_PCF8574_DISPLAY
#define FEATURE_NEXTION_DISPLAY // Documentation: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display
// #define FEATURE_NEXTION_DISPLAY // Documentation: https://github.com/k3ng/k3ng_rotator_controller/wiki/425-Human-Interface:-Nextion-Display
// #define FEATURE_ANALOG_OUTPUT_PINS
@ -192,3 +192,4 @@
#define OPTION_GPS_USE_TINY_GPS_LIBRARY // For serial port based NMEA GPS units; serial port defined by GPS_PORT and GPS_PORT_BAUD_RATE in settings file
// #define OPTION_GPS_USE_SPARKFUN_U_BLOX_GNSS_LIBRARY // For Sparkfun (and perhaps others) u-blox GPS units interfaced via I2C ( https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library)

View File

@ -107,8 +107,8 @@ You can tweak these, but read the online documentation!
#define ENCODER_PRESET_TIMEOUT 5000
// various code settings
#define AZIMUTH_TOLERANCE 0.1 // rotator will stop within X degrees when doing autorotation
#define ELEVATION_TOLERANCE 0.1 //1.0
#define AZIMUTH_TOLERANCE 0.01 // rotator will stop within X degrees when doing autorotation
#define ELEVATION_TOLERANCE 0.01 //1.0
#define OPERATION_TIMEOUT 120000 // timeout for any rotation operation in mS ; 120 seconds is usually enough unless you have the speed turned down
#define TIMED_INTERVAL_ARRAY_SIZE 20
@ -185,8 +185,8 @@ You can tweak these, but read the online documentation!
#define ROTATION_INDICATOR_PIN_TIME_DELAY_SECONDS 0
#define ROTATION_INDICATOR_PIN_TIME_DELAY_MINUTES 0
#define AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000.0
#define EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000.0
#define AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000L //2000.0
#define EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000L //2000.0
#define AZ_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION 0 // can be 0 to 4 x AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV
#define EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION 0 // can be 0 to 4 x EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV