some problems fixed; model isn't tested yet

This commit is contained in:
2025-07-30 17:23:56 +03:00
parent 04ee999159
commit a96682bc12
4 changed files with 21 additions and 15 deletions

View File

@@ -40,11 +40,14 @@ uint16_t SScalcChecksum(uint8_t *buf, int len){
static void axestat(int32_t *prev, int32_t cur, int *nstopped, mnt_status_t *stat){
if(*prev == INT32_MAX){
*stat = MNT_STOPPED;
DBG("START");
}else if(*stat != MNT_STOPPED){
if(*prev == cur){
if(++(*nstopped) > MOTOR_STOPPED_CNT) *stat = MNT_STOPPED;
if(*prev == cur && ++(*nstopped) > MOTOR_STOPPED_CNT){
*stat = MNT_STOPPED;
DBG("AXE stopped");
}
}else if(*prev != cur){
DBG("AXE moving");
//*stat = MNT_SLEWING;
*nstopped = 0;
}
@@ -101,7 +104,7 @@ int SStextcmd(const char *cmd, data_t *answer){
data_t d;
d.buf = (uint8_t*) cmd;
d.len = d.maxlen = strlen(cmd);
DBG("send %zd bytes: %s", d.len, d.buf);
//DBG("send %zd bytes: %s", d.len, d.buf);
return MountWriteRead(&d, answer);
}
@@ -114,7 +117,7 @@ int SSrawcmd(const char *cmd, data_t *answer){
data_t d;
d.buf = (uint8_t*) cmd;
d.len = d.maxlen = strlen(cmd);
DBG("send %zd bytes: %s", d.len, d.buf);
//DBG("send %zd bytes: %s", d.len, d.buf);
return MountWriteReadRaw(&d, answer);
}
@@ -190,7 +193,7 @@ mcc_errcodes_t updateMotorPos(){
DBG("FIX motors position to encoders");
int32_t Xpos = X_RAD2MOT(md.encXposition.val), Ypos = Y_RAD2MOT(md.encYposition.val);
if(SSsetterI(CMD_MOTXSET, Xpos) && SSsetterI(CMD_MOTYSET, Ypos)){
DBG("All OK");
DBG("All OK, Dt=%g", nanotime() - t0);
return MCC_E_OK;
}
}else{