From f8b56090b2873c95946a27b1fb8ae030007fba34 Mon Sep 17 00:00:00 2001 From: KaraBun Date: Fri, 20 Jan 2023 20:52:34 -0500 Subject: [PATCH] Initial house keeping/Lanes clearout. --- Lanes.ino => TrigorMortse.ino | 55 ++--------------------------------- src/Lanes.cpp | 37 ----------------------- src/Lanes.h | 29 ------------------ 3 files changed, 3 insertions(+), 118 deletions(-) rename Lanes.ino => TrigorMortse.ino (71%) delete mode 100644 src/Lanes.cpp delete mode 100644 src/Lanes.h diff --git a/Lanes.ino b/TrigorMortse.ino similarity index 71% rename from Lanes.ino rename to TrigorMortse.ino index 9a69685..3294435 100644 --- a/Lanes.ino +++ b/TrigorMortse.ino @@ -1,11 +1,10 @@ #include -#include "src/Lanes.h" #include -const int Lane1Pin = 9; //Output Channel 1 -const int Lane2Pin = 10; //Output Channel 2 -const int Lane3Pin = 11; //Output Channel 3 +const int Channel1 = 9; //Output Channel 1 +const int Channel2 = 10; //Output Channel 2 +const int Channel3 = 11; //Output Channel 3 const int Enc1P1 = 2; //Encoder 1 Pin 1 to Interrupt const int Enc2P1 = 3; //Encoder 2 Pin 1 to Interrupt const int Enc1P2 = 14; //Encoder 1 Pin 2 to non-Interrupting pin because we only have 2 @@ -18,7 +17,6 @@ const int DebounceTime = 10; //Debounce time in ms Encoder LeftEnc( Enc1P1, Enc1P2); Encoder RightEnc( Enc2P1, Enc2P2); -Lane LaneObject(Lane1Pin); int E1 = 0; int E2 = 0; @@ -35,12 +33,6 @@ float ClockTick = (1/((Clock * PpQN)/60)) * 1000; unsigned long ClockTime = 0; unsigned long LastStepTime = 0; long EncLeft, EncRight = 0; -long Lane1Pos, Lane2Pos, Lane3Pos, Lane1Time, Lane2Time, Lane3Time = 0; - -//Lanes are 4 dimensions 0 = Step Time, 1 = Step Voltage, 2 = Curve type (Linear, Expo, Log, Sine, etc) 3 = Curve Parameter. -int Lane1[4][16]; -int Lane2[4][16]; -int Lane3[4][16]; void setup() { @@ -61,26 +53,6 @@ void setup() { ClockState = digitalRead(ClockIn); CDPrev = digitalRead(ClockDetect); - //Initialize the Lanes - for(int i = 0; i < 16; i++){ - Lane1[0][i] = random(0, 96); - Lane1[1][i] = random(0, 255); - Lane1[2][i] = random(0, 2); - Lane1[3][i] = random(0,255); - Lane2[0][i] = random(0, 96); - Lane2[1][i] = random(0, 255); - Lane2[2][i] = random(0, 2); - Lane2[3][i] = random(0,255); - Lane3[0][i] = random(0, 96); - Lane3[1][i] = random(0, 255); - Lane3[2][i] = random(0, 2); - Lane3[3][i] = random(0,255); - } - - analogWrite( Lane1Pin, Lane1[1][0]); - analogWrite( Lane2Pin, Lane2[1][0]); - analogWrite( Lane3Pin, Lane3[1][0]); - // Timer0 is already used for millis() - we'll just interrupt somewhere // in the middle and call the "Compare A" function below OCR0A = 0xAF; @@ -173,27 +145,6 @@ void loop() { } unsigned long currentTime = millis(); - - if ((currentTime - LastStepTime) > ClockTick){ - ClockTime++; - LastStepTime = currentTime; - } - - if ((ClockTime - Lane1Time) > Lane1[0][Lane1Pos]){ - Lane1Pos = (Lane1Pos + 1) & B00001111; - Lane1Time = ClockTime; - analogWrite(Lane1Pin, Lane1[1][Lane1Pos]); - } - if ((ClockTime - Lane2Time) > Lane2[0][Lane2Pos]){ - Lane2Pos = (Lane2Pos + 1) & B00001111; - Lane2Time = ClockTime; - analogWrite(Lane2Pin, Lane2[1][Lane2Pos]); - } - if ((ClockTime - Lane3Time) > Lane3[0][Lane3Pos]){ - Lane3Pos = (Lane3Pos + 1) & B00001111; - Lane3Time = ClockTime; - analogWrite(Lane3Pin, Lane3[1][Lane3Pos]); - } } // Interrupt is called once a millisecond, diff --git a/src/Lanes.cpp b/src/Lanes.cpp deleted file mode 100644 index ba56000..0000000 --- a/src/Lanes.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "Lanes.h" - -/* -private: - int pin; - int pos; - int time; - int track[4][64]; - int end; - - Table for Expo curve with sign manipulation to alter direction and exp/log. Use linear interpolation to avoid aliasing on slow slopes. - - array of function pointers which share index with curve type. -*/ - -Lane::Lane(int OutputPin){ - pin = OutputPin; - analogWrite( pin, 0); - pos = 0; - time = 0; - end = 16; -}; -void Lane::Update(int CurrentTime){ - -}; -void Lane::Randomize(){ - -}; -int Lane::Positiion(){ - -}; -void Lane::StepUpdate(int Step, int Voltage, int Curve, int Param){ - -}; -void Lane::EndUpdate(int NewEnd){ - -}; \ No newline at end of file diff --git a/src/Lanes.h b/src/Lanes.h deleted file mode 100644 index 40efd2a..0000000 --- a/src/Lanes.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef Lanes_h -#define Lanes_h - -#include - -const int PROGMEM CurveTable[128] = {0,37,58,73,85,95,103,110,116,122,127,131,135,139,143,146,149,153,155,158,161,163,165,168,170,172,174,176,178,179,181,183,184,186,188,189,191,192,193,195,196,197,198,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,219,220,221,222,223,223,224,225,226,226,227,228,229,229,230,231,231,232,233,233,234,234,235,236,236,237,237,238,239,239,240,240,241,241,242,242,243,244,244,245,245,246,246,247,247,248,248,249,249,249,250,250,251,251,252,252,253,253,253,254,254,255,255,256,256}; - - -class Lane { -public: - Lane(int OutputPin); - void Update(int CurrentTime); - void Randomize(); - int Positiion(); - void StepUpdate(int Step, int Voltage, int Curve, int Param); - void EndUpdate(int NewEnd); - - -private: - int pin; - int pos; - int time; - int track[4][64]; - int end; - int startStep; - int endStep; -}; - -#endif \ No newline at end of file