auto-sync
This commit is contained in:
parent
328b13f751
commit
ec227747c9
|
@ -202,7 +202,6 @@ static void onEvenyGeneralMilliseconds(Engine *engine) {
|
||||||
|
|
||||||
runFsio();
|
runFsio();
|
||||||
|
|
||||||
|
|
||||||
updateErrorCodes();
|
updateErrorCodes();
|
||||||
|
|
||||||
// todo: migrate this to flex logic
|
// todo: migrate this to flex logic
|
||||||
|
@ -269,20 +268,27 @@ static void printAnalogInfo(void) {
|
||||||
|
|
||||||
static THD_WORKING_AREA(csThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread stack
|
static THD_WORKING_AREA(csThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread stack
|
||||||
|
|
||||||
|
#define isOutOfBounds(offset) ((offset<0) || (offset) >= sizeof(engine_configuration_s))
|
||||||
|
|
||||||
static void setInt(const int offset, const int value) {
|
static void setInt(const int offset, const int value) {
|
||||||
|
if (isOutOfBounds(offset))
|
||||||
|
return;
|
||||||
int *ptr = (int *) (&((char *) engine->engineConfiguration)[offset]);
|
int *ptr = (int *) (&((char *) engine->engineConfiguration)[offset]);
|
||||||
*ptr = value;
|
*ptr = value;
|
||||||
scheduleMsg(&logger, "setting int @%d to %d", offset, value);
|
scheduleMsg(&logger, "setting int @%d to %d", offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getInt(int offset) {
|
static void getInt(int offset) {
|
||||||
|
if (isOutOfBounds(offset))
|
||||||
|
return;
|
||||||
int *ptr = (int *) (&((char *) engine->engineConfiguration)[offset]);
|
int *ptr = (int *) (&((char *) engine->engineConfiguration)[offset]);
|
||||||
int value = *ptr;
|
int value = *ptr;
|
||||||
scheduleMsg(&logger, "int @%d is %d", offset, value);
|
scheduleMsg(&logger, "int @%d is %d", offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getFloat(int offset) {
|
static void getFloat(int offset) {
|
||||||
|
if (isOutOfBounds(offset))
|
||||||
|
return;
|
||||||
float *ptr = (float *) (&((char *) engine->engineConfiguration)[offset]);
|
float *ptr = (float *) (&((char *) engine->engineConfiguration)[offset]);
|
||||||
float value = *ptr;
|
float value = *ptr;
|
||||||
scheduleMsg(&logger, "float @%d is %f", offset, value);
|
scheduleMsg(&logger, "float @%d is %f", offset, value);
|
||||||
|
@ -294,6 +300,8 @@ static void setFloat(const char *offsetStr, const char *valueStr) {
|
||||||
scheduleMsg(&logger, "invalid offset [%s]", offsetStr);
|
scheduleMsg(&logger, "invalid offset [%s]", offsetStr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isOutOfBounds(offset))
|
||||||
|
return;
|
||||||
float value = atoff(valueStr);
|
float value = atoff(valueStr);
|
||||||
if (cisnan(value)) {
|
if (cisnan(value)) {
|
||||||
scheduleMsg(&logger, "invalid value [%s]", valueStr);
|
scheduleMsg(&logger, "invalid value [%s]", valueStr);
|
||||||
|
|
Loading…
Reference in New Issue