polymech - fw latest | web ui

This commit is contained in:
2026-04-18 10:31:24 +02:00
parent a105c5ee85
commit ab2ff368a6
2972 changed files with 441416 additions and 372 deletions
@@ -0,0 +1,94 @@
#include <ArduinoLog.h>
#include <Ethernet.h>
/*
_ ___ ___ _ _ ___ _ _ ___ _ ___ ___
/_\ | _ \ \| | | |_ _| \| |/ _ \| | / _ \ / __|
/ _ \| / |) | |_| || || .` | (_) | |_| (_) | (_ |
/_/ \_\_|_\___/ \___/|___|_|\_|\___/|____\___/ \___|
Log library example showing several advanced features
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
This example sketch shows most of the features of the ArduinoLog library
*/
const char * charArray = "this is a string";
const char flashCharArray1[] PROGMEM = "this is a string";
String stringValue1 = "this is a string";
IPAddress ipAdress(192, 168, 0, 1);
void setup() {
// Set up serial port and wait until connected
Serial.begin(9600);
while(!Serial && !Serial.available()){}
Log.setPrefix(printPrefix); // set prefix similar to NLog
Log.setSuffix(printSuffix); // set suffix
Log.begin(LOG_LEVEL_VERBOSE, &Serial);
Log.setShowLevel(false); // Do not show loglevel, we will do this in the prefix
}
void loop() {
// set up some random variables
//__FlashStringHelper cannot be declared outside a function
const __FlashStringHelper * flashCharArray2 = F("this is a string");
Log.notice ( "Log global Flash string value : %S" CR, flashCharArray1 );
Log.traceln ( "Log local Flash string value : %S" CR, flashCharArray2 );
Log.notice ( "Log string value : %s" CR, stringValue1.c_str());
Log.verboseln (F("Log ip adress : %p") , ipAdress );
delay(5000);
}
void printPrefix(Print* _logOutput, int logLevel) {
printTimestamp(_logOutput);
printLogLevel (_logOutput, logLevel);
}
void printTimestamp(Print* _logOutput) {
// Division constants
const unsigned long MSECS_PER_SEC = 1000;
const unsigned long SECS_PER_MIN = 60;
const unsigned long SECS_PER_HOUR = 3600;
const unsigned long SECS_PER_DAY = 86400;
// Total time
const unsigned long msecs = millis() ;
const unsigned long secs = msecs / MSECS_PER_SEC;
// Time in components
const unsigned long MiliSeconds = msecs % MSECS_PER_SEC;
const unsigned long Seconds = secs % SECS_PER_MIN ;
const unsigned long Minutes = (secs / SECS_PER_MIN) % SECS_PER_MIN;
const unsigned long Hours = (secs % SECS_PER_DAY) / SECS_PER_HOUR;
// Time as string
char timestamp[20];
sprintf(timestamp, "%02d:%02d:%02d.%03d ", Hours, Minutes, Seconds, MiliSeconds);
_logOutput->print(timestamp);
}
void printLogLevel(Print* _logOutput, int logLevel) {
/// Show log description based on log level
switch (logLevel)
{
default:
case 0:_logOutput->print("SILENT " ); break;
case 1:_logOutput->print("FATAL " ); break;
case 2:_logOutput->print("ERROR " ); break;
case 3:_logOutput->print("WARNING "); break;
case 4:_logOutput->print("INFO " ); break;
case 5:_logOutput->print("TRACE " ); break;
case 6:_logOutput->print("VERBOSE "); break;
}
}
void printSuffix(Print* _logOutput, int logLevel) {
_logOutput->print("");
}
@@ -0,0 +1,90 @@
#include <ArduinoLog.h>
/*
_ ___ ___ _ _ ___ _ _ ___ _ ___ ___
/_\ | _ \ \| | | |_ _| \| |/ _ \| | / _ \ / __|
/ _ \| / |) | |_| || || .` | (_) | |_| (_) | (_ |
/_/ \_\_|_\___/ \___/|___|_|\_|\___/|____\___/ \___|
Log library basic example
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
This example sketch shows most of the most used features of the ArduinoLog library
*/
int intValue1 , intValue2;
long longValue1, longValue2;
bool boolValue1, boolValue2;
const char charNotPrintable = 0x8B;
const char * charArray = "this is a string";
const char flashCharArray1[] PROGMEM = "this is a string";
String stringValue1 = "this is a string";
float floatValue;
double doubleValue;
void setup() {
// Set up serial port and wait until connected
Serial.begin(9600);
while(!Serial && !Serial.available()){}
randomSeed(analogRead(0));
// Pass log level, whether to show log level, and print interface.
// Available levels are:
// LOG_LEVEL_SILENT, LOG_LEVEL_FATAL, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_TRACE, LOG_LEVEL_VERBOSE
// Note: if you want to fully remove all logging code, uncomment #define DISABLE_LOGGING in Logging.h
// this will significantly reduce your project size
Log.begin(LOG_LEVEL_VERBOSE, &Serial);
//Start logging
Log.notice(F(CR "******************************************" CR)); // Info string with Newline
Log.notice( "*** Logging example " CR); // Info string in flash memory
Log.notice(F("******************* ")); Log.notice("*********************** " CR); // two info strings without newline will end up on same line
}
void loop() {
// set up some random variables
intValue1 = random(100);
intValue2 = random(10000);
longValue1 = random(1000000);
longValue2 = random(100000000);
boolValue1 = random(2)==0;
boolValue2 = random(2)==1;
floatValue = 12.34;
doubleValue= 1234.56789;
Log.notice ( "Log as Info with integer values : %d, %d" CR , intValue1, intValue2);
Log.notice (F("Log as Info with hex values : %x, %X" CR ), intValue1, intValue1);
Log.notice ( "Log as Info with hex values : %x, %X" CR , intValue2, intValue2);
Log.notice (F("Log as Info with binary values : %b, %B" CR ), intValue1, intValue1);
Log.notice ( "Log as Info with binary values : %b, %B" CR , intValue2, intValue2);
Log.notice (F("Log as Info with long values : %l, %l" CR ), longValue1, longValue2);
Log.notice ( "Log as Info with bool values : %t, %T" CR , boolValue1, boolValue2);
Log.notice (F("Log as Info with char value : %c" CR ), charArray[0]);
Log.notice ( "Log as Info with char value : %C" CR , charNotPrintable);
Log.notice (F("Log as Info with string value : %s" CR ), charArray);
Log.notice ( "Log as Info with Flash string value : %S" CR , flashCharArray1);
Log.notice ( "Log as Info with string value : %s" CR , stringValue1.c_str());
Log.notice (F("Log as Info with float value : %F" CR ), floatValue);
Log.notice ( "Log as Info with float value : %F" CR , floatValue);
Log.notice (F("Log as Info with double value : %D" CR ), doubleValue);
Log.notice ( "Log as Info with double value : %D" CR , doubleValue);
Log.notice (F("Log as Debug with mixed values : %d, %d, %l, %l, %t, %T" CR ), intValue1 , intValue2 ,
longValue1, longValue2,
boolValue1, boolValue2);
Log.trace ( "Log as Trace with bool value : %T" CR , boolValue1);
Log.traceln ( "Log as Trace with bool value : %T" , boolValue1);
Log.warning ( "Log as Warning with bool value : %T" CR , boolValue1);
Log.warningln( "Log as Warning with bool value : %T" , boolValue1);
Log.error ( "Log as Error with bool value : %T" CR , boolValue1);
Log.errorln ( "Log as Error with bool value : %T" , boolValue1);
Log.fatal ( "Log as Fatal with bool value : %T" CR , boolValue1);
Log.fatalln ( "Log as Fatal with bool value : %T" , boolValue1);
Log.verboseln(F("Log as Verbose with bool value : %T" ), boolValue2);
Log.verbose (F("Log as Verbose with bool value : %T" CR ), boolValue2);
delay(5000);
}