\n"
+ + prefix + "
Sensor " + (i+1) + ":
\n";
+
+ for(int j = 0; j < names.length; j++) {
+ html += prefix + "
" + names[j] + ": " + defaults[j] + "
\n";
+// javascript2 += " updateSenorItem(data, \"%s\", \"%s\");\t //For: %s\n".formatted( varStr, names[j] + " " + (i+1), names[j] + " " + (i+1));
+
+ //Charts use the data set id that is created in the heading
+ if (onChart[j]) {
+ javaScript += " addData(data, \"%s\", window.%sChart.data.datasets[%d]);\t //For: %s\n".formatted( vars[j].get(i).getHTMLID(), names[j].toLowerCase(), i, names[j] + " " + (i+1));
+ }
+ }
+
+ html += prefix + "
\n";
+ }
+
+// System.out.println("\nHTML:");
+// System.out.println(html);
+
+// System.out.println("\nJavascript:");
+// System.out.println(javascript);
+// System.out.println(javascript2);
+
+ return html;
+ }
+
+
+
+
+
+
+ /**
+ * Generates the STM32 Binary array in a C header
+ * @param generatedFileName
+ * @param binaryFilePath
+ */
+ private static void generateSTMBinaries(String generatedFileName, String binaryFilePath ) {
+
+ try {
+ //Get the raw data from the file
+
+ //Output the raw data into a C header which is a big array
+ PrintWriter output = new PrintWriter(new FileWriter(generatedFileName));
+
+ output.println(FILETOPPER + "\n");
+
+ //Prevent header recursion errors
+ output.println("#ifndef _" + generatedFileName.toUpperCase().replace(".", "_"));
+ output.println("#define _" + generatedFileName.toUpperCase().replace(".", "_") + "\n");
+ output.println("const uint8_t STMFirmware[] = {");
+
+ DataInputStream reader = new DataInputStream(new FileInputStream(binaryFilePath));
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream)) {
+// gzipOutputStream.write(reader.readAllBytes());
+ try {
+ while (true) {
+ output.print("0x" + byteToHex(reader.readByte()) + ", ");
+ }
+ } catch (EOFException e) {
+ //The end of the file was found
+ }
+ }
+ reader.close();
+
+// byte[] data = byteArrayOutputStream.toByteArray();
+//
+//
+// for (int i = 0; i < data.length; i++) {
+// output.print("0x" + byteToHex(data[i]) + ", ");
+// }
+
+ output.println("};\n\n");
+
+
+ output.println("#endif");
+
+ output.close();
+ } catch (IOException e) {
+ System.out.println("'generateSTMBinaries()' failed: " + e.getMessage());
+ }
+
+ }
+
+
+ private static Variable getMainVariable(String filePath) {
+ ArrayList