diff --git a/Extra/BPM_Calc_Test/BPM_Calc_Test.ino b/Extra/BPM_Calc_Test/BPM_Calc_Test.ino new file mode 100644 index 0000000..6187e83 --- /dev/null +++ b/Extra/BPM_Calc_Test/BPM_Calc_Test.ino @@ -0,0 +1,36 @@ +// +//Abel: at 120bpm the actual output is 119.3bpm (47.7Hz). Does this depend on each individual power supply? Would it be possible to calibrate 120bpm to 48Hz? +// +// in theory it should be 600000 / (120 * 24) = 208.333(3). 20.8ms should result in 48.076923076923 +#include +#include + + +//uint16_t pulsePeriod; //useful range of 0 to 65,535 ((2^16) - 1). +UFixed<7, 9> bpm = 120; //0-255 + +#define PPQN 24 +#define PULSE_LENGTH 120 //1/10ms resolution. 12ms was failing at 1ms resolution at higher bpm. 60000/200/24 = 12.5 the max pulse length at 1ms resolution for 200bpm is 11ms +#define MAXBPM 200 //250 at 24ppqn with 5ms pulse will be 50/50 square wave +#define MINBPM 20 + +void setup() { + Serial.begin(19200); + int pulsePeriod = 600000 / (bpm.getInteger() * PPQN); + Serial.print("original uint16_t: "); + Serial.println(pulsePeriod); + float floatperiod = 600000 / ((float)bpm * (float)PPQN); + Serial.print("float: "); + Serial.println(floatperiod); + // fpperiod = 600000 / (bpm * PPQN); + //Serial.print("UQ8x8: "); + //Serial.println((float)fpperiod); + UFixed<7, 9> fpperiodplus = 600000 / (bpm * PPQN); + Serial.print("UQ7x9: "); + Serial.println((float)fpperiodplus); +} + +void loop() { + // put your main code here, to run repeatedly: + +} \ No newline at end of file diff --git a/Software/Gravity/Gravity.ino b/Software/Gravity/Gravity.ino index 2879bb4..a60e059 100644 --- a/Software/Gravity/Gravity.ino +++ b/Software/Gravity/Gravity.ino @@ -6,7 +6,7 @@ #include #include -#define VERSION "V:1.1.1B" +#define VERSION "V:1.1.1" byte memCode = 'D'; //Change to different letter if you changed the data structure