added global refresh rate -f

This commit is contained in:
Paul Dino Jones 2025-01-17 10:29:27 -05:00
parent 44274084d3
commit 83e92391f4
5 changed files with 14 additions and 2 deletions

View File

@ -513,7 +513,9 @@ void datacheckcallback(uv_timer_t* handle)
} }
else else
{ {
uv_timer_start(&datamaptimer, shmdatamapcallback, 2000, 16); int interval = 1000 / f->ms->fps;
slogd("starting telemetry mapping at %i fps (%i ms ticks)", f->ms->fps, interval);
uv_timer_start(&datamaptimer, shmdatamapcallback, 2000, interval);
} }
uv_timer_stop(handle); uv_timer_stop(handle);
} }

View File

@ -127,6 +127,7 @@ typedef struct
int configcheck; int configcheck;
int useconfig; int useconfig;
int verbosity_count; int verbosity_count;
int fps;
bool force_udp_mode; bool force_udp_mode;
char* tyre_diameter_config; char* tyre_diameter_config;
char* config_str; char* config_str;

View File

@ -44,6 +44,7 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
p->program_action = 0; p->program_action = 0;
p->max_revs = 0; p->max_revs = 0;
p->verbosity_count = 0; p->verbosity_count = 0;
p->fps = 60;
p->udp = false; p->udp = false;
@ -63,10 +64,11 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
struct arg_file* arg_conf = arg_filen(NULL, "uiconf", "<config_file>", 0, 1, NULL); struct arg_file* arg_conf = arg_filen(NULL, "uiconf", "<config_file>", 0, 1, NULL);
struct arg_file* arg_log = arg_filen("l", "log", "<log_file>", 0, 1, NULL); struct arg_file* arg_log = arg_filen("l", "log", "<log_file>", 0, 1, NULL);
struct arg_str* arg_confdir = arg_strn(NULL, "configdir", "config_dir>", 0, 1, NULL); struct arg_str* arg_confdir = arg_strn(NULL, "configdir", "config_dir>", 0, 1, NULL);
struct arg_int* arg_fps = arg_int0("f", "fps", "fps", "main data refresh rate");
struct arg_lit* help = arg_litn(NULL,"help", 0, 1, "print this help and exit"); struct arg_lit* help = arg_litn(NULL,"help", 0, 1, "print this help and exit");
struct arg_lit* vers = arg_litn(NULL,"version", 0, 1, "print version information and exit"); struct arg_lit* vers = arg_litn(NULL,"version", 0, 1, "print version information and exit");
struct arg_end* end1 = arg_end(20); struct arg_end* end1 = arg_end(20);
void* argtable1[] = {cmd1,arg_log,arg_conf,arg_udp,arg_verbosity1,help,vers,end1}; void* argtable1[] = {cmd1,arg_log,arg_conf,arg_fps,arg_udp,arg_verbosity1,help,vers,end1};
int nerrors1; int nerrors1;
struct arg_rex* cmd2a = arg_rex1(NULL, NULL, "config", NULL, REG_ICASE, NULL); struct arg_rex* cmd2a = arg_rex1(NULL, NULL, "config", NULL, REG_ICASE, NULL);
@ -130,6 +132,10 @@ ConfigError getParameters(int argc, char** argv, Parameters* p)
{ {
p->udp = true; p->udp = true;
} }
if(arg_fps->count > 0)
{
p->fps = arg_fps->ival[0];
}
if(arg_log->count > 0) if(arg_log->count > 0)
{ {
char* filename = strdup(arg_log->filename[0]); char* filename = strdup(arg_log->filename[0]);

View File

@ -9,6 +9,7 @@ typedef struct
int program_action; int program_action;
const char* sim_string; const char* sim_string;
const char* save_file; const char* save_file;
int fps;
int max_revs; int max_revs;
int granularity; int granularity;
int verbosity_count; int verbosity_count;

View File

@ -56,6 +56,8 @@ void SetSettingsFromParameters(Parameters* p, MonocoqueSettings* ms, char* confi
ms->log_filename_str = strdup("monocoque.log"); ms->log_filename_str = strdup("monocoque.log");
} }
ms->fps = p->fps;
ms->verbosity_count = p->verbosity_count; ms->verbosity_count = p->verbosity_count;
ms->program_action = A_TEST; ms->program_action = A_TEST;
if (p->program_action == A_PLAY) if (p->program_action == A_PLAY)