scottgchin / delta5_race_timer

Multi-node video transmitter race timer for drone racing
MIT License
159 stars 62 forks source link

Improve phonetic readout of lap + time #81

Open PaulWieland opened 6 years ago

PaulWieland commented 6 years ago

Right now the phonetic readout of the pilot plus lap plus time is a bit hard to comprehend because the lap number bleeds into the time.

Example: "Paul lap one one minute five seconds"

I believe this is the line responsible:

https://github.com/scottgchin/delta5_race_timer/blob/47a35739f8de409c27af11655828dc35512c076c/src/delta5server/templates/race.html#L94

I am going to try modifying this function on our timer to something like this (to be tested still):

        socket.on('phonetic_data', function (msg) {
            //  var $ttstest = msg.pilot + " lap " + msg.lap + " " + msg.phonetic;

            var phoneticLap="";
            switch(msg.lap){
                case 1: phoneticLap = "st"; break;
                case 2: phoneticLap = "nd"; break;
                case 3: phoneticLap = "rd"; break;
                default: phoneticLap = "th"; break;
            }
            var $ttstest = msg.pilot + " " + msg.lap + phoneticLap + " lap " + msg.lap + " " + msg.phonetic;

            speak('<div class="speech">' + $ttstest + '</div> div.speech');             
        })

That should hopefully cause it to say: "Paul first lap one minute five seconds"