Skip to content

Commit

Permalink
parsed configuration only for intialization
Browse files Browse the repository at this point in the history
Signed-off-by: Norbert Takacs <[email protected]>
  • Loading branch information
norberttak committed Apr 13, 2024
1 parent be281fd commit f3d3959
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core/XPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ float error_display_callback(float inElapsedSinceLastCall, float inElapsedTimeSi
void stop_and_clear_xpanel_plugin();
int init_and_start_xpanel_plugin();

Configuration config;
std::vector<Device*> devices;
bool plugin_already_initialized = false;
const float FLIGHT_LOOP_TIME_PERIOD = 0.2f;
Expand Down Expand Up @@ -127,29 +126,29 @@ PLUGIN_API int XPluginEnable(void)

float flight_loop_callback(float, float, int, void*)
{
for (const auto& it : config.class_configs)
for (auto dev : devices)
{
// check and set LED states
for (const auto& triggers : it.light_triggers)
for (const auto& triggers : dev->get_config().light_triggers)
{
for (auto& trigger : triggers.second)
{
trigger->evaluate_and_store_action();
}
}

// check and set 7 segment display states
for (const auto& display : it.multi_displays)
for (const auto& display : dev->get_config().multi_displays)
{
display.second->evaluate_and_store_dataref_value();
}

for (const auto& display : it.generic_displays)
for (const auto& display : dev->get_config().generic_displays)
{
display.second->evaluate_and_store_dataref_value();
}

// update the FIP devices
for (auto& screen : it.fip_screens)
for (auto& screen : dev->get_config().fip_screens)
{
screen.second->evaluate_and_store_screen_action();
}
Expand Down Expand Up @@ -192,7 +191,6 @@ void stop_and_clear_xpanel_plugin()
}
}
devices.clear();
config.clear();
ActionQueue::get_instance()->clear_all_actions();
plugin_already_initialized = false;

Expand Down Expand Up @@ -261,6 +259,8 @@ int enumerate_and_add_hid_devices(ClassConfiguration& it)

int init_and_start_xpanel_plugin(void)
{
Configuration config;

char aircraft_file_name[256];
char aircraft_file_path[512];
XPLMGetNthAircraftModel(0, aircraft_file_name, aircraft_file_path);
Expand Down

0 comments on commit f3d3959

Please sign in to comment.