From c4b3d717e3f7fe0a563de9676feb52d1540660c1 Mon Sep 17 00:00:00 2001 From: Oleksiy Date: Fri, 17 Mar 2023 01:03:49 +0200 Subject: [PATCH] fixed deviders switching going to min after max --- software/GToE/GToE.ino | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/software/GToE/GToE.ino b/software/GToE/GToE.ino index 83b78fc..1d6b8ad 100644 --- a/software/GToE/GToE.ino +++ b/software/GToE/GToE.ino @@ -8,14 +8,14 @@ #define SCREEN_ADDRESS 0x3C #define PPQN 24 -#define PULSE_LENGTH 15 //ms -#define MAXBPM 250 //250 at 24ppqn with 5ms pulse will be 50/50 square wave +#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 INPUT_PIN 2 //needs to be an interrupt pin -#define ENC_BTN_PIN 14 //3 //21 -#define ENC_D1_PIN 17 //12 //20 -#define ENC_D2_PIN 4 //4 //17 +#define ENC_BTN_PIN 14 +#define ENC_D1_PIN 17 +#define ENC_D2_PIN 4 #define START_STOP_BTN_PIN 5 #define ANALOGUE_INPUT_1_PIN A2 #define ANALOGUE_INPUT_2_PIN A1 @@ -74,7 +74,7 @@ Adafruit_SSD1306 display(128, 64, &Wire, -1); RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03); void setup() { - //Serial.begin(9600); + Serial.begin(9600); //check last bit of eeprom to know if settings were stored if (EEPROM.read(1023) == 'H') { @@ -259,8 +259,8 @@ void checkInputs() { updateTiming(); } else if (displayTab != 0 && insideTab == 0) { channels[displayTab-1].mode = channels[displayTab-1].mode - change; - if (channels[displayTab-1].mode < 0) { - channels[displayTab-1].mode = 0; + if (channels[displayTab-1].mode == 65535) { //65535 is 0-1 for unsigned vars + channels[displayTab-1].mode = 0; } else if (channels[displayTab-1].mode > (sizeof(clockModes)/sizeof(int)) - 1) { channels[displayTab-1].mode = (sizeof(clockModes)/sizeof(int)) - 1; }