Skip to content

Commit

Permalink
wip 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neroroxxx committed Dec 18, 2022
1 parent f6a7d21 commit 7575f13
Show file tree
Hide file tree
Showing 20 changed files with 15,095 additions and 658 deletions.
29 changes: 15 additions & 14 deletions src/BMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ BMC::BMC():
#ifdef BMC_USE_SYNC
,sync(midi, midiClock, store.global, callback)
#endif

#ifdef BMC_HAS_DISPLAY
,display(midi, globals, callback
#ifdef BMC_USE_SYNC
,sync
#endif
)
#endif

#if BMC_MAX_PRESETS > 0
//,presets(globals, store.global)
,presets(globals)
Expand All @@ -43,14 +52,6 @@ BMC::BMC():
,timedEvents(globals, store.global)
#endif

#ifdef BMC_HAS_DISPLAY
,display(midi, globals, callback
#ifdef BMC_USE_SYNC
,sync
#endif
)
#endif

#if defined(BMC_USE_ON_BOARD_EDITOR)
,obe(globals, settings, editor, display)
#endif
Expand All @@ -75,15 +76,11 @@ BMC::BMC():
}

void BMC::begin(){

BMC_PRINTLN("BMC::begin");
// keep this order

#ifdef BMC_DEBUG
setupDebug();
BMC_PRINTLN("BMC::begin");
#endif

#if defined(BMC_HAS_DISPLAY)
display.begin();
#endif

#if defined(BMC_USE_ON_BOARD_EDITOR)
Expand Down Expand Up @@ -152,6 +149,9 @@ void BMC::update(){
BMC_PRINTLN("");

#if defined(BMC_HAS_DISPLAY)
#if BMC_MAX_ILI9341_BLOCKS > 0
display.initILI9341Blocks();
#endif
display.clearAll();
#endif
// set the current page to page 1 (0)
Expand Down Expand Up @@ -191,6 +191,7 @@ void BMC::update(){
}
oneSecondTimer = 0;
oneMilliSecondtimer = 0;

}
if(globals.reloadPage()){
reloadPage();
Expand Down
13 changes: 6 additions & 7 deletions src/BMC.events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,12 @@ uint8_t BMC::processEvent(uint8_t group, uint8_t deviceId, uint8_t deviceIndex,
callback.menuCommand(byteA);
}
} else if(group == BMC_DEVICE_GROUP_ENCODER){
uint8_t menCmd = 0;
if(byteA == BMC_MENU_UP || byteA == BMC_MENU_DOWN){
menCmd = scroll.direction ? BMC_MENU_UP : BMC_MENU_DOWN;
} else if(byteA == BMC_MENU_INC || byteA == BMC_MENU_DEC){
menCmd = scroll.direction ? BMC_MENU_INC : BMC_MENU_DEC;
}
obe.menuCommand(menCmd);
//uint8_t menCmd = 0;
//if(byteA == BMC_MENU_PREV || byteA == BMC_MENU_NEXT){
//menCmd = scroll.direction ? BMC_MENU_PREV : BMC_MENU_NEXT;
//}
uint8_t menCmd = scroll.direction ? BMC_MENU_NEXT : BMC_MENU_PREV;
obe.menuCommand(menCmd, true);
if(callback.menuCommand){
callback.menuCommand(menCmd);
}
Expand Down
8 changes: 4 additions & 4 deletions src/BMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ class BMC {
BMCSync sync;
#endif

#if defined(BMC_HAS_DISPLAY)
BMCDisplay display;
#endif

#if BMC_MAX_PRESETS > 0
BMCPresets presets;
#endif
Expand Down Expand Up @@ -284,10 +288,6 @@ class BMC {
void readTimedEvent();
#endif

#if defined(BMC_HAS_DISPLAY)
BMCDisplay display;
#endif

#if defined(BMC_USE_ON_BOARD_EDITOR)
BMCOBE obe;
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/BMC.hardware.encoders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void BMC::setupEncoders(){
BMCUIData ui = BMCBuildData::getUIData(BMC_DEVICE_ID_GLOBAL_ENCODER, i);
globalEncoders[i].begin(ui.pins[0], ui.pins[1]);
}
assignGlobalEncoders();
//assignGlobalEncoders();
#endif
}

Expand Down Expand Up @@ -182,8 +182,8 @@ void BMC::handleEncoder(bmcStoreEncoder& data, bool increased, uint8_t ticks){
case BMC_ENCODER_EVENT_TYPE_MENU:
if(callback.menuCommand){
if(byteA==BMC_MENU_UP || byteA==BMC_MENU_DOWN){
callback.menuCommand(increased?BMC_MENU_UP:BMC_MENU_DOWN);
if(byteA==BMC_MENU_PREV || byteA==BMC_MENU_NEXT){
callback.menuCommand(increased?BMC_MENU_PREV:BMC_MENU_NEXT);
} else if(byteA==BMC_MENU_LEFT || byteA==BMC_MENU_RIGHT){
callback.menuCommand(increased?BMC_MENU_RIGHT:BMC_MENU_LEFT);
} else if(byteA==BMC_MENU_INC || byteA==BMC_MENU_DEC){
Expand Down
4 changes: 2 additions & 2 deletions src/BMC.hardware.magicEncoders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ void BMC::handleEncoder(bmcStoreEncoder& data, bool increased, uint8_t ticks){
case BMC_ENCODER_EVENT_TYPE_MENU:
if(callback.menuCommand){
if(byteA==BMC_MENU_UP || byteA==BMC_MENU_DOWN){
callback.menuCommand(increased?BMC_MENU_UP:BMC_MENU_DOWN);
if(byteA==BMC_MENU_PREV || byteA==BMC_MENU_NEXT){
callback.menuCommand(increased?BMC_MENU_PREV:BMC_MENU_NEXT);
} else if(byteA==BMC_MENU_LEFT || byteA==BMC_MENU_RIGHT){
callback.menuCommand(increased?BMC_MENU_RIGHT:BMC_MENU_LEFT);
} else if(byteA==BMC_MENU_INC || byteA==BMC_MENU_DEC){
Expand Down
224 changes: 222 additions & 2 deletions src/display/BMC-Display-ILI9341.h

Large diffs are not rendered by default.

50 changes: 28 additions & 22 deletions src/display/BMC-Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class BMCDisplay {
,sync(t_sync)
#endif
{

begin();
}
void begin(){
BMC_PRINTLN("BMCDisplay::begin()");
Expand Down Expand Up @@ -66,27 +66,13 @@ class BMCDisplay {
void initILI9341(){
BMC_PRINTLN("BMCDisplay::initILI9341()");
BMCUIData ui = BMCBuildData::getUIData(BMC_DEVICE_ID_ILI, -1);
//tft.begin(BMCBuildData::getIliDisplayPosition(2));
tft.begin(ui.rotation);
}
void initILI9341Blocks(){
tft.clear();
/*
uint8_t textSize = 3;
tft.display.setTextSize(textSize);
while(1){
tft.clear();
for(uint8_t i=1;i<32;i++){
tft.display.setCursor(10, 10);
tft.display.print(i);
tft.display.setTextColor(0xFFFF, 0);
tft.display.drawChar(10, (textSize*8)+20, (char) i, 0xFFFF, 0, textSize);
delay(1000);
}
}
*/
for(uint8_t i = 0 ; i < BMC_MAX_ILI9341_BLOCKS ; i++){
block[i].begin(i);
}
//7 16 26
}
#endif

Expand Down Expand Up @@ -129,14 +115,14 @@ class BMCDisplay {
}
#endif

clearAll();

#if BMC_MAX_ILI9341_BLOCKS > 0
#if defined(BMC_USE_ON_BOARD_EDITOR)
if(globals.onBoardEditorActive()){
return;
}
#endif
clearAll();

#if BMC_MAX_ILI9341_BLOCKS > 0
for(uint8_t i = 0 ; i < BMC_MAX_ILI9341_BLOCKS ; i++){
#if defined(BMC_USE_DAW_LC)
bmcStoreEvent e = globals.getDeviceEventType(globals.store.pages[page].ili[i].events[0]);
Expand All @@ -163,6 +149,11 @@ class BMCDisplay {
#if defined(BMC_USE_DAW_LC)
#if BMC_MAX_ILI9341_BLOCKS > 0
void initDawMeters(){
#if defined(BMC_USE_ON_BOARD_EDITOR)
if(globals.onBoardEditorActive()){
return;
}
#endif
if(dawMetersBlock==-1){
return;
}
Expand Down Expand Up @@ -269,6 +260,11 @@ class BMCDisplay {
}

void initDawChannels(){
#if defined(BMC_USE_ON_BOARD_EDITOR)
if(globals.onBoardEditorActive()){
return;
}
#endif
if(dawChannelsBlock==-1){
return;
}
Expand Down Expand Up @@ -407,6 +403,11 @@ class BMCDisplay {
#endif

#if BMC_MAX_ILI9341_BLOCKS > 0
#if defined(BMC_USE_ON_BOARD_EDITOR)
if(globals.onBoardEditorActive()){
return;
}
#endif
for(uint8_t i = 0 ; i < BMC_MAX_ILI9341_BLOCKS ; i++){
block[i].clear(tft.display);
}
Expand Down Expand Up @@ -450,8 +451,8 @@ class BMCDisplay {
#define BMC_MENU_TOGGLE 1
#define BMC_MENU_SELECT 2
#define BMC_MENU_BACK 3
#define BMC_MENU_UP 4
#define BMC_MENU_DOWN 5
#define BMC_MENU_PREV 4
#define BMC_MENU_NEXT 5
#define BMC_MENU_INC 6
#define BMC_MENU_DEC 7
*/
Expand Down Expand Up @@ -506,6 +507,11 @@ void renderText(uint8_t n, bool isOled, uint8_t type, char * t_str, uint8_t xShi
#endif
#if BMC_MAX_ILI9341_BLOCKS > 0
if(!isOled){
#if defined(BMC_USE_ON_BOARD_EDITOR)
if(globals.onBoardEditorActive()){
return;
}
#endif
block[n].print(tft.display, str, xShift, yShift);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/editor/BMC-Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ uint32_t BMCEditor::getGlobalEncoderOffset(){
uint32_t BMCEditor::getGlobalEncoderOffset(uint16_t index){
uint32_t value = getGlobalTriLedOffset();
#if BMC_MAX_GLOBAL_ENCODERS > 0
value += (sizeof(bmcStoreEncoder) * index);
value += (sizeof(bmcStoreDevice<1, 1>) * index);
#endif
return value;
}
Expand Down
Loading

0 comments on commit 7575f13

Please sign in to comment.