add dumpswing, fix bug with uint32 instead of int32
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include "simpleconv.h"
|
||||
#include "traectories.h"
|
||||
|
||||
static traectory_fn *cur_traectory = NULL;
|
||||
static traectory_fn cur_traectory = NULL;
|
||||
// starting point of traectory
|
||||
static coords_t XYstart = {0};
|
||||
static double tstart = 0.;
|
||||
@@ -41,11 +41,11 @@ static coords_t XYcor = {0};
|
||||
* @param XY0 - starting point
|
||||
* @return FALSE if failed
|
||||
*/
|
||||
int init_traectory(traectory_fn *f, coords_t *XY0){
|
||||
int init_traectory(traectory_fn f, coords_t *XY0){
|
||||
if(!f || !XY0) return FALSE;
|
||||
cur_traectory = f;
|
||||
XYstart = *XY0;
|
||||
tstart = cl_dtime();
|
||||
tstart = sl_dtime();
|
||||
mountdata_t mdata;
|
||||
int ntries = 0;
|
||||
for(; ntries < 10; ++ntries){
|
||||
@@ -71,7 +71,7 @@ int traectory_point(coords_t *nextpt, double t){
|
||||
pt.msrtime.tv_sec = floor(t);
|
||||
pt.msrtime.tv_usec = (uint32_t) t - pt.msrtime.tv_sec;
|
||||
if(nextpt) *nextpt = pt;
|
||||
if(pt.X < -M_PI2 || pt.X > M_PI2 || pt.Y < -M_PI || pt.Y > M_PI) return FALSE;
|
||||
if(pt.X < -M_PI_2 || pt.X > M_PI_2 || pt.Y < -M_PI || pt.Y > M_PI) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ int SinCos(coords_t *nextpt, double t){
|
||||
}
|
||||
|
||||
typedef struct{
|
||||
traectory_fn *f;
|
||||
traectory_fn f;
|
||||
const char *name;
|
||||
const char *help;
|
||||
} tr_names;
|
||||
@@ -122,8 +122,8 @@ static tr_names names[] = {
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
traectory_fn *traectory_by_name(const char *name){
|
||||
traectory_fn *f = NULL;
|
||||
traectory_fn traectory_by_name(const char *name){
|
||||
traectory_fn f = NULL;
|
||||
for(int i = 0; ; ++i){
|
||||
if(!names[i].f) break;
|
||||
if(strcmp(names[i].name, name) == 0){
|
||||
@@ -131,6 +131,7 @@ traectory_fn *traectory_by_name(const char *name){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
// print all acceptable traectories names with help
|
||||
|
||||
Reference in New Issue
Block a user