From fb914b52c8c721c7011259ac61a53f8b969a0ecb Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 26 May 2019 14:52:14 +0200 Subject: [PATCH] Fixing volume menu. Fixing storing sound number to EEPROM after loading. Fixing loading stored sound number at startup. --- MicroMDAEPiano.ino | 7 +++++-- UI.hpp | 27 ++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 5ea4fde..86cb69c 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -512,13 +512,16 @@ void initial_values_from_eeprom(void) } else { - EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); + sound = EEPROM.read(EEPROM_SOUND); master_volume = EEPROM.read(EEPROM_MASTER_VOLUME); + EEPROM_readAnything(EEPROM_CONFIGURATIONS + sizeof(config_t) * (sound - 1), configuration); Serial.print(F(" - OK, loading")); } #ifdef DEBUG Serial.print(F(" - Master volume: ")); - Serial.println(master_volume, DEC); + Serial.print(master_volume, DEC); + Serial.print(F(" - Sound: ")); + Serial.println(sound, DEC); Serial.print(F("Max configs in EEPROM: ")); Serial.println(MAX_SOUNDS); show_sound(); diff --git a/UI.hpp b/UI.hpp index e3abbe9..7c31563 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1,5 +1,25 @@ /* - LiquidMenuTest + MicroMDAEPiano + + MicroMDAEPiano is a port of the MDA-EPiano sound engine + (https://sourceforge.net/projects/mda-vst/) for the Teensy-3.5/3.6 with audio shield. + + (c)2019 H. Wirtz + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ /* Don't forget to change in MAX_FUNCTIONS to 24 in ../libraries/LiquidMenu/src/LiquidMenu_config.h @@ -8,7 +28,7 @@ const uint8_t MAX_VARIABLES = 5; ///< @note Default: 5 /// Configures the number of available functions per line. - const uint8_t MAX_FUNCTIONS = 42; ///< @note Default: 8 + const uint8_t MAX_FUNCTIONS = 39; ///< @note Default: 8 /// Configures the number of available lines per screen. const uint8_t MAX_LINES = 19; ///< @note Default: 12 @@ -17,7 +37,7 @@ const uint8_t MAX_SCREENS = 14; ///< @note Default: 14 /// Configures the number of available menus per menus system. - const uint8_t MAX_MENUS = 41; ///< @note Default: 8 + const uint8_t MAX_MENUS = 42; ///< @note Default: 8 */ @@ -1716,6 +1736,7 @@ void load_sound(void) Serial.print(F("Load sound ")); Serial.println(sound); #endif + EEPROM.write(EEPROM_SOUND, sound); config_from_eeprom(); }