These are chat archives for esp8266/Arduino

4th
Jul 2016
Michael Miller
@Makuna
Jul 04 2016 00:47
@igrr I just got the notification for update to the latest release, and it is broken...
Arduino: 1.6.9 (Windows 10), Board: "WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"

Board d1_mini (platform esp8266, package esp8266) is unknown

Error compiling for board WeMos D1 R2 & mini.
mmmm, its looking for 2.2.0 but the latest is 2.3.0?
Could not find boards.txt in C:\Users\...\esp8266\hardware\esp8266\2.2.0. Is it pre-1.5?
Michael Miller
@Makuna
Jul 04 2016 00:54
There seemed to be some remnants of 2.2.0 present, manually deleting those seems to have fixed the issue.
andig
@andig
Jul 04 2016 17:09

Got a question regarding compiler (or preprocessor?) mixing up types. I've moved my debugging into a macro:

#define DEBUG_MSG(module, format, ...) debug_message(module, format, ##__VA_ARGS__ )

void debug_message(const char *module, const char *format, ...) {
  ets_printf("[%-6s] ", module);

  va_list args;
  va_start(args, format);
  ets_printf(format, args);
  va_end(args);
}

This works in principle but suddenly the variable substitutions for the printf are all screwed up, as if addresses get printed instead of the actual variable contents, e.g.

DEBUG_MSG(CORE, "heap/cont/min: %d / %d / %d\n", heap, ummHeapInfo.maxFreeContiguousBlocks * 8, g_minFreeHeap);

gives obvious nonsense:

[core  ] heap/cont/min: 1073681648 / 1073681632 / 8

or in this example:

ets_printf(plugin->getName().c_str());
DEBUG_MSG("websrv", "plugin: %s\n", plugin->getName().c_str());

gives

analog[websrv] plugin: 
any idea what wrong with the debug macro?
andig
@andig
Jul 04 2016 18:30
Solved: need to use v* functions for variable args:
  va_list args;
  char buf[100];
  va_start(args, format);
  vsnprintf(buf, 100, format, args);
  ets_printf(buf);
  // ets_printf(format, args);
  va_end(args);