Skip to content

Commit 2b43f88

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 94aab02 + 34d48cc commit 2b43f88

File tree

13 files changed

+677
-122
lines changed

13 files changed

+677
-122
lines changed

README.md

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Firmware features include
2727
- [Wireless communication](#bttf-network-bttfn) with [Time Circuits Display](https://circuitsetup.us/product/complete-time-circuits-display-kit/); used for synchonized time travels, alarm, night mode, fake power and remote control through TCD keypad
2828
- [Music player](#the-music-player): Play mp3 files located on an SD card [requires TCD connected wirelessly for control]
2929
- [SD card](#sd-card) support for custom audio files for effects, and music for the Music Player
30-
- Advanced network-accessible [Config Portal](#the-config-portal) for setup (http://gauges.local, hostname configurable)
30+
- advanced network-accessible [Config Portal](#the-config-portal) for setup (http://gauges.local, hostname configurable)
3131
- [Home Assistant](#home-assistant--mqtt) (MQTT 3.1.1) support
32-
- Built-in installer for default audio files in addition to OTA firmware updates
32+
- built-in OTA installer for firmware updates and audio files
3333

3434
## Firmware Installation
3535

@@ -69,11 +69,19 @@ The first step is to establish access to the configuration web site ("Config Por
6969

7070
#### Connecting to a WiFi network
7171

72-
As long as the device is unconfigured, it creates a WiFi network of its own named "DG-AP". This is called "Access point mode", or "AP-mode".
72+
Your Dash Gauges know two ways of WiFi operation: Either they create their own WiFi network, or they connect to a pre-existing WiFi network.
7373

74-
It is ok to leave the Dash Gauges in this mode, especially if it run stand-alone. In a typical home setup and/or if you also have a [Time Circuits Display](https://circuitsetup.us/product/complete-time-circuits-display-kit/), however, you might want to connect the Dash Gauges to a WiFi network (in case of using it together with a TCD: to the same WiFi network the TCD is connected to). If you have your Dash Gauges, along with a Time Circuits Display, mounted in a car, you might want to connect the Dash Gauges to the TCD's very own WiFi network "TCD-AP"; see [here](#car-setup).
74+
As long as the device is unconfigured, it creates its own WiFi network named "DG-AP". This mode of operation is called "Access point mode", or "AP-mode".
7575

76-
In order to connect your Dash Gauges to a WiFi network, click on "Configure WiFi". The bare minimum is to select an SSID (WiFi network name) and a WiFi password.
76+
It is ok to leave it in AP-mode, predominantly if used stand-alone. (To operate your Dash Gauges in AP-mode, do not configure a WiFi network as described below, or click on "Erase WiFi config" on the Config Portal's main page.)
77+
78+
>For experts: In the following, the term "WiFi network" is used for both "WiFi network" and "ip network" for simplicity reasons. However, for BTTFN/MQTT communication, the devices must (only) be on the same ip network, regardless of how they take part in it: They can be can be connected to different WiFi networks, if those WiFi networks are part of the same ip network, or, in case of the MQTT broker, by wire. If the TCD operates as access point for other props, connecting a prop to the TCD's WiFi network also takes care of suitable ip network configuration through DHCP.
79+
80+
##### ▶ Home setup with a pre-existing local WiFi network
81+
82+
In this case, you can connect your Dash Gauges to your home WiFi network: Click on "Connect to WiFi" and either select a network from the top of the page or enter a WiFi network name (SSID), and enter your WiFi password. After saving the WiFi network settings, the device reboots and tries to connect to your configured WiFi network. If that fails, it will again start in access point mode.
83+
84+
>If you have a [Time Circuits Display](https://tcd.out-a-ti.me) note that in order to have both Dash Gauges and TCD communicate with each other, your Dash Gauges must be connected to the same network your TCD is connected to. In order to use MQTT, your Dash Gauges must be connected to the same network your broker is connected to.
7785
7886
>Note that the device requests an IP address via DHCP, unless you entered valid data in the fields for static IP addresses (IP, gateway, netmask, DNS). If the device is inaccessible as a result of incorrect static IPs,
7987
>- power-down the device,
@@ -86,7 +94,11 @@ In order to connect your Dash Gauges to a WiFi network, click on "Configure WiFi
8694
>
8795
>This procedure causes static IP data to be deleted; the device will return to DHCP after a reboot.
8896
89-
After saving the WiFi network settings, the device reboots and tries to connect to your configured WiFi network. If that fails, it will again start in access point mode.
97+
##### ▶ Places without a WiFi network
98+
99+
If no TCD is present, keep your Dash Gauges operating in AP-mode.
100+
101+
If you have a [Time Circuits Display](https://tcd.out-a-ti.me), you can connect your Dash Gauges to the TCD's own WiFi network: Click on "Connect to WiFi" and either select "TCD-AP" from the top of the page or enter "TCD-AP" under *WiFi network name (SSID)*. If you password-proteced your TCD-AP, enter this password below. See [here](#car-setup) for more details.
90102

91103
After completing this step, your Dash Gauges are ready to be configured through the "Config Portal".
92104

@@ -259,6 +271,8 @@ The Dash Gauges are way more fun when other props (TCD, FC, SID) are present as
259271
</tr>
260272
</table>
261273

274+
[Here](https://github.com/realA10001986/Dash-Gauges/blob/main/CheatSheet.pdf) is a cheat sheet for printing or screen-use. (Note that MacOS' preview application has a bug that scrambles the links in the document. Acrobat Reader does it correctly.)
275+
262276
## Time travel
263277

264278
To trigger a "time travel" stand-alone, you need to install a "Time Travel" button. Pressing that button briefly will let the Dash Gauges play their time travel sequence. Please see [here](hardware/#connecting-a-time-travel-button) for how to wire that button.
@@ -294,6 +308,18 @@ The firmware supports some additional user-provided sound effects, which it will
294308
295309
Those files are not provided here. You can use any mp3, with a bitrate of 128kpbs or less.
296310

311+
### Installing Custom & Replacement Audio Files
312+
313+
As of version 1.20 of the Dash Gauges firmware, above mentioned audio files (both replacements and custom sounds) can either be copied to the SD card using a computer, or uploaded through the Config Portal.
314+
315+
Uploading through the Config Portal works exactly like [installing the default audio files](#audio-data-installation); on the main menu, click "UPDATE". Afterwards choose the file to upload in the bottom file selector, and click "UPLOAD". The firmware recognizes mp3 files, and stores them on the SD card. (Unlike with the default files, no further "installation" takes place.)
316+
317+
In order to delete a file from the SD card, upload a file whose name is prefixed with "delete-". For example: To delete "key1.mp3" from the SD card, either rename your "key1.mp3" into "delete-key1.mp3", or create a new file named "delete-key1.mp3", and upload this file. The firmware detects the "delete-" part and, instead of storing the uploaded file, it throws it away and deletes "key1.mp3" from the SD card.
318+
319+
For technical reasons, the Dash Gauges must reboot after a file is uploaded in this way.
320+
321+
Please remember that the maximum bitrate for mp3 files is 128kbps. Also note that the uploaded file is stored to the root folder of the SD card, so this way of uploading cannot be used to upload songs for the Music Player.
322+
297323
## The Music Player
298324

299325
The firmware contains a simple music player to play mp3 files located on the SD card. This player requires a TCD connected through BTTFN for control.
@@ -406,19 +432,19 @@ If your Dash Gauges, along with a [Time Circuits Display](https://tcd.out-a-ti.m
406432
#### Dash Gauges
407433

408434
Enter the Config Portal on the Dash Gauges (as described above), click on *Setup* and
409-
- enter *192.168.4.1* into the field **_IP address or hostname of TCD_**
435+
- enter *192.168.4.1* into the field **_IP address or hostname of TCD_** under BTTFN settings;
410436
- check the option **_Follow TCD fake power_** if you have a fake power switch for the TCD (like eg a TFC switch)
411437
- click on *Save*.
412438

413439
After the Dash Gauges have restarted, re-enter the Dash Gauges's Config Portal (while the TCD is powered and in *car mode*) and
414-
- click on *Configure WiFi*,
415-
- select the TCD's access point name in the list at the top or enter *TCD-AP* into the *SSID* field; if you password-protected your TCD's AP, enter this password in the *password* field. Leave all other fields empty,
440+
- click on *Connect to WiFi*,
441+
- select the TCD's access point name in the list at the top ("TCD-AP") or enter *TCD-AP* into the *WiFi network name (SSID)* field; if you password-protected your TCD's AP, enter this password in the *password* field. Leave all other fields empty,
416442
- click on *Save*.
417443

418-
Using this setup enables the Dash Gauges to receive notifications about time travel and alarm wirelessly, and to query the TCD for data. Also, the TCD keypad can be used to remote-control the Dash Gauges.
419-
420444
In order to access the Dash Gauges's Config Portal in your car, connect your hand held or computer to the TCD's WiFi access point ("TCD-AP"), and direct your browser to http://gauges.local ; if that does not work, go to the TCD's keypad menu, press ENTER until "BTTFN CLIENTS" is shown, hold ENTER, and look for the Dash Gauges's IP address there; then direct your browser to that IP by using the URL http://a.b.c.d (a-d being the IP address displayed on the TCD display).
421445

446+
This "car setup" can also be used in a home setup with no local WiFi network present.
447+
422448
### Door Switches
423449

424450
The Dash Gauges have a connector for two door switches. These switches trigger door open/close sounds.
@@ -437,11 +463,13 @@ In order to reduce the number of write operations and thereby prolong the life o
437463

438464
### Main page
439465

440-
##### &#9654; Configure WiFi
466+
##### &#9654; Connect to WiFi
467+
468+
Click this to connect your Dash Gauges to your local WiFi network (which can also be provided by your [Time Circuits Display](https://tcd.out-a-ti.me) operating in AP mode/car mode). All you need to do is either to click on one of the networks listed at the top or to enter a WiFi network name (SSID), and optionally a passwort (WPAx).
441469

442-
Clicking this leads to the WiFi configuration page. On that page, you can connect your Dash Gauges to your WiFi network by selecting/entering the SSID (WiFi network name) as well as a password (WPA2). By default, the Dash Gauges request an IP address via DHCP. However, you can also configure a static IP by entering the IP, netmask, gateway and DNS server. All four fields must be filled for a valid static IP configuration. If you want to stick to DHCP, leave those four fields empty.
470+
>By default, the Dash Gauges request an IP address via DHCP. However, you can also configure a static IP for the Dash Gauges by entering the IP, netmask, gateway and DNS server. All four fields must be filled for a valid static IP configuration. If you want to stick to DHCP, leave those four fields empty. If you connect your Dash Gauges to your Time Circuits Display acting as access point ("TCD-AP"), leave these all empty.
443471
444-
Note that this page has nothing to do with Access Point mode; it is strictly for connecting your Dash Gauges to an existing WiFi network as a client.
472+
Note that this page is strictly for connecting your Dash Gauges to an existing WiFi network. If your Dash Gauges are supposed to operate stand-alone, they run in "access point mode" (AP-Mode). Settings for AP mode are on the *Setup* page.
445473

446474
##### &#9654; Setup
447475

@@ -457,9 +485,11 @@ You can also install the Dash Gauges' audio data on this page; download the curr
457485

458486
Note that either a firmware or audio data can be uploaded at once, not both at the same time.
459487

488+
Finally, this page is also for uploading [custom or replacement sound files](#installing-custom--replacement-audio-files) to the SD card. Select an mp3 file in the bottom file selector and click upload. (Requires firmware 1.20 or later.)
489+
460490
##### &#9654; Erase WiFi Config
461491

462-
Clicking this (and saying "yes" in the confirmation dialog) erases the WiFi configuration (WiFi network and password) and reboots the device; it will restart in "access point" mode. See [here](#short-summary-of-first-steps).
492+
Clicking this (and saying "yes" in the confirmation dialog) erases the WiFi connection configuration (as set up through the *Connect to WiFi* page) and reboots the device; it will restart in "access point" (AP) mode. See [here](#short-summary-of-first-steps).
463493

464494
---
465495

@@ -544,7 +574,7 @@ If your Dash Gauges are connected wirelessly, this option has no effect.
544574

545575
##### &#9654; IP address or hostname of TCD
546576

547-
If you want to have your Dash Gauges to communicate with a Time Circuits Display wirelessly ("BTTF-Network"), enter the IP address of the TCD here. If your TCD is running firmware version 2.9.1 or later, you can also enter the TCD's hostname here instead (eg. 'timecircuits').
577+
If you want to have your Dash Gauges to communicate with a Time Circuits Display wirelessly ("BTTF-Network"), enter the TCD's hostname - usually 'timecircuits' - or IP address here.
548578

549579
If you connect your Dash Gauges to the TCD's access point ("TCD-AP"), the TCD's IP address is 192.168.4.1.
550580

@@ -694,10 +724,7 @@ then reload the page in your browser.
694724

695725

696726

697-
_Text & images: (C) Thomas Winischhofer ("A10001986"). See LICENSE._ Source: https://dg.out-a-ti.me
698-
699-
700-
701-
727+
_Text & images: (C) Thomas Winischhofer ("A10001986"). See LICENSE._ Source: https://dg.out-a-ti.me
728+
_Other props: [Time Circuits Display](https://tcd.out-a-ti.me) ... [Flux Capacitor](https://fc.out-a-ti.me) ... [SID](https://sid.out-a-ti.me) ... [VSR](https://vsr.out-a-ti.me) ... [Remote Control](https://remote.out-a-ti.me) ... [TFC](https://tfc.out-a-ti.me)_
702729

703730

-9.5 KB
Binary file not shown.

src/dashgauges-A10001986.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@
115115

116116
/* Changelog
117117
*
118+
* 2025/09/15 (A10001986) [1.20]
119+
* - Refine mp3 upload facility; allow deleting files from SD by prefixing
120+
* filename with "delete-".
121+
* - WiFi manager: Remove lots of <br> tags; makes Safari display the
122+
* pages better.
123+
* 2025/09/14 (A10001986)
124+
* - Allow uploading .mp3 files to SD through config portal. Uses the same
125+
* interface as audio container upload. Files are stored in the root
126+
* folder of the SD; hence not suitable for music player.
127+
* - WiFi manager: Remove (ie skip compilation of) unused code
128+
* - WiFi manager: Add callback to Erase WiFi settings, before reboot
129+
* - WiFi manager: Build param page with fixed size string to avoid memory
130+
* fragmentation; add functions to calculate String size beforehand.
118131
* 2025/02/13 (A10001986) [1.13.1]
119132
* - Delete temp file after audio installation
120133
* 2025/01/15 (A10001986) [1.13]

src/dg_global.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*** Version Strings ***
1616
*************************************************************************/
1717

18-
#define DG_VERSION "V1.13.1"
19-
#define DG_VERSION_EXTRA "FEB132025"
18+
#define DG_VERSION "V1.20"
19+
#define DG_VERSION_EXTRA "SEP152025"
2020

2121
//#define DG_DBG // debug output on Serial
2222

src/dg_main.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,11 +1489,7 @@ static void execute_remote_command()
14891489

14901490
switch(command) {
14911491
case 64738: // 64738: reboot
1492-
allOff();
1493-
mp_stop();
1494-
stopAudio();
1495-
flushDelayedSave();
1496-
unmount_fs();
1492+
prepareReboot();
14971493
delay(500);
14981494
esp_restart();
14991495
break;
@@ -1878,6 +1874,17 @@ void allOff()
18781874
emptyLED.specialSignal(0);
18791875
}
18801876

1877+
void prepareReboot()
1878+
{
1879+
mp_stop();
1880+
stopAudio();
1881+
allOff();
1882+
flushDelayedSave();
1883+
delay(500);
1884+
unmount_fs();
1885+
delay(100);
1886+
}
1887+
18811888
/*
18821889
* Others
18831890
*/

src/dg_main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void endWaitSequence();
9191
void showCopyError();
9292

9393
void allOff();
94+
void prepareReboot();
9495

9596
void mydelay(unsigned long mydel);
9697

src/dg_settings.cpp

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ static const char *CONID = "DGAA";
9898
static uint32_t soa = AC_TS;
9999
static bool ic = false;
100100
static uint8_t* f(uint8_t *d, uint32_t m, int y) { return d; }
101+
static char *uploadFileName = NULL;
101102

102103
static const char *cfgName = "/dgconfig.json"; // Main config (flash)
103104
static const char *ipCfgName = "/dgipcfg.json"; // IP config (flash)
@@ -1066,6 +1067,7 @@ void doCopyAudioFiles()
10661067
}
10671068

10681069
mydelay(500);
1070+
allOff();
10691071

10701072
flushDelayedSave();
10711073

@@ -1354,9 +1356,72 @@ void closeACFile(File& file)
13541356
file.close();
13551357
}
13561358

1357-
void removeACFile()
1359+
void removeACFile(bool isUPLFile)
13581360
{
13591361
if(haveSD) {
1360-
SD.remove(CONFN);
1362+
if(!isUPLFile) {
1363+
SD.remove(CONFN);
1364+
} else if(uploadFileName) {
1365+
SD.remove(uploadFileName);
1366+
}
1367+
}
1368+
}
1369+
1370+
bool openUploadFile(const char *fn, File& file, bool& isDel)
1371+
{
1372+
if(haveSD) {
1373+
1374+
isDel = false;
1375+
1376+
if(!strlen(fn))
1377+
return false;
1378+
1379+
if(!(uploadFileName = (char *)malloc(strlen(fn)+4)))
1380+
return false;
1381+
1382+
uploadFileName[0] = '/';
1383+
uploadFileName[1] = '-';
1384+
uploadFileName[2] = 0;
1385+
strcat(uploadFileName, fn);
1386+
1387+
if((strlen(uploadFileName) <= 9) ||
1388+
(strstr(uploadFileName, "/-delete-") != uploadFileName)) {
1389+
1390+
if((file = SD.open(uploadFileName, FILE_WRITE))) {
1391+
isDel = false;
1392+
return true;
1393+
}
1394+
1395+
} else {
1396+
1397+
uploadFileName[8] = '/';
1398+
SD.remove(uploadFileName+8);
1399+
isDel = true;
1400+
1401+
}
1402+
1403+
free(uploadFileName);
1404+
uploadFileName = NULL;
1405+
}
1406+
1407+
return false;
1408+
}
1409+
1410+
void renameUploadFile()
1411+
{
1412+
if(haveSD && uploadFileName) {
1413+
1414+
char *t = (char *)malloc(strlen(uploadFileName)+4);
1415+
t[0] = uploadFileName[0];
1416+
t[1] = 0;
1417+
strcat(t, uploadFileName+2);
1418+
1419+
SD.remove(t);
1420+
SD.rename(uploadFileName, t);
1421+
1422+
free(t);
1423+
1424+
free(uploadFileName);
1425+
uploadFileName = NULL;
13611426
}
13621427
}

src/dg_settings.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,11 @@ bool check_allow_CPA();
204204
void delete_ID_file();
205205

206206
#include <FS.h>
207-
bool openACFile(File& file);
207+
bool openACFile(File& file);
208208
size_t writeACFile(File& file, uint8_t *buf, size_t len);
209-
void closeACFile(File& file);
210-
void removeACFile();
209+
void closeACFile(File& file);
210+
void removeACFile(bool isUPLFile);
211+
bool openUploadFile(const char *fn, File& file, bool& isDel);
212+
void renameUploadFile();
211213

212214
#endif

0 commit comments

Comments
 (0)