void bright_down(int event_value) { if (!max_brightness) bright_init(); // If the button has been released, we simply close the BRIGHT_FILENAME file. if (event_value == 0) { fclose(dev_file); return; } // If the button has been pressed, update the current_value variable. else if (event_value == 1) { dev_file = fopen(BRIGHT_FILENAME, "r+"); current_value = get_current_value(dev_file); } if (current_value == MIN_BRIGHTNESS) return; else if (current_value - STEP_VALUE <= MIN_BRIGHTNESS) current_value = MIN_BRIGHTNESS; else current_value -= STEP_VALUE; set_brightness(dev_file, current_value); }
void float_setting::write_to_archive(archive_writer& writer, const char* name) const { write_float(writer, name, get_current_value()); }