Added screen rotation setting
This commit is contained in:
@ -12,7 +12,6 @@
|
||||
#define PULSE_LENGTH 12 //ms (with 12 ms you can't get higher than 208bpm)
|
||||
#define MAXBPM 200 //250 at 24ppqn with 5ms pulse will be 50/50 square wave
|
||||
#define MINBPM 20
|
||||
#define SCREEN_TIMEOUT 600000 //Turn display off after 5 min
|
||||
|
||||
// Rev 2 and 3 Config
|
||||
#define ENC_BTN_PIN 14
|
||||
@ -27,6 +26,7 @@ const byte outsPins[6] = { 7, 8, 10, 6, 9, 11 };
|
||||
|
||||
int CV1Calibration = 0;
|
||||
int CV2Calibration = 0;
|
||||
bool rotateScreen = false;
|
||||
|
||||
const int subDivs[17] = { -24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32 }; //positive - divide, negative - multiply, 0 - off
|
||||
|
||||
@ -75,7 +75,7 @@ byte currentStep = 0;
|
||||
byte stepNumSelected = 0;
|
||||
bool *patternToEdit;
|
||||
|
||||
byte memCode = 'a'; //Change to different letter if you changed the data structure
|
||||
byte memCode = 'A'; //Change to different letter if you changed the data structure
|
||||
|
||||
unsigned int channelPulseCount[6];
|
||||
unsigned int channelPulsesPerCycle[6];
|
||||
@ -201,6 +201,8 @@ void setup() {
|
||||
EEPROM.get(addr, CV1Calibration);
|
||||
addr = addr + sizeof(CV1Calibration);
|
||||
EEPROM.get(addr, CV2Calibration);
|
||||
addr = addr + sizeof(CV2Calibration);
|
||||
EEPROM.get(addr, rotateScreen);
|
||||
} else {
|
||||
//calibrateCVs();
|
||||
saveState();
|
||||
@ -211,10 +213,18 @@ void setup() {
|
||||
|
||||
u8g2.begin();
|
||||
|
||||
if (rotateScreen) {
|
||||
u8g2.setDisplayRotation(U8G2_R0);
|
||||
} else {
|
||||
u8g2.setDisplayRotation(U8G2_R2);
|
||||
}
|
||||
|
||||
updateScreen();
|
||||
calculateCycles();
|
||||
calculateBPMTiming();
|
||||
|
||||
displayScreen = 0;
|
||||
|
||||
FlexiTimer2::set(1, 1.0 / 1000, clock); // 1.0/1000 = 1ms period. If other than 1ms calculateBPMTiming() might need tweaking
|
||||
FlexiTimer2::start();
|
||||
}
|
||||
@ -223,6 +233,8 @@ void loop() {
|
||||
checkInputs();
|
||||
}
|
||||
|
||||
//void reset() { asm volatile ("jmp 0x7800"); }
|
||||
|
||||
void clock() {
|
||||
if (isPlaying) {
|
||||
|
||||
@ -498,9 +510,11 @@ void saveState() {
|
||||
EEPROM.put(addr, CV1Calibration);
|
||||
addr = addr + sizeof(CV1Calibration);
|
||||
EEPROM.put(addr, CV2Calibration);
|
||||
addr = addr + sizeof(CV2Calibration);
|
||||
EEPROM.put(addr, rotateScreen);
|
||||
}
|
||||
|
||||
void calibrateCVs() {
|
||||
CV1Calibration = 255 - (analogRead(ANALOGUE_INPUT_1_PIN) / 2);
|
||||
CV2Calibration = 255 - (analogRead(ANALOGUE_INPUT_2_PIN) / 2);
|
||||
CV1Calibration = 511 - analogRead(ANALOGUE_INPUT_1_PIN);
|
||||
CV2Calibration = 511 - analogRead(ANALOGUE_INPUT_2_PIN);
|
||||
}
|
||||
Reference in New Issue
Block a user