forked from OnionUI/Onion
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
234 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.DS_Store | ||
.vscode/ | ||
*.o | ||
/documents/ | ||
/design/ | ||
/src/**/*.log | ||
/build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#ifndef STORYTELLER_APP_PARAMETERS__ | ||
#define STORYTELLER_APP_PARAMETERS__ | ||
|
||
static double parametersAudioVolumeStartup = 0.3; | ||
static double parametersAudioVolumeMax = 0.6; | ||
static double parametersScreenBrightnessStartup = 0.3; | ||
static double parametersScreenBrightnessMax = 0.6; | ||
static int parametersScreenOnInactivityTime = 120; | ||
static int parametersScreenOffInactivityTime = 300; | ||
static int parametersMusicInactivityTime = 3600; | ||
|
||
#define APP_PARAMETERS_PATH "/mnt/SDCARD/Saves/.parameters" | ||
|
||
|
||
int parameters_getAudioVolumeStartup() { | ||
return (int)(parametersAudioVolumeStartup * 20 + 0.5); | ||
} | ||
|
||
int parameters_getAudioVolumeMax() { | ||
return (int)(parametersAudioVolumeMax * 20 + 0.5); | ||
} | ||
|
||
int parameters_getAudioVolumeValidation(int audioVolume) { | ||
return audioVolume > parameters_getAudioVolumeMax() ? parameters_getAudioVolumeMax() : audioVolume; | ||
} | ||
|
||
int parameters_getScreenBrightnessStartup() { | ||
return (int)(parametersScreenBrightnessStartup * 10 + 0.5); | ||
} | ||
|
||
int parameters_getScreenBrightnessMax() { | ||
return (int)(parametersScreenBrightnessMax * 10 + 0.5); | ||
} | ||
|
||
int parameters_getScreenBrightnessValidation(int brightness) { | ||
return brightness > parameters_getScreenBrightnessMax() ? parameters_getScreenBrightnessMax() : brightness; | ||
} | ||
|
||
int parameters_getScreenOnInactivityTime() { | ||
return parametersScreenOnInactivityTime; | ||
} | ||
|
||
int parameters_getScreenOffInactivityTime() { | ||
return parametersScreenOffInactivityTime; | ||
} | ||
|
||
int parameters_getMusicInactivityTime() { | ||
return parametersMusicInactivityTime; | ||
} | ||
|
||
void parameters_init(void) | ||
{ | ||
cJSON *parameters = json_load(APP_PARAMETERS_PATH); | ||
if(parameters != NULL) { | ||
json_getDouble(parameters, "audioVolumeStartup", ¶metersAudioVolumeStartup); | ||
json_getDouble(parameters, "audioVolumeMax", ¶metersAudioVolumeMax); | ||
json_getDouble(parameters, "screenBrightnessStartup", ¶metersScreenBrightnessStartup); | ||
json_getDouble(parameters, "screenBrightnessMax", ¶metersScreenBrightnessMax); | ||
json_getInt(parameters, "screenOnInactivityTime", ¶metersScreenOnInactivityTime); | ||
json_getInt(parameters, "screenOffInactivityTime", ¶metersScreenOffInactivityTime); | ||
json_getInt(parameters, "musicInactivityTime", ¶metersMusicInactivityTime); | ||
} | ||
} | ||
|
||
#endif // STORYTELLER_APP_PARAMETERS__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.