-
Notifications
You must be signed in to change notification settings - Fork 82
Cleaner, more elegant logging #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- updated logging levels per message type (more in the future) - cleaned up redundancies - increased performances - messages only printed during change of state (once)
- tested on MKR1000 and MKR1010 NOTE: WiFINina wrongly reports "1.2.0" when WiFi.firmwareVersion() is invoked, although version "1.2.1" is set in the source files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request looks good to me ;) I've one suggestion though ... the debugMessage function could be slightly rewritten in order to accomodate variable arguments - then sprintf does not need to be used so much and the code becomes much cleaner to read.
A short example:
#include <stdio.h>
#include <stdarg.h>
...
void debugMessage(uint8_t const debug_level, char const * fmt, ...) {
char debug_buf[64] = {0};
va_list args;
va_start (args, fmt);
uint16_t const length = vsnprintf (debug_bug, 64, fmt, args);
va_end (args);
Serial.print(debug_buf);
}
Usage would be then like: Instead of
*msgBuffer = 0;
sprintf(msgBuffer, "WiFi.status(): %d", WiFi.status());
debugMessage(msgBuffer, 4);
do this
debugMessage(4, "WiFi.status(): %d", WiFi.status());
hey @lxrobotics |
Managed exit cases for GETTIME state. Removed IDLE state.
Managed exit cases for IOT_STATUS_CLOUD_CONNECTED, removed unused states
…nager Revert "Managed exit cases for IOT_STATUS_CLOUD_CONNECTED, removed unused states"
ATTENTION: requires consulting the Cloud team before merging
I have refactored the logging entirely and added one extra level of verbosity (4).
It is now leaner and cleaner.
I also implemented firmware version check and compare but have an issue with WiFiNINA reporting the incorrect version (1.2.0) as latest.