From 6bc7601e8f6c83c8def86aa7ae7cf06f51593771 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Sat, 18 Feb 2023 18:48:42 +0000 Subject: remove all use of FP in printf as it's not thread safe --- app/httpd.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'app/httpd.c') diff --git a/app/httpd.c b/app/httpd.c index 71c62a4..1c8fb17 100644 --- a/app/httpd.c +++ b/app/httpd.c @@ -52,11 +52,11 @@ static uint32_t make_alarm (void) } PTB_ADD (" UTC: %s\n", buf); - PTB_ADD (" RA: %.9f\n", ra); + PTB_ADD (" RA: %sf\n", fd1 (ra, 0, 1, 9)); PTB_ADD ("\n"); PTB_ADD ("\n"); - PTB_ADD ("\n", lra); + PTB_ADD ("\n", fd1 (lra, 0, 1, 9)); PTB_ADD ("\n", l.hour, l.minute, l.second, l.nanosecond / 1000); PTB_ADD ("
LRA:
LRA:
LST:
\n"); @@ -94,8 +94,8 @@ static uint32_t make_index (void) PTB_ADD ("
\n");
   PTB_ADD (" UTC: %s\n", buf);
-  PTB_ADD (" RA:                  %.9f\n", ra);
-  PTB_ADD (" LRA:                 %.9f\n", lra);
+  PTB_ADD (" RA:                  %s\n", fd1 (ra, 0, 1, 9));
+  PTB_ADD (" LRA:                 %s\n", fd1 (lra, 0, 1, 9));
   PTB_ADD (" LST:                 %02d:%02d:%02d.%06d\n", l.hour, l.minute, l.second, l.nanosecond / 1000);
   PTB_ADD ("
\n"); PTB_ADD ("\n"); @@ -125,8 +125,8 @@ static uint32_t make_index (void) } PTB_ADD (" UTC: %s\n", buf); - PTB_ADD (" RA: %.9f\n", ra); - PTB_ADD (" LRA: %.9f\n", lra); + PTB_ADD (" RA: %s\n", fd1 (ra, 0, 1, 9)); + PTB_ADD (" LRA: %s\n", fd1 (lra, 0, 1, 9)); PTB_ADD (" LST: %02d:%02d:%02d.%06d\n", l.hour, l.minute, l.second, l.nanosecond / 1000); PTB_ADD ("\n"); @@ -259,22 +259,18 @@ int fs_open_custom (struct fs_file *file, const char *name) { if (!strcmp (name, "/index.html")) { - file->data = (const char *)html_buf; - file->len = make_index(); - } - else if (!strcmp (name, "/alarm.html")) { - file->data = (const char *)html_buf; + file->data = (const char *)html_buf; + file->len = make_index(); + } else if (!strcmp (name, "/alarm.html")) { + file->data = (const char *)html_buf; file->len = make_alarm(); - } - else if (!strcmp (name, "/meteotime.dat")) { - file->data = (const char *)meteotime_data; - file->len=sizeof(meteotime_data); - } - else if (!strcmp (name, "/ephemeris.dat")) { - file->data = (const char *)ephemeris; - file->len=sizeof(ephemeris); - } - else { + } else if (!strcmp (name, "/meteotime.dat")) { + file->data = (const char *)meteotime_data; + file->len = sizeof (meteotime_data); + } else if (!strcmp (name, "/ephemeris.dat")) { + file->data = (const char *)ephemeris; + file->len = sizeof (ephemeris); + } else { printf ("looking for url=%s, found nothing\n", name); return 0; } -- cgit v1.2.3