update BPM to support one decimal place
This commit is contained in:
parent
c61a6af387
commit
425d8e28f7
2 changed files with 10 additions and 10 deletions
|
|
@ -397,21 +397,21 @@ void DisplayHandler::render() {
|
|||
}
|
||||
|
||||
void DisplayHandler::renderMainPage() {
|
||||
std::string bpm_string = "BPM: " + std::to_string((uint8_t)BPM);
|
||||
|
||||
char bpm_buffer[16];
|
||||
snprintf(bpm_buffer, sizeof(bpm_buffer), "BPM %.1f", BPM);
|
||||
if (cursorPosition == 0) {
|
||||
if (cursorClick == 1) {
|
||||
pico_ssd1306::fillRect(display, 0, 0, 100, 18);
|
||||
pico_ssd1306::drawText(display, font_12x16, bpm_string.c_str(), 1, 2,
|
||||
pico_ssd1306::fillRect(display, 0, 0, 110, 18);
|
||||
pico_ssd1306::drawText(display, font_12x16, bpm_buffer, 1, 2,
|
||||
pico_ssd1306::WriteMode::SUBTRACT);
|
||||
|
||||
} else {
|
||||
pico_ssd1306::drawRect(display, 0, 0, 100, 18,
|
||||
pico_ssd1306::drawRect(display, 0, 0, 110, 18,
|
||||
pico_ssd1306::WriteMode::ADD);
|
||||
pico_ssd1306::drawText(display, font_12x16, bpm_string.c_str(), 1, 2);
|
||||
pico_ssd1306::drawText(display, font_12x16, bpm_buffer, 1, 2);
|
||||
}
|
||||
} else {
|
||||
pico_ssd1306::drawText(display, font_12x16, bpm_string.c_str(), 1, 2);
|
||||
pico_ssd1306::drawText(display, font_12x16, bpm_buffer, 1, 2);
|
||||
}
|
||||
|
||||
uint8_t cursor_x = 2;
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ void update_period() {
|
|||
|
||||
void update_BPM(bool up) {
|
||||
if (up) {
|
||||
BPM++;
|
||||
BPM += 0.5;
|
||||
} else {
|
||||
BPM--;
|
||||
BPM -= 0.5;
|
||||
}
|
||||
|
||||
update_period();
|
||||
|
|
@ -358,7 +358,7 @@ int main() {
|
|||
last_ppqn_idx = EXTPPQNIdx;
|
||||
}
|
||||
|
||||
BPM = (uint8_t)(filteredBPM + 0.5f);
|
||||
BPM = filteredBPM;
|
||||
|
||||
if (PLAY) {
|
||||
for (Gate *g : outputs) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue