Skip to content

Commit

Permalink
Allow to set a specific thermal profile at start-up time
Browse files Browse the repository at this point in the history
  • Loading branch information
NeroReflex committed Jan 7, 2024
1 parent cb9b5e5 commit d608d07
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions allynone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
1 change: 1 addition & 0 deletions config.cfg.default
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 1 addition & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
13 changes: 9 additions & 4 deletions rog_ally.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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;
}
7 changes: 7 additions & 0 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d608d07

Please sign in to comment.