diff --git a/TWANG32/TWANG32.ino b/TWANG32/TWANG32.ino
index 8c13197..a8e0793 100644
--- a/TWANG32/TWANG32.ino
+++ b/TWANG32/TWANG32.ino
@@ -1196,7 +1196,6 @@ void getInput(){
// -------------- SFX --------------
// ---------------------------------
-/*
/*
This is used sweep across (up or down) a frequency range for a specified duration.
A sin based warble is added to the frequency. This function is meant to be called
diff --git a/TWANG32/config.h b/TWANG32/config.h
index 455e26b..7e184b6 100644
--- a/TWANG32/config.h
+++ b/TWANG32/config.h
@@ -64,6 +64,8 @@
#define MIN_REDRAW_INTERVAL 1000.0 / 60.0 // divide by frames per second..if you tweak adjust player speed
#endif
-
+// Comment or remove the next #define to disable the /metrics endpoint on the HTTP server.
+// This endpoint provides the Twang32 stats for ingestion via Prometheus.
+#define ENABLE_PROMETHEUS_METRICS_ENDPOINT
#endif
diff --git a/TWANG32/wifi_ap.h b/TWANG32/wifi_ap.h
index 618e3bd..f5f0d9d 100644
--- a/TWANG32/wifi_ap.h
+++ b/TWANG32/wifi_ap.h
@@ -9,7 +9,14 @@ WiFiServer server(80);
char linebuf[80];
int charcount=0;
+enum PAGE_TO_SEND
+{
+ Stats,
+ Metrics
+};
+
void ap_setup() {
+
bool ret;
@@ -30,129 +37,166 @@ void ap_setup() {
Serial.println(passphrase);
Serial.println("Web Server Address: http://192.168.4.1");
-
-}
+ }
void sendStatsPage(WiFiClient client) {
- // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
- // and a content-type so the client knows what's coming, then a blank line:
- client.println("HTTP/1.1 200 OK");
- client.println("Content-type:text/html");
- client.println();
- client.println("");
- client.println("
");
- client.println("
TWANG32 Play Stats
");
- client.println("
");
-
-
- client.print("
Games played: "); client.print(user_settings.games_played); client.println("
");
- if (user_settings.games_played > 0) { // prevent divide by 0
+ // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
+ // and a content-type so the client knows what's coming, then a blank line:
+ client.println("HTTP/1.1 200 OK");
+ client.println("Content-type:text/html");
+ client.println();
+ client.println("");
+ client.println("");
+ client.println("
TWANG32 Play Stats
");
+ client.println("
");
+
+ client.print("
Games played: "); client.print(user_settings.games_played); client.println("
");
+ if (user_settings.games_played > 0) { // prevent divide by 0
client.print("
Average score: "); client.print(user_settings.total_points / user_settings.games_played); client.println("
");
- }
- client.print("
High score: "); client.print(user_settings.high_score); client.println("
");
- client.print("
Boss kills: "); client.print(user_settings.boss_kills); client.println("
");
-
+ }
+ client.print("
High score: "); client.print(user_settings.high_score); client.println("
");
+ client.print("
Boss kills: "); client.print(user_settings.boss_kills); client.println("