Allow to set a specific thermal profile at start-up time

This commit is contained in:
Denis 2024-01-07 18:02:09 +01:00
parent cb9b5e5c4a
commit d608d07d89
No known key found for this signature in database
GPG key ID: DD9B63F805CF5C03
6 changed files with 20 additions and 4 deletions

View file

@ -23,6 +23,7 @@ int main(int argc, char ** argv) {
.m1m2_mode = 0,
.touchbar = true,
.enable_thermal_profiles_switching = false,
.default_thermal_profile = -1,
.enable_leds_commands = false,
};

View file

@ -13,4 +13,5 @@ controller_bluetooth = true;
dualsense_edge = false;
swap_y_z = true;
enable_thermal_profiles_switching = true;
default_thermal_profile = -1;
enable_leds_commands = true;

1
main.c
View file

@ -22,6 +22,7 @@ int main(int argc, char ** argv) {
.m1m2_mode = 1,
.touchbar = true,
.enable_thermal_profiles_switching = false,
.default_thermal_profile = -1,
.enable_leds_commands = false,
};

View file

@ -124,7 +124,7 @@ static rc71l_platform_t hw_platform = {
.g = 0x40,
.b = 0x40,
},
.current_thermal_profile = 0xFFFFFFFFFFFFFFFF,
.current_thermal_profile = 0,
.next_thermal_profile = 0,
};
@ -1528,14 +1528,19 @@ input_dev_composite_t rc71l_composite = {
.leds_fn = rc71l_platform_leds,
};
input_dev_composite_t* rog_ally_device_def(const dev_in_settings_t *const settings) {
if (settings->touchbar) {
input_dev_composite_t* rog_ally_device_def(const dev_in_settings_t *const conf) {
if (conf->touchbar) {
rc71l_composite.dev[rc71l_composite.dev_count++] = &in_touchscreen_dev;
}
if ((settings->enable_leds_commands) || (settings->enable_thermal_profiles_switching)) {
if ((conf->enable_leds_commands) || (conf->enable_thermal_profiles_switching)) {
rc71l_composite.dev[rc71l_composite.dev_count++] = &nkey_dev;
}
if ((conf->enable_thermal_profiles_switching) && (conf->default_thermal_profile >= 0) && (conf->default_thermal_profile < 3)) {
hw_platform.current_thermal_profile = 0xFFFFFFFFFFFFFFFF;
hw_platform.next_thermal_profile = conf->default_thermal_profile;
}
return &rc71l_composite;
}

View file

@ -62,6 +62,13 @@ void load_in_config(dev_in_settings_t *const out_conf, const char* const filepat
fprintf(stderr, "enable_thermal_profiles_switching (bool) configuration not found. Default value will be used.\n");
}
int default_thermal_profile;
if (config_lookup_int(&cfg, "default_thermal_profile", &default_thermal_profile) != CONFIG_FALSE) {
out_conf->default_thermal_profile = default_thermal_profile;
} else {
fprintf(stderr, "default_thermal_profile (int) configuration not found. Default value will be used.\n");
}
int enable_leds_commands;
if (config_lookup_bool(&cfg, "enable_leds_commands", &enable_leds_commands) != CONFIG_FALSE) {
out_conf->enable_leds_commands = enable_leds_commands;

View file

@ -9,6 +9,7 @@ typedef struct dev_in_settings {
uint8_t m1m2_mode;
bool touchbar;
bool enable_thermal_profiles_switching;
int default_thermal_profile;
bool enable_leds_commands;
} dev_in_settings_t;