mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-04-16 22:55:56 -05:00
config: fix number of lights being loaded wrong if config is outdated
This commit is contained in:
parent
be4df516fd
commit
b408cd9687
|
|
@ -105,19 +105,32 @@ int main(int argc, char **argv)
|
|||
eam_io_init(crt_thread_create, crt_thread_join, crt_thread_destroy);
|
||||
eam_io_config_api = eam_io_get_config_api();
|
||||
|
||||
// calculate these and check against the loaded config
|
||||
max_light = -1;
|
||||
|
||||
for (i = 0; i < schema->nlights; i++) {
|
||||
if (max_light < schema->lights[i].bit) {
|
||||
max_light = schema->lights[i].bit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mapper_config_load(schema->name)) {
|
||||
log_info("Initializing empty config for %s", schema->name);
|
||||
|
||||
max_light = -1;
|
||||
|
||||
for (i = 0; i < schema->nlights; i++) {
|
||||
if (max_light < schema->lights[i].bit) {
|
||||
max_light = schema->lights[i].bit;
|
||||
}
|
||||
}
|
||||
|
||||
mapper_set_nlights((uint8_t)(max_light + 1));
|
||||
mapper_set_nanalogs((uint8_t) schema->nanalogs);
|
||||
} else {
|
||||
// make sure that these are right
|
||||
|
||||
if (mapper_get_nlights() != (max_light + 1)) {
|
||||
log_info("Updating nlights for %s", schema->name);
|
||||
mapper_set_nlights((uint8_t)(max_light + 1));
|
||||
}
|
||||
|
||||
if (mapper_get_nanalogs() != schema->nanalogs) {
|
||||
log_info("Updating nanalogs for %s", schema->name);
|
||||
mapper_set_nanalogs((uint8_t) schema->nanalogs);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&psh, 0, sizeof(psh));
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ EXPORTS
|
|||
mapper_get_analog_map
|
||||
mapper_get_analog_sensitivity
|
||||
mapper_get_npages
|
||||
mapper_get_nanalogs
|
||||
mapper_get_nlights
|
||||
mapper_is_analog_absolute
|
||||
mapper_iterate_lights
|
||||
mapper_iterate_actions
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ bool mapper_get_action_map(
|
|||
bool mapper_get_analog_map(uint8_t analog, struct mapped_analog *ma);
|
||||
int32_t mapper_get_analog_sensitivity(uint8_t analog);
|
||||
uint8_t mapper_get_nanalogs(void);
|
||||
uint8_t mapper_get_nlights(void);
|
||||
uint8_t mapper_get_npages(void);
|
||||
bool mapper_is_analog_absolute(uint8_t analog);
|
||||
action_iter_t mapper_iterate_actions(void);
|
||||
|
|
|
|||
|
|
@ -149,6 +149,11 @@ uint8_t mapper_get_nanalogs(void)
|
|||
return mapper_impl_get_nanalogs(mapper_inst);
|
||||
}
|
||||
|
||||
uint8_t mapper_get_nlights(void)
|
||||
{
|
||||
return mapper_impl_get_nlights(mapper_inst);
|
||||
}
|
||||
|
||||
uint8_t mapper_get_npages(void)
|
||||
{
|
||||
return mapper_impl_get_npages(mapper_inst);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user