This commit is contained in:
Edward Emelianov 2025-11-01 19:54:18 +03:00
parent 2aa8502796
commit 2e9241f079
3 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,7 @@
Dramp.c Dramp.c
Dramp.h Dramp.h
PID.c
PID.h
Sramp.c Sramp.c
Sramp.h Sramp.h
Tramp.c Tramp.c

View File

@ -91,6 +91,7 @@ int main(int _U_ argc, char _U_ **argv){
if(MCC_E_OK != Mount.init(Config)) ERRX("Can't init mount"); if(MCC_E_OK != Mount.init(Config)) ERRX("Can't init mount");
coordval_pair_t M, E; coordval_pair_t M, E;
if(!getPos(&M, &E)) ERRX("Can't get current position"); if(!getPos(&M, &E)) ERRX("Can't get current position");
printf("Current time: %.10f\n", Mount.currentT());
DBG("xt: %g, x: %g", M.X.t, M.X.val); DBG("xt: %g, x: %g", M.X.t, M.X.val);
if(G.coordsoutput){ if(G.coordsoutput){
if(!G.wait) green("When logging I should wait until moving ends; added '-w'\n"); if(!G.wait) green("When logging I should wait until moving ends; added '-w'\n");

View File

@ -51,18 +51,16 @@ static mcc_errcodes_t shortcmd(short_command_t *cmd);
* @return time in seconds * @return time in seconds
*/ */
double nanotime(){ double nanotime(){
//static struct timespec *start = NULL; static double t0 = -1.;
struct timespec now; struct timespec now;
/*if(!start){
start = malloc(sizeof(struct timespec));
if(!start) return -1.;
if(clock_gettime(CLOCK_MONOTONIC, start)) return -1.;
}*/
if(clock_gettime(CLOCK_MONOTONIC, &now)) return -1.; if(clock_gettime(CLOCK_MONOTONIC, &now)) return -1.;
/*double nd = ((double)now.tv_nsec - (double)start->tv_nsec) * 1e-9; if(t0 < 0.){
double sd = (double)now.tv_sec - (double)start->tv_sec; struct timespec start;
return sd + nd;*/ if(clock_gettime(CLOCK_REALTIME, &start)) return -1.;
return (double)now.tv_sec + (double)now.tv_nsec * 1e-9; t0 = (double)start.tv_sec + (double)start.tv_nsec * 1e-9
- (double)now.tv_sec + (double)now.tv_nsec * 1e-9;
}
return (double)now.tv_sec + (double)now.tv_nsec * 1e-9 + t0;
} }
/** /**