diff --git a/README.md b/README.md index 2bdba72..354984b 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ #### ・USB Host Library Rev. 2.0 https://github.com/felis/USB_Host_Shield_2.0 -フットスイッチは以下のGPIOに割り当てています。 -======= ### フットスイッチは以下のGPIOに割り当てています。 ### M5Stackのピンからスイッチに配線する場合、以下のGPIOから配線して下さい。 diff --git a/zoomG1_midiController/zoomG1_midiController.ino b/zoomG1_midiController/zoomG1_midiController.ino index d76dcd4..b82964c 100644 --- a/zoomG1_midiController/zoomG1_midiController.ino +++ b/zoomG1_midiController/zoomG1_midiController.ino @@ -34,7 +34,7 @@ int xpos = 0; int ypos = 50; GX_PARAM gxParam; -EEPROMParam eepParam = EEPROMParam(PROGRAM_ID, gxParam); +EEPROMParam eepParam = EEPROMParam(); Button2 buttonUP = Button2(btnUP); Button2 buttonRIGHT = Button2(btnRIGHT); @@ -116,6 +116,15 @@ void button_init() void button_poll() { + if (M5.BtnA.wasReleased()){ + buttonActionLEFT(); + return; + } + if (M5.BtnC.wasReleased()){ + buttonActionRIGHT(); + return; + } + buttonUP.loop(); buttonRIGHT.loop(); buttonLEFT.loop(); @@ -187,7 +196,7 @@ void DisplayNumber(int number) M5.Lcd.setTextDatum(1); xpos = M5.Lcd.width() / 2; //ypos = M5.Lcd.height() / 2; - ypos = 35; + ypos = 40; M5.Lcd.setTextPadding(M5.Lcd.width()); M5.Lcd.setTextColor(TFT_YELLOW, TFT_BLACK); sprintf(buf, "%02d", number); @@ -238,7 +247,7 @@ void setup() M5.begin(true, false, true); M5.Power.begin(); - eepParam = EEPROMParam(PROGRAM_ID, gxParam); + eepParam.LoadParameter(PROGRAM_ID, gxParam); convertParamToPreset(); initDisplay(); diff --git a/zoomG1_midiController/zoomparam.cpp b/zoomG1_midiController/zoomparam.cpp index cfbe0db..f4ba997 100644 --- a/zoomG1_midiController/zoomparam.cpp +++ b/zoomG1_midiController/zoomparam.cpp @@ -1,17 +1,9 @@ #include #include "zoomparam.h" -EEPROMParam::EEPROMParam(const char *gxID, GX_PARAM &gxParam) +EEPROMParam::EEPROMParam() { - strncpy(zoomProgramID, gxID, MAX_ID_LENGTH); - zoomProgramID[MAX_ID_LENGTH] = NULL; - - getParameterFromEEPROM(gxParam); - if (strcmp((char *)gxParam.programID, gxID) != 0){ - setDefaultParameter(gxParam); - setParameterToEEPROM(gxParam); - getParameterFromEEPROM(gxParam); - } + } bool EEPROMParam::operator==(EEPROMParam &rhs) @@ -23,7 +15,20 @@ void EEPROMParam::initializeParameter(GX_PARAM &gxParam) { gxParam.programID[0] = NULL; gxParam.bankSelect = 0; - gxParam.patchNumber = 1; + gxParam.patchNumber = 0; +} + +void EEPROMParam::LoadParameter(const char *gxID, GX_PARAM &gxParam) +{ + strncpy(zoomProgramID, gxID, MAX_ID_LENGTH); + zoomProgramID[MAX_ID_LENGTH] = NULL; + + getParameterFromEEPROM(gxParam); + if (strcmp((char *)gxParam.programID, gxID) != 0){ + setDefaultParameter(gxParam); + setParameterToEEPROM(gxParam); + getParameterFromEEPROM(gxParam); + } } void EEPROMParam::setDefaultParameter(GX_PARAM &gxParam) diff --git a/zoomG1_midiController/zoomparam.h b/zoomG1_midiController/zoomparam.h index f56c80a..6248b6a 100644 --- a/zoomG1_midiController/zoomparam.h +++ b/zoomG1_midiController/zoomparam.h @@ -16,8 +16,9 @@ class EEPROMParam { //MS_PARAM gxParam; char zoomProgramID[MAX_ID_LENGTH + 1]; public: - EEPROMParam(const char *gxID, GX_PARAM &gxParam); + EEPROMParam(void); void initializeParameter(GX_PARAM &gxParam); + void LoadParameter(const char *gxID, GX_PARAM &gxParam); void setDefaultParameter(GX_PARAM &gxParam); void setParameterToEEPROM(GX_PARAM &gxParam); void getParameterFromEEPROM(GX_PARAM &gxParam);