Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmamma committed Jan 12, 2023
2 parents 1ef2421 + e6b5c4c commit f69a1c7
Show file tree
Hide file tree
Showing 71 changed files with 614 additions and 378 deletions.
18 changes: 18 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
MCL 4.30 12/01/2023

Please install Machinedrum OS X.08 & Monomachine OS X.01 before using MCL 4.20.
Perform the USB DFU firmware procedure to upgrade the USB microcontroller for class compliant USB MIDI.

- Fixes:
The Microtiming Menu would not display correctly on the MD when speed set to 1/8.
GUI input from MD's trig keys would sometimes be unreliable.

- Changes:
Improved overall framerate and responsiveness of MCL, particulary on the Grid Page.

Overhauled the method in which MD track's are loaded, such that there are no dropped notes during transitions.

MCL now responds to Program Change messages incoming via USB MIDI.

GUI improvements to Save and Load pages.

MCL 4.20 14/07/2022

Please install Machinedrum OS X.07 & Monomachine OS X.01 before using MCL 4.20.
Expand Down
3 changes: 0 additions & 3 deletions avr/cores/megacommand/A4/A4Sysex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,4 @@ void A4SysexListenerClass::end() {

}

void A4SysexListenerClass::end_immediate() {
}

void A4SysexListenerClass::setup(MidiClass *_midi) { sysex = &(_midi->midiSysex); sysex->addSysexListener(this); }
1 change: 0 additions & 1 deletion avr/cores/megacommand/A4/A4Sysex.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class A4SysexListenerClass : public ElektronSysexListenerClass {

virtual void start();
virtual void handleByte(uint8_t byte);
virtual void end_immediate();
virtual void end();
/**
* Add the sysex listener to the MIDI sysex subsystem. This needs to
Expand Down
14 changes: 0 additions & 14 deletions avr/cores/megacommand/Adafruit-GFX-Library/Adafruit_GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,23 +802,14 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
uint8_t line = pgm_read_byte(&font[c * 5 + i]);
for (int8_t j = 0; j < 8; j++, line >>= 1) {
if (line & 1) {
if (size == 1)
writePixel(x + i, y + j, color);
else
writeFillRect(x + i * size, y + j * size, size, size, color);
} else if (bg != color) {
if (size == 1)
writePixel(x + i, y + j, bg);
else
writeFillRect(x + i * size, y + j * size, size, size, bg);
}
}
}
if (bg != color) { // If opaque, draw vertical line for last column
if (size == 1)
writeFastVLine(x + 5, y, 8, bg);
else
writeFillRect(x + 5 * size, y, size, 8 * size, bg);
}
endWrite();

Expand Down Expand Up @@ -869,12 +860,7 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
bits = pgm_read_byte(&bitmap[bo++]);
}
if (bits & 0x80) {
if (size == 1) {
writePixel(x + xo + xx, y + yo + yy, color);
} else {
writeFillRect(x + (xo16 + xx) * size, y + (yo16 + yy) * size, size,
size, color);
}
}
bits <<= 1;
}
Expand Down
2 changes: 1 addition & 1 deletion avr/cores/megacommand/Adafruit-GFX-Library/Adafruit_GFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Adafruit_GFX : public Print {
Adafruit_GFX(int16_t w, int16_t h); // Constructor

// This MUST be defined by the subclass:
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
virtual void drawPixel(uint8_t x, uint8_t y, uint8_t color) = 0;

// TRANSACTION API / CORE DRAW API
// These MAY be overridden by the subclass to provide device-specific
Expand Down
52 changes: 20 additions & 32 deletions avr/cores/megacommand/Adafruit-GFX-Library/Fonts/Elektrothic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@
#include "../gfxfont.h"

const uint8_t ElektrothicBitmaps[] PROGMEM = {
// 74
0x7B, 0xFC, 0xF3, 0xCF, 0x3F, 0xDE, 0xFD, 0xB6, 0xDB, 0xFB,
0xF0, 0xCF, 0x73, 0x0F, 0xFF, 0xFB, 0xF0, 0xCE, 0x38, 0x3F, 0xFE, 0xCF,
0x3C, 0xFF, 0x7C, 0x30, 0xC3, 0xFF, 0xFC, 0x3E, 0xFC, 0x3F, 0xFF, 0x7F,
0xFC, 0x3E, 0xFF, 0x3F, 0xDF, 0xFF, 0xF0, 0xC7, 0x39, 0xCE, 0x30, 0x7B,
0xFC, 0xDE, 0xFF, 0x3F, 0xDE, 0x7B, 0xFC, 0xFF, 0x7C, 0x3F, 0xFE,
// 131
};
0x7B, 0xFC, 0xF3, 0xCF, 0x3F, 0xDE, 0xFD, 0xB6, 0xDB, 0xFB, 0xF0, 0xCF,
0x73, 0x0F, 0xFF, 0xFB, 0xF0, 0xCE, 0x38, 0x3F, 0xFE, 0xCF, 0x3C, 0xFF,
0x7C, 0x30, 0xC3, 0xFF, 0xFC, 0x3E, 0xFC, 0x3F, 0xFF, 0x7F, 0xFC, 0x3E,
0xFF, 0x3F, 0xDF, 0xFF, 0xF0, 0xC7, 0x39, 0xCE, 0x30, 0x7B, 0xFC, 0xDE,
0xFF, 0x3F, 0xDE, 0x7B, 0xFC, 0xFF, 0x7C, 0x3F, 0xFE, 0xCF, 0x37, 0x8C,
0x31, 0xEC, 0xF3, 0xCF, 0x3C, 0xFF, 0x7C, 0x3F, 0xFE};

/* {offset, width, height, advance cursor, x offset, y offset} */
const GFXglyph ElektrothicGlyphs[] PROGMEM = {
{74 - 74, 6, 8, 7, 0, -8} // '0'
,
{80 - 74, 3, 8, 4, 0, -8} // '1'
,
{83 - 74, 6, 8, 7, 0, -8} // '2'
,
{89 - 74, 6, 8, 7, 0, -8} // '3'
,
{95 - 74, 6, 8, 7, 0, -8} // '4'
,
{101 - 74, 6, 8, 7, 0, -8} // '5'
,
{107 - 74, 6, 8, 7, 0, -8} // '6'
,
{113 - 74, 6, 8, 7, 0, -8} // '7'
,
{119 - 74, 6, 8, 7, 0, -8} // '8'
,
{125 - 74, 6, 8, 7, 0, -8} // '9'
// next is 131
{0, 6, 8, 7, 0, -8}, // 0x0 'non-printable'
{6, 3, 8, 4, 0, -8}, // 0x1 'non-printable'
{9, 6, 8, 7, 0, -8}, // 0x2 'non-printable'
{15, 6, 8, 7, 0, -8}, // 0x3 'non-printable'
{21, 6, 8, 7, 0, -8}, // 0x4 'non-printable'
{27, 6, 8, 7, 0, -8}, // 0x5 'non-printable'
{33, 6, 8, 7, 0, -8}, // 0x6 'non-printable'
{39, 6, 8, 7, 0, -8}, // 0x7 'non-printable'
{45, 6, 8, 7, 0, -8}, // 0x8 'non-printable'
{51, 6, 8, 7, 0, -8}, // 0x9 'non-printable'
{57, 6, 8, 7, 0, -8}, // 0xA 'non-printable'
{63, 6, 8, 7, 0, -8} // 0xB 'non-printable'
};

const GFXfont Elektrothic PROGMEM = {(uint8_t *)ElektrothicBitmaps,
(GFXglyph *)ElektrothicGlyphs, '0', '9',
15};
const GFXfont Elektrothic PROGMEM = {
(uint8_t *)ElektrothicBitmaps, (GFXglyph *)ElektrothicGlyphs, '0', ';', 15};
83 changes: 23 additions & 60 deletions avr/cores/megacommand/Adafruit_SSD1305_Library/Adafruit_SSD1305.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,55 +51,32 @@ extern const uint8_t PROGMEM font[];
static uint8_t buffer[SSD1305_LCDHEIGHT * SSD1305_LCDWIDTH / 8] = {};

// the most basic function, set a single pixel
void Adafruit_SSD1305::drawPixel(int16_t x, int16_t y, uint16_t color) {
if ((x >= width()) || (y >= height()) || (x < 0) || (y < 0))
return;

// check rotation, move pixel around if necessary*
switch (2) {
case 1:
adagfx_swap(x, y);
x = WIDTH - x - 1;
break;
case 2:
// x = WIDTH - x - 1;
y = HEIGHT - y - 1;
break;
case 3:
adagfx_swap(x, y);
y = HEIGHT - y - 1;
break;
}
void Adafruit_SSD1305::drawPixel(uint8_t x, uint8_t y, uint8_t color) {
if ((x >= width()) || (y >= height()))
return;

draw_pixel:
uint16_t index = x + (y / 8) * SSD1305_LCDWIDTH;
draw_pixel:
// x is which column
if (color == WHITE)
SET_BIT(buffer[x + (y / 8) * SSD1305_LCDWIDTH],y % 8);
SET_BIT(buffer[index],y % 8);
else if (color == INVERT) {
color =
(IS_BIT_SET(buffer[x + (y / 8) * SSD1305_LCDWIDTH],y % 8)) ? BLACK : WHITE;
(IS_BIT_SET(buffer[index],y % 8)) ? BLACK : WHITE;
goto draw_pixel;
} else // BLACK
CLEAR_BIT(buffer[x + (y / 8) * SSD1305_LCDWIDTH],(y % 8));
CLEAR_BIT(buffer[index],(y % 8));
}

void Adafruit_SSD1305::drawFastVLine(int16_t x, int16_t y, int16_t h,
uint16_t color) {
if (x < 0) {
x = 0;
}
if (y < 0) {
h += y;
y = 0;
}
void Adafruit_SSD1305::drawFastVLine(uint8_t x, uint8_t y, uint8_t h,
uint8_t color) {
if ((x >= width()) || (y >= height()))
return;

if (y + h > SSD1305_LCDHEIGHT) {
h = SSD1305_LCDHEIGHT - y;
}
// check rotation, move pixel around if necessary*
// MegaCommand rotation
y = SSD1305_LCDHEIGHT - y - h;

// initial pointer position
// initial pointer position
uint8_t *p = buffer + x + (y / 8) * SSD1305_LCDWIDTH;

// 1. upper part
Expand Down Expand Up @@ -151,32 +128,23 @@ void Adafruit_SSD1305::drawFastVLine(int16_t x, int16_t y, int16_t h,
}
}

void Adafruit_SSD1305::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color) {
// for (int16_t x2 = x + w; x < x2; ++x)
void Adafruit_SSD1305::fillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h,
uint8_t color) {
if ((x >= width()) || (y >= height()))
return;
// for (int16_t x2 = x + w; x < x2; ++x)
//{
// drawFastVLine(x, y, h, color);
//}
// return;
if (x < 0) {
x = 0;
}
if (y < 0) {
h += y;
y = 0;
}
if (y + h > SSD1305_LCDHEIGHT) {
h = SSD1305_LCDHEIGHT - y;
}

if (x + w > SSD1305_LCDWIDTH) {
w = SSD1305_LCDHEIGHT - x;
}
// check rotation, move pixel around if necessary*
// MegaCommand rotation
y = SSD1305_LCDHEIGHT - y - h;

// initial pointer position
// initial pointer position
uint8_t *p = buffer + x + (y / 8) * SSD1305_LCDWIDTH;
const int16_t xend = x + w;

Expand Down Expand Up @@ -240,7 +208,7 @@ void Adafruit_SSD1305::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
}
}

void Adafruit_SSD1305::fillScreen(uint16_t color) {
void Adafruit_SSD1305::fillScreen(uint8_t color) {
if (color == BLACK) {
clearDisplay();
} else if (color == WHITE) {
Expand Down Expand Up @@ -311,7 +279,7 @@ void Adafruit_SSD1305::begin(uint8_t i2caddr) {
command(0x3F); // 1/64
command(SSD1305_MASTERCONFIG);
command(0x8e); /* external vcc supply */
command(SSD1305_COMSCANDEC);
command(SSD1305_COMSCANINC);
command(SSD1305_SETDISPLAYOFFSET); // 0xD3
command(0x40);
command(SSD1305_SETDISPLAYCLOCKDIV); // 0xD5
Expand Down Expand Up @@ -486,13 +454,8 @@ void Adafruit_SSD1305::display(void) {
screen_saver_active = screen_saver;

uint16_t i = 0;
uint8_t page;
if (SSD1305_LCDHEIGHT == 64)
page = 0;
if (SSD1305_LCDHEIGHT == 32)
page = 4;

for (; page < 8; page++) {
for (uint8_t page = 0; page < 4; page++) {
command(SSD1305_SETPAGESTART + page);
command(0x00);
command(0x10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ class Adafruit_SSD1305 : public Adafruit_GFX {
void textbox(const char *text, const char *text2, uint16_t delay = 800);
void display();

void drawPixel(int16_t x, int16_t y, uint16_t color);
void drawPixel(uint8_t x, uint8_t y, uint8_t color);

virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
virtual void fillScreen(uint16_t color);
virtual void drawFastVLine(uint8_t x, uint8_t y, uint8_t h, uint8_t color);
virtual void fillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t color);
virtual void fillScreen(uint8_t color);

bool textbox_enabled = false;
private:
Expand Down
1 change: 1 addition & 0 deletions avr/cores/megacommand/Elektron/Elektron.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ class ElektronSysexObject {
#define FW_CAP_TONAL FW_CAP_HIGH(1)
#define FW_CAP_ENHANCED_GUI FW_CAP_HIGH(2)
#define FW_CAP_ENHANCED_MIDI FW_CAP_HIGH(3)
#define FW_CAP_MACHINE_CACHE FW_CAP_HIGH(4)

/// Base class for Elektron MidiDevice
class ElektronDevice : public MidiDevice {
Expand Down
2 changes: 1 addition & 1 deletion avr/cores/megacommand/MCL/A4Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void A4Track::transition_send(uint8_t tracknumber, uint8_t slotnumber) {

void A4Track::transition_load(uint8_t tracknumber, SeqTrack* seq_track, uint8_t slotnumber) {
uint8_t n = slotnumber;
ExtTrack::transition_load(tracknumber, seq_track, slotnumber);
GridTrack::transition_load(tracknumber, seq_track, slotnumber);
}

bool A4Track::get_track_from_sysex(uint8_t tracknumber) {
Expand Down
Loading

0 comments on commit f69a1c7

Please sign in to comment.