...
This commit is contained in:
parent
a9974aab04
commit
4fcb5af94b
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 15.0.1, 2025-02-20T21:58:21. -->
|
||||
<!-- Written by QtCreator 15.0.1, 2025-02-23T22:39:22. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@ -65,7 +65,7 @@ static mcc_errcodes_t init(conf_t *c){
|
||||
DBG("Bad value of MountReqInterval");
|
||||
ret = MCC_E_BADFORMAT;
|
||||
}
|
||||
char buf[1024];
|
||||
uint8_t buf[1024];
|
||||
data_t d = {.buf = buf, .len = 0, .maxlen = 1024};
|
||||
// read input data as there may be some trash on start
|
||||
if(!SSrawcmd(CMD_EXITACM, &d)) ret = MCC_E_FAILED;
|
||||
|
||||
@ -118,7 +118,7 @@ static void parse_encbuf(uint8_t databuf[ENC_DATALEN], struct timeval *tv){
|
||||
// try to read 1 byte from encoder; return -1 if nothing to read or -2 if device seems to be disconnected
|
||||
static int getencbyte(){
|
||||
if(encfd < 0) return -1;
|
||||
uint8_t byte;
|
||||
uint8_t byte = 0;
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
do{
|
||||
|
||||
@ -18,6 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
@ -55,8 +60,30 @@ typedef struct{
|
||||
} data_t;
|
||||
|
||||
typedef struct{
|
||||
uint8_t XBits;
|
||||
uint8_t YBits;
|
||||
uint8_t motrev :1; // If 1, the motor encoder is incremented in the opposite direction
|
||||
uint8_t motpolarity :1; // If 1, the motor polarity is reversed
|
||||
uint8_t encrev :1; // If 1, the axis encoder is reversed
|
||||
uint8_t dragtrack :1; // If 1, we are in computerless Drag and Track mode
|
||||
uint8_t trackplat :1; // If 1, we are in the tracking platform mode
|
||||
uint8_t handpaden :1; // If 1, hand paddle is enabled
|
||||
uint8_t newpad :1; // If 1, hand paddle is compatible with New hand paddle, which allows slewing in two directions and guiding
|
||||
uint8_t guidemode :1; // If 1, we are in guide mode. The pan rate is added or subtracted from the current tracking rate
|
||||
} xbits_t;
|
||||
|
||||
typedef struct{
|
||||
uint8_t motrev :1; // If 1, the motor encoder is incremented in the opposite direction
|
||||
uint8_t motpolarity :1; // If 1, the motor polarity is reversed
|
||||
uint8_t encrev :1; // If 1, the axis encoder is reversed
|
||||
/* If 1, we are in computerless Slew and Track mode
|
||||
(no clutches; use handpad to slew; must be in Drag and Track mode too) */
|
||||
uint8_t slewtrack :1;
|
||||
uint8_t digin_sens :1; // Digital input from radio handpad receiver, or RA PEC Sensor sync
|
||||
uint8_t digin :3; // Digital input from radio handpad receiver
|
||||
} ybits_t;
|
||||
|
||||
typedef struct{
|
||||
xbits_t XBits;
|
||||
ybits_t YBits;
|
||||
uint8_t ExtraBits;
|
||||
uint16_t ain0;
|
||||
uint16_t ain1;
|
||||
@ -110,3 +137,8 @@ typedef struct{
|
||||
} mount_t;
|
||||
|
||||
extern mount_t Mount;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -23,43 +23,7 @@
|
||||
|
||||
#include "sidservo.h"
|
||||
|
||||
#if 0
|
||||
// ASCII commands
|
||||
#define U8P(x) ((uint8_t*)x)
|
||||
// get binary data of all statistics
|
||||
#define CMD_GETSTAT U8P("XXS")
|
||||
// send short command
|
||||
#define CMD_SHORTCMD U8P("XXR")
|
||||
// send long command
|
||||
#define CMD_LONGCMD U8P("YXR")
|
||||
// get/set X/Y in motsteps
|
||||
#define CMD_MOTX U8P("X")
|
||||
#define CMD_MOTY U8P("Y")
|
||||
// -//- in encoders' ticks
|
||||
#define CMD_ENCX U8P("XZ")
|
||||
#define CMD_ENCY U8P("YZ")
|
||||
// normal stop X/Y
|
||||
#define CMD_STOPX U8P("XN")
|
||||
#define CMD_STOPY U8P("YN")
|
||||
// emergency stop
|
||||
#define CMD_EMSTOPX U8P("XG")
|
||||
#define CMD_EMSTOPY U8P("YG")
|
||||
// getters of motor's encoders per rev
|
||||
#define CMD_GETXMEPR U8P("XXU")
|
||||
#define CMD_GETYMEPR U8P("XXV")
|
||||
// -//- axis encoders
|
||||
#define CMD_GETXAEPR U8P("XXT")
|
||||
#define CMD_GETYAEPR U8P("XXZ")
|
||||
// exit ASCII checksum mode
|
||||
#define CMD_EXITACM U8P("YXY0\r\xb8")
|
||||
#endif
|
||||
|
||||
// get binary data of all statistics
|
||||
#define CMD_GETSTAT "XXS"
|
||||
// send short command
|
||||
#define CMD_SHORTCMD "XXR"
|
||||
// send long command
|
||||
#define CMD_LONGCMD "YXR"
|
||||
/*********** base commands ***********/
|
||||
// get/set X/Y in motsteps
|
||||
#define CMD_MOTX "X"
|
||||
#define CMD_MOTY "Y"
|
||||
@ -111,24 +75,97 @@
|
||||
// normal stop X/Y
|
||||
#define CMD_STOPX "XN"
|
||||
#define CMD_STOPY "YN"
|
||||
// lower speed -> drag&track or slew&track
|
||||
#define CMD_STOPTRACKX "XNT"
|
||||
#define CMD_STOPTRACKY "YNT"
|
||||
// emergency stop
|
||||
#define CMD_EMSTOPX "XG"
|
||||
#define CMD_EMSTOPY "YG"
|
||||
// get/set X/Ybits
|
||||
#define CMD_BITSX "XB"
|
||||
#define CMD_BITSY "YB"
|
||||
// getters of motor's encoders per rev
|
||||
#define CMD_GETXMEPR "XXU"
|
||||
#define CMD_GETYMEPR "XXV"
|
||||
|
||||
/*********** getters/setters without "Y" variant ***********/
|
||||
// get handpad status (decimal)
|
||||
#define CMD_HANDPAD "XK"
|
||||
// get TCPU (deg F)
|
||||
#define CMD_TCPU "XH"
|
||||
// get firmware version *10
|
||||
#define CMD_FIRMVER "XV"
|
||||
// get motor voltage *10
|
||||
#define CMD_MOTVOLTAGE "XJ"
|
||||
// get/set current CPU clock (milliseconds)
|
||||
#define CMD_MILLIS "XY"
|
||||
// reset servo
|
||||
#define CMD_RESET "XQ"
|
||||
// clear to factory defaults
|
||||
#define CMD_CLRDEFAULTS "XU"
|
||||
// save configuration to flash ROM
|
||||
#define CMD_WRITEFLASH "XW"
|
||||
// read config from flash to RAM
|
||||
#define CMD_READFLASH "XT"
|
||||
// write to flash following full config (128 bytes + 2 bytes of checksum)
|
||||
#define CMD_PROGFLASH "FC"
|
||||
// read configuration (-//-)
|
||||
#define CMD_DUMPFLASH "SC"
|
||||
// get serial number
|
||||
#define CMD_SERIAL "YV"
|
||||
|
||||
/*********** extended commands ***********/
|
||||
// get/set latitute
|
||||
#define CMD_LATITUDE "XXL"
|
||||
// getters/setters of motor's encoders per rev
|
||||
#define CMD_MEPRX "XXU"
|
||||
#define CMD_MEPRY "XXV"
|
||||
// -//- axis encoders
|
||||
#define CMD_GETXAEPR "XXT"
|
||||
#define CMD_GETYAEPR "XXZ"
|
||||
#define CMD_AEPRX "XXT"
|
||||
#define CMD_AEPRY "XXZ"
|
||||
// get/set slew rate
|
||||
#define CMD_SLEWRATEX "XXA"
|
||||
#define CMD_SLEWRATEY "XXB"
|
||||
// get/set pan rate
|
||||
#define CMD_PANRATEX "XXC"
|
||||
#define CMD_PANRATEY "XXD"
|
||||
// get/set platform tracking rate
|
||||
#define CMD_PLATRATE "XXE"
|
||||
// get/set platform up/down adjuster
|
||||
#define CMD_PLATADJ "XXF"
|
||||
// get/set platform goal
|
||||
#define CMD_PLATGOAL "XXG"
|
||||
// get/set guide rate
|
||||
#define CMD_GUIDERATEX "XXH"
|
||||
#define CMD_GUIDERATEY "XXI"
|
||||
// get/set picservo timeout (seconds)
|
||||
#define CMD_PICTMOUT "XXJ"
|
||||
// get/set digital outputs of radio handpad
|
||||
#define CMD_RADIODIGOUT "XXQ"
|
||||
// get/set argo navis mode
|
||||
#define CMD_ARGONAVIS "XXN"
|
||||
// get/set local search distance
|
||||
#define CMD_LOSCRCHDISTX "XXM"
|
||||
#define CMD_LOSCRCHDISTY "XXO"
|
||||
// get/set backlash
|
||||
#define CMD_BACKLASHX "XXO"
|
||||
#define CMD_BACKLASHY "XXP"
|
||||
|
||||
|
||||
// get binary data of all statistics
|
||||
#define CMD_GETSTAT "XXS"
|
||||
// send short command
|
||||
#define CMD_SHORTCMD "XXR"
|
||||
// send long command
|
||||
#define CMD_LONGCMD "YXR"
|
||||
|
||||
|
||||
/*********** special ***********/
|
||||
// exit ASCII checksum mode
|
||||
#define CMD_EXITACM "YXY0\r\xb8"
|
||||
// controller status:
|
||||
// X# Y# XZ# YZ# XC# YC# V# T# X[AM] Y[AM] K#
|
||||
// X,Y - motor, XZ,YZ - encoder, XC,YC - current*100, V - voltage*10, T - temp (F), XA,YA - mode (A[uto]/M[anual]), K - handpad status bits
|
||||
#define CMD_GETSTAT "\r"
|
||||
#define CMD_GETSTATTEXT "\r"
|
||||
|
||||
|
||||
|
||||
// steps per revolution
|
||||
//#define X_MOT_STEPSPERREV (3325440.)
|
||||
@ -164,29 +201,6 @@
|
||||
#define XencTOL (25.)
|
||||
|
||||
|
||||
typedef struct{
|
||||
uint8_t motrev :1; // If 1, the motor encoder is incremented in the opposite direction
|
||||
uint8_t motpolarity :1; // If 1, the motor polarity is reversed
|
||||
uint8_t encrev :1; // If 1, the axis encoder is reversed
|
||||
uint8_t dragtrack :1; // If 1, we are in computerless Drag and Track mode
|
||||
uint8_t trackplat :1; // If 1, we are in the tracking platform mode
|
||||
uint8_t handpaden :1; // If 1, hand paddle is enabled
|
||||
uint8_t newpad :1; // If 1, hand paddle is compatible with New hand paddle, which allows slewing in two directions and guiding
|
||||
uint8_t guidemode :1; // If 1, we are in guide mode. The pan rate is added or subtracted from the current tracking rate
|
||||
} xbits_t;
|
||||
|
||||
typedef struct{
|
||||
uint8_t motrev :1; // If 1, the motor encoder is incremented in the opposite direction
|
||||
uint8_t motpolarity :1; // If 1, the motor polarity is reversed
|
||||
uint8_t encrev :1; // If 1, the axis encoder is reversed
|
||||
/* If 1, we are in computerless Slew and Track mode
|
||||
(no clutches; use handpad to slew; must be in Drag and Track mode too) */
|
||||
uint8_t slewtrack :1;
|
||||
uint8_t digin_sens :1; // Digital input from radio handpad receiver, or RA PEC Sensor sync
|
||||
uint8_t digin :3; // Digital input from radio handpad receiver
|
||||
} ybits_t;
|
||||
|
||||
|
||||
// all need data in one
|
||||
typedef struct{ // 41 bytes
|
||||
uint8_t ctrlAddr; // 0 a8 + controller address
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user