mirror of
https://github.com/okalachev/flix.git
synced 2026-03-30 12:03:47 +00:00
Minor parameters code simplifications
readOnly is false by default INFINITY == INFINITY, so remove redundant check
This commit is contained in:
@@ -113,7 +113,7 @@ Parameter parameters[] = {
|
|||||||
|
|
||||||
void setupParameters() {
|
void setupParameters() {
|
||||||
print("Setup parameters\n");
|
print("Setup parameters\n");
|
||||||
storage.begin("flix", false);
|
storage.begin("flix");
|
||||||
// Read parameters from storage
|
// Read parameters from storage
|
||||||
for (auto ¶meter : parameters) {
|
for (auto ¶meter : parameters) {
|
||||||
if (!storage.isKey(parameter.name)) {
|
if (!storage.isKey(parameter.name)) {
|
||||||
@@ -165,8 +165,7 @@ void syncParameters() {
|
|||||||
|
|
||||||
for (auto ¶meter : parameters) {
|
for (auto ¶meter : parameters) {
|
||||||
if (parameter.getValue() == parameter.cache) continue; // no change
|
if (parameter.getValue() == parameter.cache) continue; // no change
|
||||||
if (isnan(parameter.getValue()) && isnan(parameter.cache)) continue; // both are NaN
|
if (isnan(parameter.getValue()) && isnan(parameter.cache)) continue; // both are NAN
|
||||||
if (isinf(parameter.getValue()) && isinf(parameter.cache)) continue; // both are Inf
|
|
||||||
|
|
||||||
storage.putFloat(parameter.name, parameter.getValue());
|
storage.putFloat(parameter.name, parameter.getValue());
|
||||||
parameter.cache = parameter.getValue(); // update cache
|
parameter.cache = parameter.getValue(); // update cache
|
||||||
|
|||||||
Reference in New Issue
Block a user