mirror of
https://github.com/ShikyC/Taiko-Drum-Controller-Arduino.git
synced 2024-11-12 00:50:46 +01:00
minor bug fix
This commit is contained in:
parent
d54ed2a83a
commit
7f02ebbeae
@ -32,8 +32,8 @@ Cache <T, L>::Cache () {
|
||||
|
||||
template <class T, int L>
|
||||
void Cache <T, L>::put (T value) {
|
||||
data_ [current_] = value;
|
||||
current_ = (current_ + 1) % L;
|
||||
data_ [current_] = value;
|
||||
}
|
||||
|
||||
template <class T, int L>
|
||||
|
@ -3,25 +3,26 @@
|
||||
* Taiko Sanro - Arduino *
|
||||
* Support Arduino models with ATmega32u4 microprocessors *
|
||||
* *
|
||||
* Shiky Chang *
|
||||
* zhangxunpx@gmail.com *
|
||||
* Shiky Chang Chris *
|
||||
* zhangxunpx@gmail.com wisaly@gmail.com *
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
#define MODE_JIRO 1
|
||||
#define MODE_DEBUG 1
|
||||
#define MODE_DEBUG_SHOW_TIME 0
|
||||
|
||||
#define CHANNELS 4
|
||||
|
||||
#define SAMPLE_CACHE_LENGTH 50
|
||||
#define SAMPLE_CACHE_LENGTH 15
|
||||
#define POWER_CACHE_LENGTH 3
|
||||
|
||||
#define LIGHT_THRES 0
|
||||
#define HEAVY_THRES 70000
|
||||
#define LIGHT_THRES 500
|
||||
#define HEAVY_THRES 1000
|
||||
|
||||
#include <limits.h>
|
||||
#include <Keyboard.h>
|
||||
#include "cache.h"
|
||||
#include "limits.h"
|
||||
|
||||
#if MODE_JIRO
|
||||
#define HEAVY_THRES LONG_MAX
|
||||
@ -100,10 +101,14 @@ void loop() {
|
||||
if (isDescending) {
|
||||
if (power [i] >= HEAVY_THRES) {
|
||||
triggered [i] = true;
|
||||
#if !MODE_DEBUG
|
||||
Keyboard.print (heavyKeys [i]);
|
||||
#endif
|
||||
} else if (power [i] >= LIGHT_THRES) {
|
||||
triggered [i] = true;
|
||||
#if !MODE_DEBUG
|
||||
Keyboard.print (lightKeys [i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MODE_DEBUG
|
||||
@ -120,11 +125,19 @@ void loop() {
|
||||
}
|
||||
|
||||
#if MODE_DEBUG
|
||||
// Damn Arduino plotter, the Y axis scale changes much
|
||||
// too frequently! Use these 5000 and 0 values to "lock"
|
||||
// the plotter.
|
||||
Serial.print (5000);
|
||||
Serial.print ("\t");
|
||||
Serial.print (0);
|
||||
Serial.print ("\t");
|
||||
#if MODE_DEBUG_SHOW_TIME
|
||||
Serial.print (sampleLastTime);
|
||||
Serial.print ('\t');
|
||||
Serial.print (calcLastTime);
|
||||
#endif
|
||||
Serial.println ("");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user