Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kiitoskumasan committed Dec 19, 2020
1 parent bc17a1d commit 04fed97
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

#### ・USB Host Library Rev. 2.0 https://github.com/felis/USB_Host_Shield_2.0

フットスイッチは以下のGPIOに割り当てています。
=======
### フットスイッチは以下のGPIOに割り当てています。

### M5Stackのピンからスイッチに配線する場合、以下のGPIOから配線して下さい。
Expand Down
15 changes: 12 additions & 3 deletions zoomG1_midiController/zoomG1_midiController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
27 changes: 16 additions & 11 deletions zoomG1_midiController/zoomparam.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#include <EEPROM.h>
#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)
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion zoomG1_midiController/zoomparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

1 comment on commit 04fed97

@kiitoskumasan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added functions to M5 Button A and Button B
Button A : patch number up
Button B : patch number down

Please sign in to comment.