diff --git a/SD-card/01/0001-dialtone.mp3 b/SD-card/01/0001-dialtone.mp3 deleted file mode 100644 index 50090c9..0000000 Binary files a/SD-card/01/0001-dialtone.mp3 and /dev/null differ diff --git a/SD-card/01/0002-disconnected.mp3 b/SD-card/01/0002-disconnected.mp3 deleted file mode 100644 index 4a00c39..0000000 Binary files a/SD-card/01/0002-disconnected.mp3 and /dev/null differ diff --git a/SD-card/01/0003-number_out_of_service.mp3 b/SD-card/01/0003-number_out_of_service.mp3 deleted file mode 100644 index a9017fe..0000000 Binary files a/SD-card/01/0003-number_out_of_service.mp3 and /dev/null differ diff --git a/SD-card/01/001-Zoek de zon op.mp3 b/SD-card/01/001-Zoek de zon op.mp3 new file mode 100644 index 0000000..eda78ff Binary files /dev/null and b/SD-card/01/001-Zoek de zon op.mp3 differ diff --git a/SD-card/MP3/0002-Op een mooie pinksterdag.mp3 b/SD-card/01/002-Op een mooie pinksterdag.mp3 similarity index 100% rename from SD-card/MP3/0002-Op een mooie pinksterdag.mp3 rename to SD-card/01/002-Op een mooie pinksterdag.mp3 diff --git a/SD-card/MP3/0003-Daar in dat kleine cafe.mp3 b/SD-card/01/003-Daar in dat kleine cafe.mp3 similarity index 100% rename from SD-card/MP3/0003-Daar in dat kleine cafe.mp3 rename to SD-card/01/003-Daar in dat kleine cafe.mp3 diff --git a/SD-card/01/004-Als ik tweemaal met mijn fietsbel.mp3 b/SD-card/01/004-Als ik tweemaal met mijn fietsbel.mp3 new file mode 100644 index 0000000..cee22c5 Binary files /dev/null and b/SD-card/01/004-Als ik tweemaal met mijn fietsbel.mp3 differ diff --git a/SD-card/MP3/0005-Breng eens een zonnetje.mp3 b/SD-card/01/005-Breng eens een zonnetje.mp3 similarity index 100% rename from SD-card/MP3/0005-Breng eens een zonnetje.mp3 rename to SD-card/01/005-Breng eens een zonnetje.mp3 diff --git a/SD-card/MP3/0006-Het dorp.mp3 b/SD-card/01/006-Het dorp.mp3 similarity index 100% rename from SD-card/MP3/0006-Het dorp.mp3 rename to SD-card/01/006-Het dorp.mp3 diff --git a/SD-card/01/007-Twee motten.mp3 b/SD-card/01/007-Twee motten.mp3 new file mode 100644 index 0000000..774379f Binary files /dev/null and b/SD-card/01/007-Twee motten.mp3 differ diff --git a/SD-card/MP3/0008-Spiegelbeeld.mp3 b/SD-card/01/008-Spiegelbeeld.mp3 similarity index 100% rename from SD-card/MP3/0008-Spiegelbeeld.mp3 rename to SD-card/01/008-Spiegelbeeld.mp3 diff --git a/SD-card/MP3/0009-Het is weer voorbij die mooie zomer.mp3 b/SD-card/01/009-Het is weer voorbij die mooie zomer.mp3 similarity index 100% rename from SD-card/MP3/0009-Het is weer voorbij die mooie zomer.mp3 rename to SD-card/01/009-Het is weer voorbij die mooie zomer.mp3 diff --git a/SD-card/MP3/0000-Aan de amsterdamse grachten.mp3 b/SD-card/01/010-Aan de amsterdamse grachten.mp3 similarity index 100% rename from SD-card/MP3/0000-Aan de amsterdamse grachten.mp3 rename to SD-card/01/010-Aan de amsterdamse grachten.mp3 diff --git a/SD-card/02/001.mp3 b/SD-card/02/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/001.mp3 differ diff --git a/SD-card/02/002.mp3 b/SD-card/02/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/002.mp3 differ diff --git a/SD-card/02/003.mp3 b/SD-card/02/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/003.mp3 differ diff --git a/SD-card/02/004.mp3 b/SD-card/02/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/004.mp3 differ diff --git a/SD-card/02/005.mp3 b/SD-card/02/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/005.mp3 differ diff --git a/SD-card/02/006.mp3 b/SD-card/02/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/006.mp3 differ diff --git a/SD-card/02/007.mp3 b/SD-card/02/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/007.mp3 differ diff --git a/SD-card/02/008.mp3 b/SD-card/02/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/008.mp3 differ diff --git a/SD-card/02/009.mp3 b/SD-card/02/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/009.mp3 differ diff --git a/SD-card/02/010.mp3 b/SD-card/02/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/02/010.mp3 differ diff --git a/SD-card/02/1969.mp3 b/SD-card/02/1969.mp3 deleted file mode 100644 index 8600b91..0000000 Binary files a/SD-card/02/1969.mp3 and /dev/null differ diff --git a/SD-card/02/1976.mp3 b/SD-card/02/1976.mp3 deleted file mode 100644 index 9d59b70..0000000 Binary files a/SD-card/02/1976.mp3 and /dev/null differ diff --git a/SD-card/02/1986.mp3 b/SD-card/02/1986.mp3 deleted file mode 100644 index d013e35..0000000 Binary files a/SD-card/02/1986.mp3 and /dev/null differ diff --git a/SD-card/02/2006.mp3 b/SD-card/02/2006.mp3 deleted file mode 100644 index 8d9414a..0000000 Binary files a/SD-card/02/2006.mp3 and /dev/null differ diff --git a/SD-card/03/001.mp3 b/SD-card/03/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/001.mp3 differ diff --git a/SD-card/03/002.mp3 b/SD-card/03/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/002.mp3 differ diff --git a/SD-card/03/003.mp3 b/SD-card/03/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/003.mp3 differ diff --git a/SD-card/03/004.mp3 b/SD-card/03/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/004.mp3 differ diff --git a/SD-card/03/005.mp3 b/SD-card/03/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/005.mp3 differ diff --git a/SD-card/03/006.mp3 b/SD-card/03/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/006.mp3 differ diff --git a/SD-card/03/007.mp3 b/SD-card/03/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/007.mp3 differ diff --git a/SD-card/03/008.mp3 b/SD-card/03/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/008.mp3 differ diff --git a/SD-card/03/009.mp3 b/SD-card/03/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/009.mp3 differ diff --git a/SD-card/03/010.mp3 b/SD-card/03/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/03/010.mp3 differ diff --git a/SD-card/04/001.mp3 b/SD-card/04/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/001.mp3 differ diff --git a/SD-card/04/002.mp3 b/SD-card/04/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/002.mp3 differ diff --git a/SD-card/04/003.mp3 b/SD-card/04/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/003.mp3 differ diff --git a/SD-card/04/004.mp3 b/SD-card/04/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/004.mp3 differ diff --git a/SD-card/04/005.mp3 b/SD-card/04/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/005.mp3 differ diff --git a/SD-card/04/006.mp3 b/SD-card/04/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/006.mp3 differ diff --git a/SD-card/04/007.mp3 b/SD-card/04/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/007.mp3 differ diff --git a/SD-card/04/008.mp3 b/SD-card/04/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/008.mp3 differ diff --git a/SD-card/04/009.mp3 b/SD-card/04/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/009.mp3 differ diff --git a/SD-card/04/010.mp3 b/SD-card/04/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/04/010.mp3 differ diff --git a/SD-card/05/001.mp3 b/SD-card/05/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/001.mp3 differ diff --git a/SD-card/05/002.mp3 b/SD-card/05/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/002.mp3 differ diff --git a/SD-card/05/003.mp3 b/SD-card/05/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/003.mp3 differ diff --git a/SD-card/05/004.mp3 b/SD-card/05/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/004.mp3 differ diff --git a/SD-card/05/005.mp3 b/SD-card/05/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/005.mp3 differ diff --git a/SD-card/05/006.mp3 b/SD-card/05/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/006.mp3 differ diff --git a/SD-card/05/007.mp3 b/SD-card/05/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/007.mp3 differ diff --git a/SD-card/05/008.mp3 b/SD-card/05/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/008.mp3 differ diff --git a/SD-card/05/009.mp3 b/SD-card/05/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/009.mp3 differ diff --git a/SD-card/05/010.mp3 b/SD-card/05/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/05/010.mp3 differ diff --git a/SD-card/06/001.mp3 b/SD-card/06/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/001.mp3 differ diff --git a/SD-card/06/002.mp3 b/SD-card/06/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/002.mp3 differ diff --git a/SD-card/06/003.mp3 b/SD-card/06/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/003.mp3 differ diff --git a/SD-card/06/004.mp3 b/SD-card/06/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/004.mp3 differ diff --git a/SD-card/06/005.mp3 b/SD-card/06/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/005.mp3 differ diff --git a/SD-card/06/006.mp3 b/SD-card/06/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/006.mp3 differ diff --git a/SD-card/06/007.mp3 b/SD-card/06/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/007.mp3 differ diff --git a/SD-card/06/008.mp3 b/SD-card/06/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/008.mp3 differ diff --git a/SD-card/06/009.mp3 b/SD-card/06/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/009.mp3 differ diff --git a/SD-card/06/010.mp3 b/SD-card/06/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/06/010.mp3 differ diff --git a/SD-card/07/001.mp3 b/SD-card/07/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/001.mp3 differ diff --git a/SD-card/07/002.mp3 b/SD-card/07/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/002.mp3 differ diff --git a/SD-card/07/003.mp3 b/SD-card/07/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/003.mp3 differ diff --git a/SD-card/07/004.mp3 b/SD-card/07/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/004.mp3 differ diff --git a/SD-card/07/005.mp3 b/SD-card/07/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/005.mp3 differ diff --git a/SD-card/07/006.mp3 b/SD-card/07/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/006.mp3 differ diff --git a/SD-card/07/007.mp3 b/SD-card/07/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/007.mp3 differ diff --git a/SD-card/07/008.mp3 b/SD-card/07/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/008.mp3 differ diff --git a/SD-card/07/009.mp3 b/SD-card/07/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/009.mp3 differ diff --git a/SD-card/07/010.mp3 b/SD-card/07/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/07/010.mp3 differ diff --git a/SD-card/08/001.mp3 b/SD-card/08/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/001.mp3 differ diff --git a/SD-card/08/002.mp3 b/SD-card/08/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/002.mp3 differ diff --git a/SD-card/08/003.mp3 b/SD-card/08/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/003.mp3 differ diff --git a/SD-card/08/004.mp3 b/SD-card/08/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/004.mp3 differ diff --git a/SD-card/08/005.mp3 b/SD-card/08/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/005.mp3 differ diff --git a/SD-card/08/006.mp3 b/SD-card/08/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/006.mp3 differ diff --git a/SD-card/08/007.mp3 b/SD-card/08/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/007.mp3 differ diff --git a/SD-card/08/008.mp3 b/SD-card/08/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/008.mp3 differ diff --git a/SD-card/08/009.mp3 b/SD-card/08/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/009.mp3 differ diff --git a/SD-card/08/010.mp3 b/SD-card/08/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/08/010.mp3 differ diff --git a/SD-card/09/001.mp3 b/SD-card/09/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/001.mp3 differ diff --git a/SD-card/09/002.mp3 b/SD-card/09/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/002.mp3 differ diff --git a/SD-card/09/003.mp3 b/SD-card/09/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/003.mp3 differ diff --git a/SD-card/09/004.mp3 b/SD-card/09/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/004.mp3 differ diff --git a/SD-card/09/005.mp3 b/SD-card/09/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/005.mp3 differ diff --git a/SD-card/09/006.mp3 b/SD-card/09/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/006.mp3 differ diff --git a/SD-card/09/007.mp3 b/SD-card/09/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/007.mp3 differ diff --git a/SD-card/09/008.mp3 b/SD-card/09/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/008.mp3 differ diff --git a/SD-card/09/009.mp3 b/SD-card/09/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/009.mp3 differ diff --git a/SD-card/09/010.mp3 b/SD-card/09/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/09/010.mp3 differ diff --git a/SD-card/10/001.mp3 b/SD-card/10/001.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/001.mp3 differ diff --git a/SD-card/10/002.mp3 b/SD-card/10/002.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/002.mp3 differ diff --git a/SD-card/10/003.mp3 b/SD-card/10/003.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/003.mp3 differ diff --git a/SD-card/10/004.mp3 b/SD-card/10/004.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/004.mp3 differ diff --git a/SD-card/10/005.mp3 b/SD-card/10/005.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/005.mp3 differ diff --git a/SD-card/10/006.mp3 b/SD-card/10/006.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/006.mp3 differ diff --git a/SD-card/10/007.mp3 b/SD-card/10/007.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/007.mp3 differ diff --git a/SD-card/10/008.mp3 b/SD-card/10/008.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/008.mp3 differ diff --git a/SD-card/10/009.mp3 b/SD-card/10/009.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/009.mp3 differ diff --git a/SD-card/10/010.mp3 b/SD-card/10/010.mp3 new file mode 100644 index 0000000..e36d2b8 Binary files /dev/null and b/SD-card/10/010.mp3 differ diff --git a/SD-card/90/001-dialtone.mp3 b/SD-card/90/001-dialtone.mp3 new file mode 100644 index 0000000..03b4779 Binary files /dev/null and b/SD-card/90/001-dialtone.mp3 differ diff --git a/SD-card/90/002-disconnected.mp3 b/SD-card/90/002-disconnected.mp3 new file mode 100644 index 0000000..a9a07ed Binary files /dev/null and b/SD-card/90/002-disconnected.mp3 differ diff --git a/SD-card/90/003-number_out_of_service.mp3 b/SD-card/90/003-number_out_of_service.mp3 new file mode 100644 index 0000000..6d7a961 Binary files /dev/null and b/SD-card/90/003-number_out_of_service.mp3 differ diff --git a/SD-card/90/004_Emergency number.mp3 b/SD-card/90/004_Emergency number.mp3 new file mode 100644 index 0000000..0d3afd5 Binary files /dev/null and b/SD-card/90/004_Emergency number.mp3 differ diff --git a/SD-card/90/005_bestand_niet_gevonden.mp3 b/SD-card/90/005_bestand_niet_gevonden.mp3 new file mode 100644 index 0000000..9dfe5a5 Binary files /dev/null and b/SD-card/90/005_bestand_niet_gevonden.mp3 differ diff --git a/SD-card/90/006_deze instelling is niet mogelijk.mp3 b/SD-card/90/006_deze instelling is niet mogelijk.mp3 new file mode 100644 index 0000000..5095cf0 Binary files /dev/null and b/SD-card/90/006_deze instelling is niet mogelijk.mp3 differ diff --git a/SD-card/90/007_uitgeschakeld.mp3 b/SD-card/90/007_uitgeschakeld.mp3 new file mode 100644 index 0000000..7e71f58 Binary files /dev/null and b/SD-card/90/007_uitgeschakeld.mp3 differ diff --git a/SD-card/90/008_ingeschakeld.mp3 b/SD-card/90/008_ingeschakeld.mp3 new file mode 100644 index 0000000..da60c03 Binary files /dev/null and b/SD-card/90/008_ingeschakeld.mp3 differ diff --git a/SD-card/90/009_silence_10sec.mp3 b/SD-card/90/009_silence_10sec.mp3 new file mode 100644 index 0000000..a74937c Binary files /dev/null and b/SD-card/90/009_silence_10sec.mp3 differ diff --git a/SD-card/90/010_0.mp3 b/SD-card/90/010_0.mp3 new file mode 100644 index 0000000..13800a3 Binary files /dev/null and b/SD-card/90/010_0.mp3 differ diff --git a/SD-card/90/011_1.mp3 b/SD-card/90/011_1.mp3 new file mode 100644 index 0000000..cd2696d Binary files /dev/null and b/SD-card/90/011_1.mp3 differ diff --git a/SD-card/90/012_2.mp3 b/SD-card/90/012_2.mp3 new file mode 100644 index 0000000..1fb0e12 Binary files /dev/null and b/SD-card/90/012_2.mp3 differ diff --git a/SD-card/90/013_3.mp3 b/SD-card/90/013_3.mp3 new file mode 100644 index 0000000..7b85ea3 Binary files /dev/null and b/SD-card/90/013_3.mp3 differ diff --git a/SD-card/90/014_4.mp3 b/SD-card/90/014_4.mp3 new file mode 100644 index 0000000..529e7d3 Binary files /dev/null and b/SD-card/90/014_4.mp3 differ diff --git a/SD-card/90/015_5.mp3 b/SD-card/90/015_5.mp3 new file mode 100644 index 0000000..bfb4995 Binary files /dev/null and b/SD-card/90/015_5.mp3 differ diff --git a/SD-card/90/016_6.mp3 b/SD-card/90/016_6.mp3 new file mode 100644 index 0000000..c94b854 Binary files /dev/null and b/SD-card/90/016_6.mp3 differ diff --git a/SD-card/90/017_7.mp3 b/SD-card/90/017_7.mp3 new file mode 100644 index 0000000..b6d8d13 Binary files /dev/null and b/SD-card/90/017_7.mp3 differ diff --git a/SD-card/90/018_8.mp3 b/SD-card/90/018_8.mp3 new file mode 100644 index 0000000..c1f30bb Binary files /dev/null and b/SD-card/90/018_8.mp3 differ diff --git a/SD-card/90/019_9.mp3 b/SD-card/90/019_9.mp3 new file mode 100644 index 0000000..c3f30db Binary files /dev/null and b/SD-card/90/019_9.mp3 differ diff --git a/SD-card/90/021_10%.mp3 b/SD-card/90/021_10%.mp3 new file mode 100644 index 0000000..6530f10 Binary files /dev/null and b/SD-card/90/021_10%.mp3 differ diff --git a/SD-card/90/022_20%.mp3 b/SD-card/90/022_20%.mp3 new file mode 100644 index 0000000..67d11bb Binary files /dev/null and b/SD-card/90/022_20%.mp3 differ diff --git a/SD-card/90/023_30%.mp3 b/SD-card/90/023_30%.mp3 new file mode 100644 index 0000000..69f796d Binary files /dev/null and b/SD-card/90/023_30%.mp3 differ diff --git a/SD-card/90/024_40%.mp3 b/SD-card/90/024_40%.mp3 new file mode 100644 index 0000000..8ee7a68 Binary files /dev/null and b/SD-card/90/024_40%.mp3 differ diff --git a/SD-card/90/025_50%.mp3 b/SD-card/90/025_50%.mp3 new file mode 100644 index 0000000..0821227 Binary files /dev/null and b/SD-card/90/025_50%.mp3 differ diff --git a/SD-card/90/026_60%.mp3 b/SD-card/90/026_60%.mp3 new file mode 100644 index 0000000..1352b88 Binary files /dev/null and b/SD-card/90/026_60%.mp3 differ diff --git a/SD-card/90/027_70%.mp3 b/SD-card/90/027_70%.mp3 new file mode 100644 index 0000000..5fff3c8 Binary files /dev/null and b/SD-card/90/027_70%.mp3 differ diff --git a/SD-card/90/028_80%.mp3 b/SD-card/90/028_80%.mp3 new file mode 100644 index 0000000..583eba5 Binary files /dev/null and b/SD-card/90/028_80%.mp3 differ diff --git a/SD-card/90/029_90%.mp3 b/SD-card/90/029_90%.mp3 new file mode 100644 index 0000000..6d443b5 Binary files /dev/null and b/SD-card/90/029_90%.mp3 differ diff --git a/SD-card/90/030_100%.mp3 b/SD-card/90/030_100%.mp3 new file mode 100644 index 0000000..6bd4790 Binary files /dev/null and b/SD-card/90/030_100%.mp3 differ diff --git a/SD-card/90/100_dit is de telejukbox.mp3 b/SD-card/90/100_dit is de telejukbox.mp3 new file mode 100644 index 0000000..3353462 Binary files /dev/null and b/SD-card/90/100_dit is de telejukbox.mp3 differ diff --git a/SD-card/90/101_Welkom bij het menu.mp3 b/SD-card/90/101_Welkom bij het menu.mp3 new file mode 100644 index 0000000..4d1fe94 Binary files /dev/null and b/SD-card/90/101_Welkom bij het menu.mp3 differ diff --git a/SD-card/90/102_Maak nu uw keuze.mp3 b/SD-card/90/102_Maak nu uw keuze.mp3 new file mode 100644 index 0000000..64a9838 Binary files /dev/null and b/SD-card/90/102_Maak nu uw keuze.mp3 differ diff --git a/SD-card/90/103_Uw keuze is.mp3 b/SD-card/90/103_Uw keuze is.mp3 new file mode 100644 index 0000000..57e3913 Binary files /dev/null and b/SD-card/90/103_Uw keuze is.mp3 differ diff --git a/SD-card/90/104_Volume.mp3 b/SD-card/90/104_Volume.mp3 new file mode 100644 index 0000000..492a5d3 Binary files /dev/null and b/SD-card/90/104_Volume.mp3 differ diff --git a/SD-card/90/105_Muziekmap.mp3 b/SD-card/90/105_Muziekmap.mp3 new file mode 100644 index 0000000..5dd7113 Binary files /dev/null and b/SD-card/90/105_Muziekmap.mp3 differ diff --git a/SD-card/90/108_Easter egg functie.mp3 b/SD-card/90/108_Easter egg functie.mp3 new file mode 100644 index 0000000..f16f2f5 Binary files /dev/null and b/SD-card/90/108_Easter egg functie.mp3 differ diff --git a/SD-card/90/109_De nieuwe instelling is opgeslagen.mp3 b/SD-card/90/109_De nieuwe instelling is opgeslagen.mp3 new file mode 100644 index 0000000..618d364 Binary files /dev/null and b/SD-card/90/109_De nieuwe instelling is opgeslagen.mp3 differ diff --git a/SD-card/90/110_U koos voor 1, het instellen van het volume.mp3 b/SD-card/90/110_U koos voor 1, het instellen van het volume.mp3 new file mode 100644 index 0000000..4eaf30a Binary files /dev/null and b/SD-card/90/110_U koos voor 1, het instellen van het volume.mp3 differ diff --git a/SD-card/90/111_Het volume is nu ingesteld op.mp3 b/SD-card/90/111_Het volume is nu ingesteld op.mp3 new file mode 100644 index 0000000..33af33b Binary files /dev/null and b/SD-card/90/111_Het volume is nu ingesteld op.mp3 differ diff --git a/SD-card/90/120_U koos voor 2, het selecteren van de muziekmap.mp3 b/SD-card/90/120_U koos voor 2, het selecteren van de muziekmap.mp3 new file mode 100644 index 0000000..fcfedb2 Binary files /dev/null and b/SD-card/90/120_U koos voor 2, het selecteren van de muziekmap.mp3 differ diff --git a/SD-card/90/121_De muziekmap is nu ingesteld op.mp3 b/SD-card/90/121_De muziekmap is nu ingesteld op.mp3 new file mode 100644 index 0000000..d3c5a22 Binary files /dev/null and b/SD-card/90/121_De muziekmap is nu ingesteld op.mp3 differ diff --git a/SD-card/90/130_U koos voor 3, het instellen van de easter egg functie.mp3 b/SD-card/90/130_U koos voor 3, het instellen van de easter egg functie.mp3 new file mode 100644 index 0000000..7d2ada2 Binary files /dev/null and b/SD-card/90/130_U koos voor 3, het instellen van de easter egg functie.mp3 differ diff --git a/SD-card/90/131_De easter egg functie is nu.mp3 b/SD-card/90/131_De easter egg functie is nu.mp3 new file mode 100644 index 0000000..0602435 Binary files /dev/null and b/SD-card/90/131_De easter egg functie is nu.mp3 differ diff --git a/SD-card/02/0002.mp3 b/SD-card/99/002.mp3 similarity index 100% rename from SD-card/02/0002.mp3 rename to SD-card/99/002.mp3 diff --git a/SD-card/02/0003.mp3 b/SD-card/99/003.mp3 similarity index 100% rename from SD-card/02/0003.mp3 rename to SD-card/99/003.mp3 diff --git a/SD-card/02/0008.mp3 b/SD-card/99/008.mp3 similarity index 100% rename from SD-card/02/0008.mp3 rename to SD-card/99/008.mp3 diff --git a/SD-card/02/1945.mp3 b/SD-card/99/045.mp3 similarity index 100% rename from SD-card/02/1945.mp3 rename to SD-card/99/045.mp3 diff --git a/SD-card/02/1947.mp3 b/SD-card/99/047.mp3 similarity index 100% rename from SD-card/02/1947.mp3 rename to SD-card/99/047.mp3 diff --git a/SD-card/02/1950.mp3 b/SD-card/99/050.mp3 similarity index 100% rename from SD-card/02/1950.mp3 rename to SD-card/99/050.mp3 diff --git a/SD-card/MP3/0001-Voor haar.mp3 b/SD-card/MP3/0001-Voor haar.mp3 deleted file mode 100644 index 4ada41a..0000000 Binary files a/SD-card/MP3/0001-Voor haar.mp3 and /dev/null differ diff --git a/SD-card/MP3/0004-In een rijtuigie.mp3 b/SD-card/MP3/0004-In een rijtuigie.mp3 deleted file mode 100644 index 7ee0695..0000000 Binary files a/SD-card/MP3/0004-In een rijtuigie.mp3 and /dev/null differ diff --git a/SD-card/MP3/0007-Weet je nog wel.mp3 b/SD-card/MP3/0007-Weet je nog wel.mp3 deleted file mode 100644 index ba436f3..0000000 Binary files a/SD-card/MP3/0007-Weet je nog wel.mp3 and /dev/null differ diff --git a/SD-card/_readme.txt b/SD-card/_readme.txt deleted file mode 100644 index b3996b8..0000000 --- a/SD-card/_readme.txt +++ /dev/null @@ -1,20 +0,0 @@ -This card must contain the following folders: ---------------------------------------------- - -MP3 = Files in this folder "MP3" are coupled to the numbers on the dial - The files must have the followingname convention (max number of files is 10) - 0000-.mp3 = this is the song that will be played when the user dials a 0 - 0001-.mp3 = this is the song that will be played when the user dials a 1 - 0002-.mp3 = this is the song that will be played when the user dials a 2 - 0003-.mp3 = this is the song that will be played when the user dials a 3 - 0004-.mp3 = this is the song that will be played when the user dials a 4 - 0005-.mp3 = this is the song that will be played when the user dials a 5 - 0006-.mp3 = this is the song that will be played when the user dials a 6 - 0007-.mp3 = this is the song that will be played when the user dials a 7 - 0008-.mp3 = this is the song that will be played when the user dials a 8 - 0009-.mp3 = this is the song that will be played when the user dials a 9 - -01 = this folder contains files for producing the dial tone - 0001-dialtone.MP3 = dialtone file - 0002-disconnected.MP3 = disconnected file - 0003-number_out_of_service.MP3 = number has been disconnected or is no longer in service diff --git a/SD-card_layout_and_speech.txt b/SD-card_layout_and_speech.txt new file mode 100644 index 0000000..461f810 --- /dev/null +++ b/SD-card_layout_and_speech.txt @@ -0,0 +1,116 @@ +text na het draaien van 112 of 911: + + +Deze telefoon kan niet gebruikt worden voor alarm nummers. Gebruik een andere telefoon! +This telephone can not be used for emergency numbers. please use another phone! + +----------------------------------------------------------- + +https://ttsmp3.com/text-to-speech/Dutch/ + +Stem: Nederlands, Ruben +Stem: Engels, Brian + +Voor een betere uitspraak van de woorden telejukebox en easter egg, dient men enegzins phonetische text in te voeren*/ +----------------------------------------------------------- + +Hou de knop ingedrukt tijdens het opnemen van de hoorn, de gebruiker hoort nu een tekst in de hoorn: +Dit is het instellingen menu van de telejukebox, een muzikale telefoon. +Echter… voor de telefoons zonder drukknop is dit een beetje een probleem. Daarom kan men ook in het menu komen door het draaien van een speciaal nummer een nummer wat men niet snel per ongeluk draait. Een handig nummer hiervoor zou zijn 738 (wat staat voor SET want 7=s, 3=e, 8=t). + +Folder layout: +-------------- +01 This folder contains the MP3 files to be played when folder selection is 1 +02 This folder contains the MP3 files to be played when folder selection is 2 +03 This folder contains the MP3 files to be played when folder selection is 3 +04 This folder contains the MP3 files to be played when folder selection is 4 +05 This folder contains the MP3 files to be played when folder selection is 5 +06 This folder contains the MP3 files to be played when folder selection is 6 +07 This folder contains the MP3 files to be played when folder selection is 7 +08 This folder contains the MP3 files to be played when folder selection is 8 +09 This folder contains the MP3 files to be played when folder selection is 9 +10 This folder contains the MP3 files to be played when folder selection is 10 +90 system audio folder, bevat kiestoon en dergelijke +99 easter egg audio folder, bevat easter egg gerelateerde songs en info + +========================================================================================================= + +Folder 01 .. 10 contents: +------------------------- +When the user dials a number, the a song rnaging from 0 to 9 is played +The files must have the followingname convention (max number of files is 10) + 000-.mp3 = this is the song that will be played when the user dials a 0 + 001-.mp3 = this is the song that will be played when the user dials a 1 + 002-.mp3 = this is the song that will be played when the user dials a 2 + 003-.mp3 = this is the song that will be played when the user dials a 3 + 004-.mp3 = this is the song that will be played when the user dials a 4 + 005-.mp3 = this is the song that will be played when the user dials a 5 + 006-.mp3 = this is the song that will be played when the user dials a 6 + 007-.mp3 = this is the song that will be played when the user dials a 7 + 008-.mp3 = this is the song that will be played when the user dials a 8 + 009-.mp3 = this is the song that will be played when the user dials a 9 + +By default the folders are empty and need to be configured by the user. +However, to indicate that there is a problem, an MP3 file with some spoken text saying that the file is not available and that the SD-card should be configured should be on the card for every possible file in every possible folder. + +Folder 90 contents: +------------------- + +-messages- +001_dialtone.MP3 "dialtone file" +002_disconnected.MP3 "disconnected file" +003_number_out_of_service.MP3 "number has been disconnected or is no longer in service" +004_emergency number "deze telefoon kan niet worden gebruikt voor het draaien van alarm nummers" +005_... “Bestand niet gevonden” +006_... “Deze instelling is niet mogelijk” +007_... “uitgeschakeld” +008_... “ingeschakeld” +009_10sec silence " "(for ten secons) + +-numbers- +011_1 “1” +012_2 “2” +013_3 “3” +014_4 “4” +015_5 “5” +016_6 “6” +017_7 “7” +018_8 “8” +019_9 “9” +020_0 “0” + +021_10% “10%” +022_20% “20%” +023_30% “30%” +024_40% “40%” +025_50% “50%” +026_60% “60%” +027_70% “70%” +028_80% “80%” +029_90% “90%” +030_100% “100%” + + +-menu related- +100_... “Deze telefoon is een tele djoek boks. De huidige instellingen zijn:” +101_... “Welkom bij het configuratie menu van de tele djoek boks. U kunt kiezen uit meerdere instellingen. Voor het instellen van het volume, draai een 1. Voor het instellen van de muziekmap, draai een 2. Voor het instellen van de yster ech functie, draai een 3. Maak nu uw keuze, of verbreek de verbinding, om te annuleren.” +102_... "Maak nu uw keuze, of verbreek de verbinding, om te annuleren.” +103_... “U keuze is” +104_... “volume” +105_... “muziekmap” +106_... reserved for future use +107_... reserved for future use +108_... “yster ech functie” +109_... “De nieuwe instelling is opgeslagen, u kunt nu de verbinding verbreken.” + +-menu item 1- +110_... “U koos voor 1, het instellen van het volume. U kunt het volume instellen in stappen van 10%. Als u het volume wilt instellen op 50%, draai dan een 5. Als u het volume wilt instellen op 100%, draai dan een 0.” +111_... “Het volume, is nu ingesteld op” + +-menu item 2- +120_... “U koos 2, het instellen van de muziek map. U kunt kiezen uit 1 van de 10 mogelijke mappen op de SD-kaart in de tele djoek boks. Om gebruik te maken van muziek map 1, draai een 1. Om gebruik te maken van muziek map 2, draai een 2, enzovoorts. Om gebruik te maken van muziek map 10, draai een 0.” +121_... “De muziek map, is nu ingesteld op” + +-menu item 3- +130_... “U koos 3, het instellen van de yster ech functie. Om deze functie in te schakelen, draai een 1. Om deze functie uit te schakelen, draai een 0.” +131_... “De yster ech functie is nu” \ No newline at end of file diff --git a/firmware/TeleJukebox/TeleJukebox.ino b/firmware/TeleJukebox/TeleJukebox.ino index 1d1edbc..d48097c 100644 --- a/firmware/TeleJukebox/TeleJukebox.ino +++ b/firmware/TeleJukebox/TeleJukebox.ino @@ -6,29 +6,56 @@ https://nos.nl/op3/artikel/2299833-niek-18-laat-dementerenden-bellen-met-hun-jeugdherinnering.html Allowing the user to dial a music-number on an old NON-modified PTT (T65) telefoon with rotary dial + + + note regarding used playroutines: + --------------------------------- + myDFPlayer.playFolder(15, 4); //play specific mp3 in SD:/15/004.mp3; Folder Name(1~99); File Name(1~255) <-----== this is the most convenient method for us (because we have more then 10 folders but less then 255 files per folder) + myDFPlayer.playMp3Folder(4); //play specific mp3 in SD:/MP3/0004.mp3; File Name(0~65535) <-- not suitable: having a folder named MP3 only makes things complicated, because all folders use MP3s + myDFPlayer.playLargeFolder(2, 999); //play specific mp3 in SD:/02/004.mp3; Folder Name(1~10); File Name(1~1000) <-- not suitable: unusable, because the max. amount of useable folders is 10, we have 10 or more + */ #include "Arduino.h" #include "DFRobotDFPlayerMini.h" /* */ #include -/*IO-defintions*/ -#define dbg_jmpr 2 /*simple jumper, when placed the firmware does something safe, so the bootloader can be operated without problems*/ -#define dbg_LED 6 /*simpe LED useful for all sorts of problems*/ -#define mp3_player_busy 7 /*the pin of the MP3 player indicatingthat the device is busy*/ -#define ph_hookpulse_a A8 /*this signal is processed as being analog for better noise suppression*/ -#define ph_button 9 /*the white button on the front of the phone*/ +#include /*use the EEPROM functionality of the 32u4 in the Arduino pro micro*/ + +/*-----------------------------------------------------------------------*/ +/* IO-defintions */ +/*.......................................................................*/ + +#define dbg_jmpr 2 /*simple jumper, when placed the firmware does something safe, so the bootloader can be operated without problems*/ +#define dbg_LED 6 /*simpe LED useful for all sorts of problems*/ +#define mp3_player_busy 7 /*the pin of the MP3 player indicatingthat the device is busy*/ +#define ph_hookpulse_a A8 /*this signal is processed as being analog for better noise suppression*/ +#define ph_button 9 /*the white button on the front of the phone*/ /*defines*/ -#define DELAY_LONG 250 /*response delay, in ms*/ -#define PULSE_TIMEOUTVAL 25 /*.. times 10msec*/ +#define DELAY_LONG 250 /*response delay, in ms*/ +#define PULSE_TIMEOUTVAL 25 /*.. times 10msec*/ + +#define DEFAULT_VOLUME 10 /*the volume setting has a default value of 10=100%*/ +#define DEFAULT_MUSICFOLDER 1 /*the music folder that is used by default is folder 01*/ +#define DEFAULT_RESERVED_1 5 /*reserved for future functionality*/ +#define DEFAULT_RESERVED_2 5 /*reserved for future functionality*/ +#define DEFAULT_EASTEREGG 1 /*the easter egg function is default 1=enabled*/ /*-----------------------------------------------------------------------*/ + /*this device has a few non-volatile settings which are stored in EEPROM*/ +enum EEPROM_locations{ADDR_VOLUME, + ADDR_MUSICFOLDER, + ADDR_RESERVED_1, + ADDR_RESERVED_2, + ADDR_EASTEREGG + }; + enum PlayerStates{MP3_IDLE, MP3_PLAYING_PREVENT_CHANGE, - MP3_PLAYING_ALLOW_CHANGE, + MP3_PLAYING_ALLOW_CHANGE, MP3_RANDOM }; @@ -39,44 +66,68 @@ enum PhoneStates{ STATE_HOOK_DOWN, }; /*do not change the order of this enum (unless you really know what you are doing)*/ -enum PhoneEvents{ PHONE_DIAL_0, /*0*/ - PHONE_DIAL_1, /*1*/ - PHONE_DIAL_2, /*2*/ - PHONE_DIAL_3, /*3*/ - PHONE_DIAL_4, /*4*/ - PHONE_DIAL_5, /*5*/ - PHONE_DIAL_6, /*6*/ - PHONE_DIAL_7, /*7*/ - PHONE_DIAL_8, /*8*/ - PHONE_DIAL_9, /*9*/ +enum PhoneEvents{ PHONE_DIAL_0, /*0*/ + PHONE_DIAL_1, /*1*/ + PHONE_DIAL_2, /*2*/ + PHONE_DIAL_3, /*3*/ + PHONE_DIAL_4, /*4*/ + PHONE_DIAL_5, /*5*/ + PHONE_DIAL_6, /*6*/ + PHONE_DIAL_7, /*7*/ + PHONE_DIAL_8, /*8*/ + PHONE_DIAL_9, /*9*/ - PHONE_BUTTON, /*user presses the white button on the front panel of the phone*/ - - PHONE_OFF_HOOK, /*the user took the handpiece of the hook, this event is generated only when the handpieces state goes from ON-HOOK to OFF-HOOK*/ - PHONE_HANG_UP, /*the user has put the handpiece back onto the hook, the phonecall is over*/ - PHONE_TIMEOUT, /*the user didn't do anything for a defined period of time*/ + PHONE_BUTTON, /*user presses the white button on the front panel of the phone*/ + + PHONE_OFF_HOOK_AFTER_POWERON, /*the user took the handpiece of the hook for the first time since power-on/reset*/ + PHONE_PICKUPWITHBUTTON, /*the user took the handpiece of the hook while holding the button*/ + PHONE_OFF_HOOK, /*the user took the handpiece of the hook, this event is generated only when the handpieces state goes from ON-HOOK to OFF-HOOK*/ + PHONE_HANG_UP, /*the user has put the handpiece back onto the hook, the phonecall is over*/ + PHONE_TIMEOUT, /*the user didn't do anything for a defined period of time*/ PHONE_IDLE }; /*-----------------------------------------------------------------------*/ +/* GLOBALS */ +/*.......................................................................*/ + +int sett_volume = DEFAULT_VOLUME; +int sett_mfolder = DEFAULT_MUSICFOLDER; +int sett_reserved_1 = DEFAULT_RESERVED_1; +int sett_reserved_2 = DEFAULT_RESERVED_2; +int sett_easteregg = DEFAULT_EASTEREGG; + +unsigned char phone_state = STATE_HOOK_DOWN; /*the statemachine of the phones behaviour*/ +unsigned char mp3_state = MP3_IDLE; /*the statemachine of the phones behaviour*/ +unsigned char mp3_menu_state = 0; +unsigned long prev_millis = 0; /*value used by timeout timer*/ + +/*-----------------------------------------------------------------------*/ +/* ROUTINES */ +/*.......................................................................*/ DFRobotDFPlayerMini myDFPlayer; /*routines*/ unsigned char PollPhone(void); unsigned char CountDialPulses(void); +void SpeakCurrentSettings(void); +void ChangeSettings(void); void PlayRandom(void); -unsigned char EasterEgg(String str); +void shuffle(int * t, int n); +unsigned char CheckSequence(String str); void ErrorBlinky(unsigned char errorcode, unsigned char blinks_before_reset); void Panic(void); - -/*globals*/ -unsigned char phone_state = STATE_HOOK_DOWN; /*the statemachine of the phones behaviour*/ -unsigned char mp3_state = MP3_IDLE; /*the statemachine of the phones behaviour*/ -//unsigned char lp = 0; +bool CheckHookPulseSignal(void); +void SetVolume(unsigned char vol); +void ReadAllSettings(void); +void WriteAllSettings(void); +void Timeout_Reset(void); +bool Timeout_Check(unsigned long timeout); /*-----------------------------------------------------------------------*/ - +/* INTIALIZATION */ +/*.......................................................................*/ void setup() { pinMode(dbg_jmpr, INPUT_PULLUP); /*this pin is mostly for debugging purposes, when this jumper is placed the entire system goes into a safe idle mode and does nothing but wait*/ @@ -92,10 +143,12 @@ void setup() /*To make sure we miss nothing printed to the virtual COM-port, keep looping until the serial*/ /*stream is opened (make some noise in the horn of the phone, to indicate that the system is in a loop)*/ -// while (!Serial) {ErrorBlinky(1, 0);} /*flash error code 1*/ /*Don't forget to comment out the line above for the final release !!!*/ - + //while (!Serial); /*this line is for debugging only, COMMENT THIS LINE OUT FOR THE FINAL RELEASE!!!*/ + Serial.println("Rotary dial phone jukebox"); Serial.println("Initializing DFPlayer..."); + + ReadAllSettings(); /*get all possible settings from EEPROM*/ //Use softwareSerial to communicate with mp3. if (!myDFPlayer.begin(Serial1, false, true)) /*no ack, but with reset*/ @@ -108,8 +161,8 @@ void setup() delay(5000); /*allow the SD-card to be initialized*/ myDFPlayer.setTimeOut(500); //Set serial communication time out 500ms - delay(250); - myDFPlayer.volume(30); /*Set volume value (0..30)*/ + SetVolume(sett_volume); + delay(250); myDFPlayer.EQ(DFPLAYER_EQ_NORMAL); /*----Set different EQ----*/ delay(250); @@ -131,6 +184,8 @@ void setup() } /*-----------------------------------------------------------------------*/ +/* MAIN LOOP */ +/*.......................................................................*/ void loop() { @@ -162,7 +217,7 @@ void loop() { myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ delay(200); /*allow some time to execute command*/ - myDFPlayer.playLargeFolder(1,2); /*play from folder "01" the file "0002.MP3" containing the disconnected sound*/ + myDFPlayer.playFolder(90,2); /*play from folder .. the file ".....MP3" containing the disconnected sound*/ mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ } @@ -172,12 +227,24 @@ void loop() value = PollPhone(); switch(value) { + case PHONE_PICKUPWITHBUTTON: + { + ChangeSettings(); /*when the phone is picked up while holding the button down then start the configuration menu*/ + break; + } + + case PHONE_OFF_HOOK_AFTER_POWERON: + { + SpeakCurrentSettings(); /*speak the current settings*/ + break; + } + case PHONE_OFF_HOOK: { - dial_string = ""; /*reset the dial string*/ - myDFPlayer.stop(); /*stop playback of MP3 (although it should have stopped before we even got here)*/ - delay(200); /*delay to allow the stop request to be executed*/ - myDFPlayer.playLargeFolder(1,1); /*play from folder "01" the file "0001.MP3" containing the dialtone sound*/ + dial_string = ""; /*reset the dial string*/ + myDFPlayer.stop(); /*stop playback of MP3 (although it should have stopped before we even got here)*/ + delay(200); /*delay to allow the stop request to be executed*/ + myDFPlayer.playFolder(90,1); /*play from folder .. the file ".....MP3" containing the dialtone sound*/ mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ delay(200); break; @@ -202,21 +269,48 @@ void loop() case PHONE_DIAL_8: case PHONE_DIAL_9: { - if(mp3_state != MP3_PLAYING_PREVENT_CHANGE) + value = value - PHONE_DIAL_0; /*remove the offset from the enum to get the value from 0-9*/ + if (Timeout_Check(5000) == true) { - mp3_state = MP3_PLAYING_PREVENT_CHANGE; /*raise flag to prevent change of song during playback*/ - myDFPlayer.stop(); /*stop any previous request, even if it stopped by itself, we need to send this*/ - delay(200); /*allow for stopping to be executed*/ - myDFPlayer.playMp3Folder(value-PHONE_DIAL_0); /*play specific mp3 in SD:/MP3/0000.mp3 - 0009.mp3*/ - delay(200); /*allow for the busy signal of the MP3 player to rise (we are going to detect this later, but we may not check too soon)*/ + dial_string=value; /*clear the previous sequence and add latest value*/ + Serial.print("dial_string has expired, new dial_string="); + Serial.println(dial_string); + } + else + { + dial_string = dial_string + value; /*update the dial string with the latest value*/ + Serial.print("new dial_string="); + Serial.println(dial_string); + } + Timeout_Reset(); /*reset the timeout that can make the dial_string expire*/ + + if(CheckSequence(dial_string) == true) /*if the user has dialed a number, then first check if we have dialed a special sequence of numbers that have a special function*/ + { + dial_string=""; /*clear the sequence to allow a new sequence to be detected*/ + } + else /*if it wasn't a sequence, then just play an MP3 as indicated by the number*/ + { + if(mp3_state != MP3_PLAYING_PREVENT_CHANGE) + { + mp3_state = MP3_PLAYING_PREVENT_CHANGE; /*raise flag to prevent change of song during playback*/ + myDFPlayer.stop(); /*stop any previous request, even if it stopped by itself, we need to send this*/ + delay(200); /*allow for stopping to be executed*/ + if(value == 0) /*check if a 0 was dialed*/ + { /*because if so we need to play 010.MP3 (and not 000.MP3, because the player doesn't allow that)*/ + myDFPlayer.playFolder(sett_mfolder, 10); /*play mp3 from the currently selected folder*/ + } + else + { + myDFPlayer.playFolder(sett_mfolder, value); /*play mp3 from the currently selected folder*/ + } + delay(200); /*allow for the busy signal of the MP3 player to rise (we are going to detect this later, but we may not check too soon)*/ + } } break; } case PHONE_BUTTON: { - Serial.println(micros()); - randomSeed(micros()); /*initialize the random number generator, by a value that is based on the millis timer, this way (because the millis is determined by the user) it is much more random */ PlayRandom(); /*play a random file*/ mp3_state = MP3_RANDOM; break; @@ -227,15 +321,7 @@ void loop() { break; } - } - - /*if the user has dialed a number, then check if we meet the easter egg criteria*/ - if((value >= PHONE_DIAL_0) && (value <= PHONE_DIAL_9)) - { - value = value - PHONE_DIAL_0; /*remove the offset from the enum to get the value from 0-9*/ - dial_string = dial_string + value; - EasterEgg(dial_string); - } + } } } @@ -247,7 +333,9 @@ void loop() /*this routine will poll the phone for user input*/ /*it responds with an enumerated event value*/ unsigned char PollPhone(void) -{ +{ + static bool system_powerup = true; /*this flag is used to keep track of the fact if the system has been powered up recently*/ + unsigned char dial_val = 255; unsigned int tone_delay = 0; unsigned char ret_val = PHONE_IDLE; @@ -279,10 +367,10 @@ unsigned char PollPhone(void) case STATE_WAIT_FOR_INPUT: { - if(digitalRead(ph_button) == 0) /*check for button activity*/ + if(digitalRead(ph_button) == 0) /*check for button activity*/ { delay(250); /*simply "wait" for bouncy contacts or jumpy fingers to stabilize*/ - while(digitalRead(ph_button) == 0) /*keep looping until released, produce a tone while pressing the button*/ + while(digitalRead(ph_button) == 0) /*keep looping until released*/ { delay(1); } @@ -293,14 +381,14 @@ unsigned char PollPhone(void) break; } - if(CheckHookPulseSignal() == HIGH) /*check for pulse activity*/ + if(CheckHookPulseSignal() == HIGH) /*check for pulse activity*/ { - phone_state = STATE_DIAL; /*go to the dial (pulse decoding) state*/ + phone_state = STATE_DIAL; /*go to the dial (pulse decoding) state*/ ret_val = PHONE_IDLE; break; } - phone_state = STATE_WAIT_FOR_INPUT; /*go to the dial (pulse decoding) state*/ + phone_state = STATE_WAIT_FOR_INPUT; /*go to the dial (pulse decoding) state*/ ret_val = PHONE_IDLE; break; } @@ -308,12 +396,15 @@ unsigned char PollPhone(void) case STATE_HOOK_DOWN: default: { - if(CheckHookPulseSignal() == LOW) /*check if hook is picked up*/ + if(CheckHookPulseSignal() == LOW) /*check if hook is picked up*/ { Serial.println("Hook is picked up"); - delay(DELAY_LONG); /*delay to wait out the noisy signals created by the hook switch*/ - phone_state = STATE_HOOK_PICK_UP; /*new state is hook pick up*/ - ret_val = PHONE_OFF_HOOK; /*signal this event to the caller of this routine*/ + delay(DELAY_LONG); /*delay to wait out the noisy signals created by the hook switch*/ + phone_state = STATE_HOOK_PICK_UP; /*new state is hook pick up*/ + if(digitalRead(ph_button) == 0) {ret_val=PHONE_PICKUPWITHBUTTON;} /*check if button is pressed while the phone is being picked up from it's hook*/ + else if(system_powerup == true) {ret_val=PHONE_OFF_HOOK_AFTER_POWERON;} /*just a regular off hook, defenitely not the first time since power-on/reset*/ + else {ret_val=PHONE_OFF_HOOK;} /*signal this event to the caller of this routine*/ + system_powerup=false; /*clear the flag that indicates the firts hoop pickup since power-on/reset*/ } else { @@ -370,142 +461,355 @@ unsigned char CountDialPulses(void) /*play a random file from the MP3 folder*/ void PlayRandom(void) -{ - unsigned int rnd = 0; - - Serial.println("Play random song"); +{ + static int playlist_cnt = 10; /*the default value is 10, this means that the playlist will be scranbled upon the first call of the PlayRondom() function*/ + static int playlist[10] = {1,2,3,4,5,6,7,8,9,10}; + + if(playlist_cnt >= 10) + { + playlist_cnt = 0; + shuffle(playlist, 10); /*shuffle contents of the playlist array (which has a size of 10 entries)*/ + } + + Serial.print("Play random, song "); + Serial.println(playlist[playlist_cnt]); myDFPlayer.stop(); /*stop playback of MP3*/ - delay(200); - rnd = random(0, 9); /*the min random value is 1, the max random value is 10 as there are 10 files in the MP3 folder*/ - Serial.print("rnd="); - Serial.println(rnd); - myDFPlayer.playMp3Folder(rnd); + delay(200); + myDFPlayer.playFolder(sett_mfolder, playlist[playlist_cnt]); + playlist_cnt++; delay(200); /*allow for the busy signal of the MP3 player to rise (we are going to detect this later, but we may not check too soon)*/ } +/*This routine shuffles an array, it is a very practical way of creating a random order playlist that prevents repeating a song before all other songs are played*/ +/*the way it works is best explained here: http://en.wikipedia.org/wiki/Fisher-Yates_shuffle */ +void shuffle(int * t, int n) +{ + unsigned int rnd = 0; + int array_size = 0; + int temp = 0; + int lp = 0; + + randomSeed(micros()); /*initialize the random number generator, by a value that is based on the millis timer, this way (because the millis is determined by the user) it is much more random */ + array_size = n; /*save array size value to another variable, because we are about the destroy the contents of n*/ + while(--n >= 2) + { + rnd = random(0, n); /*the min random value is 1, the max random value is 10 as there are 10 files in the MP3 folder*/ + temp = t [n]; + t[n] = t[rnd]; + t[rnd] = temp; + } + +// /*debug print the new array contents*/ +// for(lp=0; lp 0) + { + if(str == "002") /*this is the old Dutch number for the current time*/ + { + Serial.print("002 = old Dutch number for the current time"); + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + myDFPlayer.playFolder(99,2); /*play from folder .. the file ".....MP3" containing the easter egge related sound*/ + mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ + delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ + return_value = true; /*sequence was detected and handled*/ + } + else + if(str == "003") /*this is the old Dutch number for the weather*/ + { + Serial.print("003 = old Dutch number for the weather"); + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + myDFPlayer.playFolder(99,3); /*play from folder .. the file ".....MP3" containing the easter egge related sound*/ + mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ + delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ + return_value = true; /*sequence was detected and handled*/ + } + else + if(str == "008") /*this is the old Dutch number for telephone number information*/ + { + Serial.print("008 = old dutch number for telephone number related information"); + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + myDFPlayer.playFolder(99,8); /*play from folder .. the file ".....MP3" containing the easter egge related sound*/ + mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ + delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ + return_value = true; /*sequence was detected and handled*/ + } + else + if(str == "1945") /*this is the year of birth of Deborah Harry (a.k.a. Blondie), she mad a sone about a telephone*/ + { + Serial.print("1945 = year of birth of Deborah Harry (a.k.a. Blondie)"); + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + myDFPlayer.playFolder(99,45); /*play from folder .. the file ".....MP3" containing the easter egge related sound*/ + mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ + delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ + return_value = true; /*sequence was detected and handled*/ + } + else + if(str == "1947") /*this is the year of birth of one of the greatest dutch commedians (Andre van Duin), he made a funny song about a telephone*/ + { + Serial.print("1947 = year of birth of Adrianus Marinus Kyvon (a.k.a. Andre van Duin)"); + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + myDFPlayer.playFolder(99,47); /*play from folder .. the file ".....MP3" containing the easter egge related sound*/ + mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ + delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ + return_value = true; /*sequence was detected and handled*/ + } + else + if(str == "1950") /*Stevie Wonder was born in 1950, he made a song about a telephone call*/ + { + Serial.print("1950 = year of birth of Stevie Wonder"); + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + myDFPlayer.playFolder(99,50); /*play from folder .. the file ".....MP3" containing the easter egge related sound*/ + mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ + delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ + return_value = true; /*sequence was detected and handled*/ + } } - else - if(str == "1986") /*Lady Gaga was born in 1986, years later she made a sone called Telephone*/ - { - Serial.print("1986 = year of birth of Lady Gaga"); - myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ - delay(200); /*allow some time to execute command*/ - myDFPlayer.playLargeFolder(2,1986); /*play from folder "02" the file "1986.MP3" containing the easter egge related sound*/ - mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ - delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ - return(true); /*easter egg was detected and handled*/ - } - else - if(str == "2006") /*Soundtrack of a dutch "Hi" (which is a telecom provider) commercial from 2006*/ - { - Serial.print("2006 = Hi5 Band - Met Z'n Allen Op Een Lijn!"); - myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ - delay(200); /*allow some time to execute command*/ - myDFPlayer.playLargeFolder(2,2006); /*play from folder "02" the file "2006.MP3" containing the easter egge related sound*/ - mp3_state = MP3_PLAYING_ALLOW_CHANGE; /*allow the selection of a different MP3 during the playback of this MP3*/ - delay(200); /*some time to get the MPO3 started and the busy signal to rise*/ - return(true); /*easter egg was detected and handled*/ - } - else + return(return_value); +} + +/*-------------------------------------------------------*/ + +/*this routine "speaks" the current settings*/ +void SpeakCurrentSettings(void) +{ + unsigned char scs_exit = false; + unsigned char scs_state = 0; + + Serial.println("Speak the settings"); + delay(1500); /*allow some time for the user to hold the handpiece to their ear*/ + scs_exit = false; /*make sure we don't exit prematurely*/ + scs_state = 0; /*make sure we start the statemachine from the beginning*/ + while(scs_exit == false) { - return(false); /*no easter egg detected therefore do nothing and return FALSE*/ + myDFPlayer.stop(); /*song has ended, play the disconnected sound*/ + delay(200); /*allow some time to execute command*/ + switch(scs_state) + { + case 0: {myDFPlayer.playFolder(90,100); scs_exit = false; break;} /*introduction to telephone and settings*/ + case 1: {myDFPlayer.playFolder(90,104); scs_exit = false; break;} /*volume*/ + case 2: {myDFPlayer.playFolder(90,(20+sett_volume)); scs_exit = false; break;} /*volume value in ..%*/ + case 3: {myDFPlayer.playFolder(90,105); scs_exit = false; break;} /*music folder*/ + case 4: {myDFPlayer.playFolder(90,(10+sett_mfolder)); scs_exit = false; break;} /*folder number*/ + case 5: {myDFPlayer.playFolder(90,108); scs_exit = false; break;} /*easter egg function*/ + case 6: {if(sett_easteregg == false) {myDFPlayer.playFolder(90,7); scs_exit = true; break;} /*disabled*/ + else {myDFPlayer.playFolder(90,8); scs_exit = true; break;}} /*enabled*/ + default: { scs_exit = true; break;} /*if we ever get here... do nothing and exit menu handler*/ + } + scs_state++; /*increment state counter*/ + delay(300); /*allow some time to execute command*/ + while(digitalRead(mp3_player_busy) == 0) /*check if the MP3 player is in playback mode, because if not, then whatever was playing has finished, so allow playback of a new/different MP3*/ + { + delay(100); + if(PollPhone() == PHONE_HANG_UP) + { + Serial.println("Speaking of setings, has been terminated"); + myDFPlayer.stop(); /*stop playback of MP3*/ + delay(200); /*delay to allow the stop request to be executed*/ + scs_exit = true; /*this stops the speech statemachine*/ + break; + } + } } +} + +/*this routine "speaks" the current settings*/ +void ChangeSettings(void) +{ + unsigned char lp_exit = false; + unsigned char cs_exit = false; + unsigned char cs_state = 0; + unsigned char value = 0; + unsigned char allow_input = false; + + Serial.println("Menu started..."); + SetVolume(10); /*use the maximum possible volume, this way the user can always hear the menu, even if the true volume settings is at it's lowest*/ + delay(1000); /*allow some time for the user to hold the handpiece to their ear*/ + cs_exit = false; /*make sure we don't exit prematurely*/ + cs_state = 0; /*make sure we start the statemachine from the beginning*/ + while(cs_exit == false) + { + //Serial.print("cs_state="); + //Serial.println(cs_state); + switch(cs_state) + { /*main menu start*/ + case 0: {cs_exit = false; cs_state=1; break;} /*this does nothing other then making sure all previous MP3 are stopped*/ + case 1: {myDFPlayer.playFolder(90,101); delay(200); cs_exit=false; cs_state=3; allow_input=false; break;} /*introduction to menu and request the user to make a choice*/ + case 2: {myDFPlayer.playFolder(90,102); delay(200); cs_exit=false; cs_state=3; allow_input=false; break;} /*request the user to make a choice*/ + case 3: {myDFPlayer.playFolder(90,9); delay(200); cs_exit=false; cs_state=4; allow_input=true; break;} /*play 10 second silence, this allows the user to make a choice*/ + case 4: {switch(value) + { + case 1: {cs_exit = false; cs_state=10; break;} /*valid input detected*/ + case 2: {cs_exit = false; cs_state=20; break;} /*valid input detected*/ + case 3: {cs_exit = false; cs_state=30; break;} /*valid input detected*/ + case 255: {cs_exit = false; cs_state=2; break;} /*keep waiting for input*/ + default: {cs_exit = false; cs_state=5; break;} /*invalid input, inform user*/ + } + break; + } + case 5: {myDFPlayer.playFolder(90,6); delay(200); cs_exit=false; cs_state=1; allow_input=false; break;} /*invalid menu choice, indicate problem and go back to first state*/ + + /*volume menu*/ + case 10: {myDFPlayer.playFolder(90,110); delay(200); cs_exit=false; cs_state=11; allow_input=false; break;} /*confirm choice*/ + case 11: {myDFPlayer.playFolder(90,111); delay(200); cs_exit=false; cs_state=12; allow_input=false; break;} /*speak current setting name*/ + case 12: {myDFPlayer.playFolder(90,(20+sett_volume)); delay(200); cs_exit=false; cs_state=13; allow_input=false; break;} /*speak current setting value*/ + case 13: {myDFPlayer.playFolder(90,102); delay(200); cs_exit=false; cs_state=14; allow_input=false; break;} /*request to make a choice*/ + case 14: {myDFPlayer.playFolder(90,9); delay(200); cs_exit=false; cs_state=15; allow_input=true; break;} /*play 10 second silence, this allows the user to make a choice*/ + case 15: {switch(value) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: {sett_volume = value; cs_exit=false; cs_state=16; break;} + case 255: {cs_exit = false; cs_state=13; break;} /*keep waiting for input*/ + default: {cs_exit = false; cs_state=15; break;} /*invalid input, inform user*/ + } + break; + } + case 16: {WriteAllSettings(); + myDFPlayer.playFolder(90,103); delay(200); cs_exit=false; cs_state=17; allow_input=false; break;} /*confirm choice*/ + case 17: {myDFPlayer.playFolder(90,(20+sett_volume)); delay(200); cs_exit=false; cs_state=99; allow_input=false; break;} /*speak current setting value*/ + + /*music folder menu*/ + case 20: {myDFPlayer.playFolder(90,120); delay(200); cs_exit=false; cs_state=21; allow_input=false; break;} /*confirm choice*/ + case 21: {myDFPlayer.playFolder(90,121); delay(200); cs_exit=false; cs_state=22; allow_input=false; break;} /*speak current setting name*/ + case 22: {myDFPlayer.playFolder(90,(10+sett_mfolder)); delay(200); cs_exit=false; cs_state=23; allow_input=false; break;} /*speak current setting value*/ + case 23: {myDFPlayer.playFolder(90,102); delay(200); cs_exit=false; cs_state=24; allow_input=false; break;} /*request to make a choice*/ + case 24: {myDFPlayer.playFolder(90,9); delay(200); cs_exit=false; cs_state=25; allow_input=true; break;} /*play 10 second silence, this allows the user to make a choice*/ + case 25: {switch(value) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: {sett_mfolder = value; cs_exit=false; cs_state=26; break;} + case 255: {cs_exit = false; cs_state=23; break;} /*keep waiting for input*/ + default: {cs_exit = false; cs_state=25; break;} /*invalid input, inform user*/ + } + break; + } + case 26: {WriteAllSettings(); + myDFPlayer.playFolder(90,103); delay(200); cs_exit=false; cs_state=27; allow_input=false; break;} /*confirm choice*/ + case 27: {myDFPlayer.playFolder(90,(10+sett_mfolder)); delay(200); cs_exit=false; cs_state=99; allow_input=false; break;} /*speak current setting value*/ + + /*easter egg menu*/ + case 30: {myDFPlayer.playFolder(90,130); delay(200); cs_exit=false; cs_state=31; allow_input=false; break;} /*confirm choice*/ + case 31: {myDFPlayer.playFolder(90,131); delay(200); cs_exit=false; cs_state=32; allow_input=false; break;} /*speak current setting name*/ + case 32: {if(sett_easteregg == false) {myDFPlayer.playFolder(90,7); delay(200); cs_exit=false; cs_state=33; allow_input=false; break;} /*disabled*/ + else {myDFPlayer.playFolder(90,8); delay(200); cs_exit=false; cs_state=33; allow_input=false; break;}} /*enabled*/ + case 33: {myDFPlayer.playFolder(90,102); delay(200); cs_exit=false; cs_state=34; allow_input=false; break;} /*request to make a choice*/ + case 34: {myDFPlayer.playFolder(90,9); delay(200); cs_exit=false; cs_state=35; allow_input=true; break;} /*play 10 second silence, this allows the user to make a choice*/ + case 35: {switch(value) + { + case 10: {sett_easteregg=false; cs_exit=false; cs_state=37; break;} + case 1: {sett_easteregg=true; cs_exit=false; cs_state=37; break;} + case 255: {cs_exit = false; cs_state=33; break;} /*keep waiting for input*/ + default: {cs_exit = false; cs_state=36; break;} /*invalid input, inform user*/ + } + break; + } + case 36: {WriteAllSettings(); + myDFPlayer.playFolder(90,6); delay(200); cs_exit=false; cs_state=30; allow_input=false; break;} /*invalid menu choice, indicate problem and go back to first state*/ + case 37: {myDFPlayer.playFolder(90,103); delay(200); cs_exit=false; cs_state=38; allow_input=false; break;} /*confirm choice*/ + case 38: {if(sett_easteregg == false) {myDFPlayer.playFolder(90,7); delay(200); cs_exit=false; cs_state=99; allow_input=false; break;} /*disabled*/ + else {myDFPlayer.playFolder(90,8); delay(200); cs_exit=false; cs_state=99; allow_input=false; break;}} /*enabled*/ + + /*main menu end*/ + case 99: {myDFPlayer.playFolder(90,109); delay(200); cs_exit=false; cs_state=100; allow_input=false; break;} /*indicate that the new setting is saved*/ + case 100: {myDFPlayer.playFolder(90,9); delay(200); cs_exit=false; cs_state=99; allow_input=false; break;} /*play 10 second silence, this allows the user to make a choice*/ + default: {cs_exit=true; break;} /*if we ever get here... do nothing and exit menu handler*/ + } + lp_exit = false; /*by default we don't exit the sub loop*/ + while((digitalRead(mp3_player_busy)==0) && (lp_exit == false)) /*check if the MP3 player is in playback mode, because if not, then whatever was playing has finished, so allow playback of a new/different MP3*/ + { + delay(10); /*prevent this while loop from running too fast*/ + switch(PollPhone()) + { + default: {value=255; cs_exit=false; lp_exit=false; break;} /*do nothing*/ + case PHONE_DIAL_1: {value=1; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_2: {value=2; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_3: {value=3; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_4: {value=4; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_5: {value=5; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_6: {value=6; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_7: {value=7; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_8: {value=8; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_9: {value=9; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + case PHONE_DIAL_0: {value=10; cs_exit=false; lp_exit=allow_input; break;} /*process the entered value*/ + + case PHONE_HANG_UP: + { + Serial.println("Menu has been terminated"); + cs_exit =true; /*this stops the speech statemachine*/ + lp_exit =true; /*exit this while loop*/ + break; + } + } + } + + myDFPlayer.stop(); /*make sure nothing else is playing*/ + delay(200); /*allow some time to execute command*/ + + } + SetVolume(sett_volume); /*use the true volume as defined by the volume setting*/ } /*-------------------------------------------------------*/ @@ -528,7 +832,7 @@ void ErrorBlinky(unsigned char errorcode, unsigned char blinks_before_reset) } if(blinks_before_reset > 1) {delay(2000); blinks_before_reset--;} - if(blinks_before_reset == 1) {break;} /*exit the while loop*/ + if(blinks_before_reset == 1) {break;} /*exit the while loop*/ } } @@ -578,3 +882,111 @@ bool CheckHookPulseSignal(void) return(current_level); } + +void SetVolume(unsigned char vol) +{ + delay(250); /*small delay, to make sure any previous command has been handled before we sent a new one*/ + switch(vol) + { + case 1: {myDFPlayer.volume(14); break;} /*3 sets volume to a true (linear) 10%, but linear volume is too soft, too fast, so we just use a more practical heavily simplified scale*/ + case 2: {myDFPlayer.volume(16); break;} /*6 sets volume to 20%*/ + case 3: {myDFPlayer.volume(18); break;} /*9 sets volume to 30%*/ + case 4: {myDFPlayer.volume(20); break;} /*12 sets volume to 40%*/ + case 5: {myDFPlayer.volume(22); break;} /*15 sets volume to 50%*/ + case 6: {myDFPlayer.volume(24); break;} /*18 sets volume to 60%*/ + case 7: {myDFPlayer.volume(26); break;} /*21 sets volume to 70%*/ + case 8: {myDFPlayer.volume(28); break;} /*24 sets volume to 80%*/ + case 9: {myDFPlayer.volume(29); break;} /*27 sets volume to 90%*/ + case 10:{myDFPlayer.volume(30); break;} /*30 sets volume to 100%*/ + default:{myDFPlayer.volume(30); break;} /*30 sets volume to 100% (it's the best we can do for an unknown value*/ + } +} + + +/*This routine will read the settings from EEPROM, if the value is outside the expected range it will be set to default*/ +/*This means that the system will automatically be set to default directly after programming*/ +/*Because the value we are storing are never 0 and never 255, we can easily distinguish them from an unprogrammed EEPROM and therefore detect if they are valid*/ +void ReadAllSettings(void) +{ + Serial.println("Reading settings from EEPROM"); + sett_volume = EEPROM.read(ADDR_VOLUME); + if((sett_volume<1) || (sett_volume>10)) /*check if the value read from EEPROM is within the expected range, if not replace value by default value*/ + { + Serial.println("Volume setting has been set to default"); + sett_volume = DEFAULT_VOLUME; + } + + sett_mfolder = EEPROM.read(ADDR_MUSICFOLDER); + if((sett_mfolder<1) || (sett_mfolder>10)) /*check if the value read from EEPROM is within the expected range, if not replace value by default value*/ + { + Serial.println("Music folder setting has been set to default"); + sett_mfolder = DEFAULT_MUSICFOLDER; + } + + sett_reserved_1 = EEPROM.read(ADDR_RESERVED_1); + if((sett_reserved_1<1) || (sett_reserved_1>10)) /*check if the value read from EEPROM is within the expected range, if not replace value by default value*/ + { + Serial.println("Reserved_1 setting has been set to default"); + sett_reserved_1 = DEFAULT_RESERVED_1; + } + + sett_reserved_2 = EEPROM.read(ADDR_RESERVED_2); + if((sett_reserved_2<1) || (sett_reserved_2>10)) /*check if the value read from EEPROM is within the expected range, if not replace value by default value*/ + { + Serial.println("Reserved_2 setting has been set to default"); + sett_reserved_2 = DEFAULT_RESERVED_2; + } + + sett_easteregg = EEPROM.read(ADDR_EASTEREGG) - 128; /*we use an offset, just to make sure that a value of 0 will not be stored in the EEPROM*/ + if((sett_easteregg<0) || (sett_easteregg>1)) /*check if the value read from EEPROM is within the expected range, if not replace value by default value*/ + { + Serial.println("Easter egg setting has been set to default"); + sett_easteregg = DEFAULT_EASTEREGG; + } +} + +/*this routine will write all setting to EEPROM*/ +/*now this may not seem very efficient, to write all values if maybe only one value is changed*/ +/*but since time is not an issue and the number of writes for the lifespan of the device s not an issue*/ +/*we just save all at once, because it keeps the code very simple*/ +void WriteAllSettings(void) +{ + Serial.println("Saving settings to EEPROM"); + EEPROM.write(ADDR_VOLUME, sett_volume); + EEPROM.write(ADDR_MUSICFOLDER, sett_mfolder); + EEPROM.write(ADDR_RESERVED_1, sett_reserved_1); + EEPROM.write(ADDR_RESERVED_2, sett_reserved_2); + EEPROM.write(ADDR_EASTEREGG, (sett_easteregg+128)); /*add an offset, just to make sure that we don't store the value 0 in EEPROM*/ +} + + +/*this routine will reset the timeout counter*/ +void Timeout_Reset(void) +{ + prev_millis = millis(); /*update timeout counter with the current time*/ +} + +/*this routine will compare the timeout value with the given value and returns TRUE if the timeout has expired*/ +bool Timeout_Check(unsigned long timeout) +{ + unsigned long cur_millis = 0; + + cur_millis = millis(); + + /*check for overflow situation*/ + if(cur_millis < prev_millis) + { + return(false); /*ignore the situation and hope for the best*/ + } + + /*normal situation, we can safely check for timeout overflow*/ + if((cur_millis - prev_millis) > timeout) + { + return(true); + } + else + { + return(false); + } + +} diff --git a/logo/telejukebox-logo.png b/logo/telejukebox-logo.png new file mode 100644 index 0000000..da6cd21 Binary files /dev/null and b/logo/telejukebox-logo.png differ diff --git a/manual/Manual - TeleJukebox.odt b/manual/Manual - TeleJukebox.odt new file mode 100644 index 0000000..72f09be Binary files /dev/null and b/manual/Manual - TeleJukebox.odt differ diff --git a/manual/Manual - TeleJukebox.pdf b/manual/Manual - TeleJukebox.pdf new file mode 100644 index 0000000..cca6baa Binary files /dev/null and b/manual/Manual - TeleJukebox.pdf differ