add PID (not tested yet)
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "movingmodel.h"
|
||||
#include "serial.h"
|
||||
#include "ssii.h"
|
||||
#include "PID.h"
|
||||
|
||||
conf_t Conf = {0};
|
||||
// parameters for model
|
||||
@@ -209,17 +210,18 @@ static int chkYs(double s){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
static mcc_errcodes_t slew2(const coordpair_t *target, slewflags_t flags){
|
||||
(void)target;
|
||||
(void)flags;
|
||||
//if(Conf.RunModel) return ... ;
|
||||
if(MCC_E_OK != updateMotorPos()) return MCC_E_FAILED;
|
||||
//...
|
||||
setStat(MNT_SLEWING, MNT_SLEWING);
|
||||
setStat(AXIS_SLEWING, AXIS_SLEWING);
|
||||
//...
|
||||
return MCC_E_FAILED;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief move2 - simple move to given point and stop
|
||||
@@ -239,7 +241,7 @@ static mcc_errcodes_t move2(const coordpair_t *target){
|
||||
cmd.Yspeed = MCC_MAX_Y_SPEED;
|
||||
mcc_errcodes_t r = shortcmd(&cmd);
|
||||
if(r != MCC_E_OK) return r;
|
||||
setStat(MNT_SLEWING, MNT_SLEWING);
|
||||
setStat(AXIS_SLEWING, AXIS_SLEWING);
|
||||
return MCC_E_OK;
|
||||
}
|
||||
|
||||
@@ -269,14 +271,6 @@ static mcc_errcodes_t move2s(const coordpair_t *target, const coordpair_t *speed
|
||||
if(!target || !speed) return MCC_E_BADFORMAT;
|
||||
if(!chkX(target->X) || !chkY(target->Y)) return MCC_E_BADFORMAT;
|
||||
if(!chkXs(speed->X) || !chkYs(speed->Y)) return MCC_E_BADFORMAT;
|
||||
/* if(Conf.RunModel){
|
||||
double curt = nanotime();
|
||||
moveparam_t param = {0};
|
||||
param.coord = target->X; param.speed = speed->X;
|
||||
if(!model_move2(Xmodel, ¶m, curt)) return MCC_E_FAILED;
|
||||
param.coord = target->Y; param.speed = speed->Y;
|
||||
if(!model_move2(Ymodel, ¶m, curt)) return MCC_E_FAILED;
|
||||
}*/
|
||||
if(MCC_E_OK != updateMotorPos()) return MCC_E_FAILED;
|
||||
short_command_t cmd = {0};
|
||||
cmd.Xmot = target->X;
|
||||
@@ -285,7 +279,7 @@ static mcc_errcodes_t move2s(const coordpair_t *target, const coordpair_t *speed
|
||||
cmd.Yspeed = speed->Y;
|
||||
mcc_errcodes_t r = shortcmd(&cmd);
|
||||
if(r != MCC_E_OK) return r;
|
||||
setStat(MNT_SLEWING, MNT_SLEWING);
|
||||
setStat(AXIS_SLEWING, AXIS_SLEWING);
|
||||
return MCC_E_OK;
|
||||
}
|
||||
|
||||
@@ -501,7 +495,7 @@ mount_t Mount = {
|
||||
.init = init,
|
||||
.quit = quit,
|
||||
.getMountData = getMD,
|
||||
.slewTo = slew2,
|
||||
// .slewTo = slew2,
|
||||
.moveTo = move2,
|
||||
.moveWspeed = move2s,
|
||||
.setSpeed = setspeed,
|
||||
@@ -512,5 +506,6 @@ mount_t Mount = {
|
||||
.getHWconfig = get_hwconf,
|
||||
.saveHWconfig = write_hwconf,
|
||||
.currentT = nanotime,
|
||||
.correctTo = correct2,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user