[+] Loop both
This commit is contained in:
+55
-49
@@ -179,7 +179,7 @@ int multisampleRead(int pin, int samples)
|
|||||||
return (int) round(((double) sum) / samples);
|
return (int) round(((double) sum) / samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loopPanel()
|
||||||
{
|
{
|
||||||
const auto hue_interval = 512;
|
const auto hue_interval = 512;
|
||||||
last_hue += hue_interval;
|
last_hue += hue_interval;
|
||||||
@@ -250,51 +250,57 @@ void loop()
|
|||||||
p_led_rotary.show();
|
p_led_rotary.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void loop()
|
void loopKeyboard()
|
||||||
//{
|
{
|
||||||
// u64 time = timeMillis();
|
u64 time = timeMillis();
|
||||||
// u64 elapsed = time - last_refresh_time;
|
u64 elapsed = time - last_refresh_time;
|
||||||
// last_refresh_time = time;
|
last_refresh_time = time;
|
||||||
//
|
|
||||||
// // Report FPS every second
|
// Report FPS every second
|
||||||
// fps_time_counter += elapsed;
|
fps_time_counter += elapsed;
|
||||||
// fps_updates++;
|
fps_updates++;
|
||||||
// if (fps_time_counter >= fps_interval_ms)
|
if (fps_time_counter >= fps_interval_ms)
|
||||||
// {
|
{
|
||||||
// fps_time_counter -= fps_interval_ms;
|
fps_time_counter -= fps_interval_ms;
|
||||||
// double fps = 1.0 * fps_updates / fps_interval_ms * 1000;
|
double fps = 1.0 * fps_updates / fps_interval_ms * 1000;
|
||||||
// Serial.printf("FPS: %.2f\r\n", fps);
|
Serial.printf("FPS: %.2f\r\n", fps);
|
||||||
// fps_updates = 0;
|
fps_updates = 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // Toggle LED refresh indicator
|
// Toggle LED refresh indicator
|
||||||
// digitalWrite(LED_REFRESH, led_refresh_on = !led_refresh_on);
|
digitalWrite(LED_REFRESH, led_refresh_on = !led_refresh_on);
|
||||||
//
|
|
||||||
// // Loop through each multiplexer state
|
// Loop through each multiplexer state
|
||||||
// for (int i = 0; i < PINS_PER_MUX; i++)
|
for (int i = 0; i < PINS_PER_MUX; i++)
|
||||||
// {
|
{
|
||||||
// // Set select pins
|
// Set select pins
|
||||||
// for (int j = 0; j < NUM_MUX_SEL; j++)
|
for (int j = 0; j < NUM_MUX_SEL; j++)
|
||||||
// {
|
{
|
||||||
// // i >> j is the jth bit of i
|
// i >> j is the jth bit of i
|
||||||
// digitalWrite(MUX_SEL_OUT[j], (i >> j) & 1);
|
digitalWrite(MUX_SEL_OUT[j], (i >> j) & 1);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // Read four input pins from the multiplexer
|
// Read four input pins from the multiplexer
|
||||||
// for (int j = 0; j < NUM_MUX; j++)
|
for (int j = 0; j < NUM_MUX; j++)
|
||||||
// {
|
{
|
||||||
// int note_id = j * PINS_PER_MUX + i;
|
int note_id = j * PINS_PER_MUX + i;
|
||||||
// if (note_id >= NUM_NOTES) break;
|
if (note_id >= NUM_NOTES) break;
|
||||||
//
|
|
||||||
// // Read the analog input
|
// Read the analog input
|
||||||
// u32 v = analogRead(MUX_IN[j]);
|
u32 v = analogRead(MUX_IN[j]);
|
||||||
// if (v != lasts[note_id])
|
if (v != lasts[note_id])
|
||||||
// {
|
{
|
||||||
// // Serial prints are really slow, so don't use them in debug mode
|
// Serial prints are really slow, so don't use them in debug mode
|
||||||
// // Serial.printf("%s %d\r\n", notes[note_id].name, v);
|
// Serial.printf("%s %d\r\n", notes[note_id].name, v);
|
||||||
// on_sensor_update(note_id, time, lasts[note_id], v);
|
on_sensor_update(note_id, time, lasts[note_id], v);
|
||||||
// }
|
}
|
||||||
// lasts[note_id] = v;
|
lasts[note_id] = v;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
loopKeyboard();
|
||||||
|
loopPanel();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user