application: add multiple welcome tracks

This commit is contained in:
King Kévin 2021-04-22 21:21:26 +02:00
parent a22de00ee8
commit 08134e0d88
1 changed files with 3 additions and 1 deletions

View File

@ -147,6 +147,8 @@ static enum playing_state_t {
/** RTC timestamps when the last MP3 response track finished has been received */
static uint32_t last_finished = 0;
/** number of possible welcome tacks */
#define WELCOME_TRACKS 15
/** number of possible music tracks */
#define MUSIC_TRACKS 24
/** number of possible exit message tracks */
@ -803,7 +805,7 @@ void main(void)
leds_sign(true); // show on the sign that the toilet is occupied
led_tm1637_time(0, 0); // start showing time on display
led_tm1637_on(); // ensure the display is on
mp3_command(MP3_CMD_PLAY_FOLDER_FILE, (1 << 8) + 1); // play welcome track
mp3_command(MP3_CMD_PLAY_FOLDER_FILE, (1 << 8) + (rtc_get_counter_val() % WELCOME_TRACKS) + 1); // play random welcome track
playing_state = PLAYING_STATE_INTRO; // remember we are playing the welcome message
} else if (!closed && timer_door_closed) { // door has been opened
puts("door opened\n");