Giter Club home page Giter Club logo

arduino-cmdmessenger's People

Contributors

bigredaye avatar gandy92 avatar ivankravets avatar palatis avatar singajeet avatar thijse avatar valkuc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-cmdmessenger's Issues

Winforms application not receiving messages from arduino

I have a sample winforms application using CmdMessenger connecting at 115200 with DtrEnable set to true. This is running on windows 10 with Arduino getting connected on COM4. The code is based on the Datalogging example

I have the below code in Setup function in the ino file. The winforms application receives the first acknowledge message. But not the second one. Any clues?

void setup()
{
// Listen on serial connection for messages from the pc
Serial.begin(115200);

// Adds newline to every command
cmdMessenger.printLfCr();

// Attach my application's user-defined callback methods
attachCommandCallbacks();

// Send the status to the PC that says the Arduino has booted
cmdMessenger.sendCmd(kAcknowledge,"Arduino has started!");

// set some pin modes
pinMode(kBlinkLed, OUTPUT);
pinMode(....)

cmdMessenger.sendCmd(kAcknowledge,"Setup Completed");
}

Platformio+Digispark compatible solution

I want to use CmdMessenger with Digispark attiny85.

They have their own Stream class, Print classes.. .

  1. First of all I add some functions to Stream class.
int timedRead()
virtual size_t readBytes(char *buffer, size_t length)
  1. I spend a lot of time to find a problem why CmdMessenger can't hear me (only UnknownCommand handler called) ... (I connect Arduino to COM port and want to send-receive bytes in Terminal)

I was angry when I found solution:

Send command 0 
30 3B
Receive command 1
01 2C 33 3B

Digispark made print function without default argument=DEC... for all types except char..
For compatible we should add DEC everywhere in CmdMessenger :(.

comms->print(cmdId, DEC);

and etc

  1. Attiny85 doesn't want to start with CmdMessenger cause little memory.
    I change defines:
#define MAXCALLBACKS        5   // The maximum number of commands   (default: 50) 
#define MESSENGERBUFFERSIZE 20   // The length of the commandbuffer  (default: 64)
#define MAXSTREAMBUFFERSIZE 20  // The length of the streambuffer   (default: 64)

and it works fine :)

There was difficult to find solutions cause:

  1. There is no protocol description or trace. Please add them.
  2. There is no tests written on "C" or "Python" :)

commands coming from arduino have to be sent 2 times

Any command coming from the arduino has to be send twice before the attached method on the c# console program fires. Ive tried lowering the baud rate to 9600 and setting DTR enabled to true.
Using a DFRduino UNO v3.0

some unescape() are missing

There is no unescape in:
readStringArg()
copyStringArg()
compareStringArg()

So you got (with ID=1) from readStringArg() for the transmitted string:

1,Hello\,World\;Or what?;

"Hello\,World\;Or what?"
Of course you can unescape this no in user sketch, but I think, this is not as it should be?

Esp8266 OR Ethernet connectivity

Hi!

Thank you very much for this great piece of software , it helped me a lot in my projects previously. There is an interface for TCP in .Net library for CmdMessenger but it lacks an example on the Arduino side, can you please give us a pointer to how to use this or an example will be highly appreciated. I want to connect an Esp8266 / Ethernet shield to the PC / Raspberry side with GUI and stuff.

Best Regards!

readBin() is not "type-length-safe"

If you use:
uint32_t ui32 = cm.readBinArg();
Then readBinArg() or readBin() will read 4 Bytes from the receiving buffer, ignoring the real length of what is sent and any seperator that may come earlier.
If you send (with ID=1):

1,ABCD;

(with A=0x41, B=0x42, C=0x43, D=0x44) you will get as expected:
0x44434241 = 1145258561.
But if you send:

1,A;

you don't get 0x41 = 65, instead you will get a random value with 0x41 as LSB, 0x00 after it and 2 more "random" bytes from memory.

And ArgOk is not updated.

This should be enhanced with a test if the length (that slpit_r() sees) is big enough, but for this some more changes are needed.

sendCmd can't wait for a response in a typical RS-485 configuration.

I'm using RS-485 in a single-duplex, master-slave arrangement. After transmitting a command, the master must turn off its line driver to allow the slave to respond. This means that I can't use sendEndCmd()'s optional ackCmdId and timeout arguments, since the line driver will still be active when blockedTillReply() runs.

In my my copy, I've added a public waitForReply() that simply wraps the private blockedTillReply(). With that change, the master can sendCmdEnd(), turn off it's driver, and then waitForReply(). This works fine for me. But maybe you have a more creative solution.

Publish CmdMessenger client as NuGet package

As a software developer I can manage the C# CmdMessenger client through NuGet so that I don't have to manually deal with the repository dependency in my development environment.

Hello @thijse, i have been using 3.6 for so many years and I discovered a bug recently so that I want to update to 4.2 - i had CmdMessenger always included in my projects repository which obviously is not great.

First thing i expected was that there would be a NuGet package available. It's so convenient for adding it to your projects dependencies.

Let's publish the C# client as package - that will be great. I am happy to provide a github workflow to do that during release automatically.

Related issue: #34

2 usage questions

Hi,

Sorry to use the issues to ask questions, but I couldn't find a group/forum for this library.
I have started using the library it looks great!

I did manage to get confused about 2 things:

  1. How can I check how many arguments are present in a call ? In a scenario where a variable number of arguments is passed, how can I could the arguments ? (I've noticed that trying to read an argument that isn't there there returns 0.0 for readFloatArg() for example. Is there something I might have missed that already handles argument count ?)
  2. I haven't managed to properly use the SendAndReceiveBinaryArguments function. All I could get the sketch to react to was sending a 0; as binary (0x00 0x3B). I don't think I understood how the binary communication works. Hints ? :)

Thank you,
George

Platformio complains about a missing dependancy

[Fri Jun 16 11:09:17 2017] Processing mega (platform: atmelavr, lib_deps: SdFat, Thread, https://github.com/FastLED/FastLED.git, https://github.com/thijse/Arduino-CmdMessenger.git, upload_speed: 115200, board: megaatmega2560, framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Converting main.ino
Collected 50 compatible libraries
Looking for dependencies...
Error: Could not find `Adafruit-MAX31855` dependency for `CmdMessenger` library
========================================================================================================================= [ERROR] Took 2.01 seconds =========================================================================================================================

my platformio.ini file:

[common]


[env:mega]
platform = atmelavr
framework = arduino
board = megaatmega2560
upload_speed = 115200
lib_deps =
    SdFat
    Thread
    https://github.com/FastLED/FastLED.git
    https://github.com/thijse/Arduino-CmdMessenger.git

I think it's because the library in question is named Adafruit MAX31855 library : http://platformio.org/lib/show/84/Adafruit%20MAX31855%20library/installation

compile error

Encountered the following error when attempting to compile a sketch using CmdMessenger:

Arduino-CmdMessenger/CmdMessenger.cpp:492:9: error: invalid conversion from 'char' to 'char*' [-fpermissive]
  return '\0';

The function is defined to return a pointer as follows;

char* CmdMessenger::readStringArg()

Since the function is returning a char instead of a pointer, this is causing a compiler error.

Should the correct return value be NULL? ie:

return NULL;

Problem with SerialTransport

Hi!
My name is Piotr and I want to ask You for a little help with cmdMessenger and CSharp. I’m not sure is this place appropriate, but I decided to try.
I don’t know what I’m doing wrong, by I can’t help myself with “private SerialTransport _serialTransport;”
My English is not good so maybe I show You on picture:

cmdMess1

cmdMess2

cmdMess3

What I’m doing wrong?

Porting to energia ide for tm4c123g

I was planning to use freertos and tm4c123g but i have already done a project using your library
Thank you for sharing this library
I am planning to port it to energia ide which is similar to arduino ide but for tm4c123

How hard is it to port?

[Feature Request] Checksum for wireless connection

I am controlling an rc vehicle with your lib, but I have the problem that I need a crc (8 or 16) to check the data (connection over Xbee). But I have no idea how I can make that.

Sorry for my english :)

ConsoleShell not doing anything

On my Pro Mini 5V 16MHz I have used the "Communications - SerialEvent" example to prove I can send and receive to the board. I load up the ConsoleShell example and it displays the console options but ignores all input.

In fact none of the examples react to serial monitor input.

Does the library work with the Pro Mini?

CmdMessengerTest failed with Arduino Uno

environment:
Arduino UNO
Arduino IDE 1.6.11
Visual Studio 2015.3
Windows 10x64

prepare CommandMessengerTests:
var device = arduinoNano;
PortName = "COM7"

run CommandMessengerTests (x86, Release)

*** Test Summary ****

Some test sets failed!! 
Test sets passed: 2
Test sets failed: 4

TestLogFile.txt: https://pastebin.com/wZCkLBT4

Question - Bluetooth Listener/Server in c#

Hi There,

I think CmdMessenger is great and have it working just fine with serial between my Pi and arduino. Now I want to add a bluetooth connection between a mobile app and my Pi, with the app initiating the connection (ie Pi listening/server).

I'm pretty sure I can follow the example to initiate from the app. What I have no clue about is how to set the Pi (in c#) to listen for a bluetooth connection.

This guy has already done it to some extent, but to be honest I don't trust his code. The client side stuff he wrote is nowhere near as robust as your examples. So I'm hesitant if you have a better way.
https://www.codeproject.com/Articles/842951/CmdMessenger

Any clues are most welcome!

Sincerely,

Richard

I just need to send strings between my arduino and the pi

anyone have a simple example of how to send a string to the ardino and send a string to the pi?
If I can send a string back and forth than I can do anything need in my code.
if I can get the pi to send the arduino "Hi im the PI" and the ardino to send "Nice to meet you" I can do anything else I need. disregard after going through send/receive example a couple tims figured it out

Nuget package

Hey Thijs, thanks for the great library! I was trying to implement virtually the same thing myself, but it was taking too long and had some nasty bugs. Stumbling upon this has got me up and running once again with minimal effort.

I have created some nuget packages for CmdMessenger to make it easier to install and use in Visual Studio projects - just wanted to know if you are happy for me to publish and maintain them on nuget.org

I have split the bluetooth transport layer into it's own package as it has a dependency (just keeps the core package nice and lean).

ReceivedCommandSignal does not work on my Arduino Uno

Hi,

I am having an issue with the blocked/sync calls, even with the example.
The response is never received from the arduino. Even if I increase the timeout value to 5 sec. It won't help.

Steps to reproduce:

  • Upload sketch SendAndReceiveArguments to Arduino Uno (CH340 chip)
  • Run C# example SendAndReceiveArguments

Expected result:

  • Response: Result of sum and difference

Actual result:

  • No Response

I have tried dtrEnabled with both values (true, false)
When I use the SerialMonitor of the ArduinoIDE and just send the plain command the response is correct and immediate. So it must be in the blocking-code portion on the C# client side. I have spent an hour of debugging but I cannot see the reason. Maybe something with the suspended ReceiveQueue?

The available() should return Current!=null;

For variable number of arguments, this code will not work:

while (cmdMessenger.available())
{
      int curNo=cmdMessenger.readInt16Arg();
      
      // Do something with this number.
}

It will skip 1 parameter at a time. Was this function intended for this?

version appears to be incorrect

Hi, I was browsing the source code while evaluating CmdMessager and noticed the following inconsistency with the README Changelog:

#define _CMDMESSENGER_VERSION 3_6 // software version of this library

As you can see, CmdMessenger.cpp in the master branch shows version 3_6. However, the Changelog indicates the version is "CmdMessenger v4.0.0".

New Python Interface

Hi Thijs,

Thanks for the great library. I've found it quite useful.

I've written a Python interface for an arduino running the CmdMessenger library called PyCmdMessenger (https://github.com/harmsm/PyCmdMessenger). I built this specifically for communication between a raspberry pi and arduino over USB.

Before I put the Python code onto Pip, I wanted to check with you and make sure you're fine with my use of the PyCmdMessenger name. Also, if you like the Python interface, it might also be worth linking to my project from the main CmdMessenger page. There are a huge number of python-centric raspberry pi users that would find the Arduino-CmdMessenger + PyCmdMessenger combination useful.

Thanks,

Mike

Sending command via Arduino USB port causes reset

I am using an Arduino Mega 2560 and PyCmdMessenger.
When I send a simple acknowledge type message to the Arduino through the built-in USB/Serial interface it causes a reset of the Arduino.
However if I connect a external USB/Serial convertor directly to the Tx/Rx pins of the Arduino then it works , no problem.
The Arduino USB/Serial port works normally when not using CmdMessenger (ie for looking at debugging messages in tera term).
I can't work out what is causing the reset - or is this possibly a problem with PyCmdMessenger and the way it handles connections?

Wanted new example using nordic uart nrf52 sending binary data

I need assistance, I think the CmdMessenger is a great idea, I have used it to send data from a bno055 from a arduino over USB serial, it works great,

Now I am trying to using BLE uart using a Adafruit nrf52 feather and the Arduino IDE 1.8.1

CmdMessenger cmdMessenger = CmdMessenger(bleuart);
...
// Send the result of the IMU read using quarternions
//cmdMessenger.sendCmd(kQuarternionSend,q0,q1,q2,q3);
cmdMessenger.sendCmdStart(kQuarternionSend);
cmdMessenger.sendCmdBinArg(mySensor.quat.q0);
cmdMessenger.sendCmdBinArg(mySensor.quat.q1);
cmdMessenger.sendCmdBinArg(mySensor.quat.q2);
cmdMessenger.sendCmdBinArg(mySensor.quat.q3);
cmdMessenger.sendCmdEnd();
}

My problem is that when I use the string version cmdMessenger.sendCmdArg(mySensor.quat.q2);
the terminal shows each character on a new line !
So I am thinking something is wrong on a basic level, when sending a normal
bleuart.println("String to be Printed");
It comes out in one line on the receiver on arduino ble uart app.

I want to change to binary format for the quaternion data so that the message can be sent in one BLE notification / message.
This should be most efficient!

Can anyone assist?

Bo-Erik

compatibility with ESP8266 / WeMos D1 Mini

Hey all,

is this library compatible with the D1? My goal is to use it as interface between an Arduino Uno and the D1 over Serial. However I can't seem to compile any of the example files for the D1, which work just fine on the Uno.

Can you tell me if this an problem on my side or within the library?

Thanks a bunch!

Build Log:


Arduino: 1.8.5 (Linux), Board: "WeMos D1 R2 & mini, 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

/home/anselm/Downloads/arduino-1.8.5/arduino-builder -dump-prefs -logger=machine -hardware /home/anselm/Downloads/arduino-1.8.5/hardware -hardware /home/anselm/Arduino/hardware -tools /home/anselm/Downloads/arduino-1.8.5/tools-builder -tools /home/anselm/Downloads/arduino-1.8.5/hardware/tools/avr -built-in-libraries /home/anselm/Downloads/arduino-1.8.5/libraries -libraries /home/anselm/Arduino/libraries -fqbn=esp8266com:esp8266:d1_mini:CpuFrequency=80,VTable=flash,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=none,UploadSpeed=115200 -ide-version=10805 -build-path /tmp/arduino_build_792499 -warnings=none -build-cache /tmp/arduino_cache_76518 -prefs=build.warn_data_percentage=75 -verbose /home/anselm/Arduino/libraries/CmdMessenger/examples/Receive/Receive.ino
/home/anselm/Downloads/arduino-1.8.5/arduino-builder -compile -logger=machine -hardware /home/anselm/Downloads/arduino-1.8.5/hardware -hardware /home/anselm/Arduino/hardware -tools /home/anselm/Downloads/arduino-1.8.5/tools-builder -tools /home/anselm/Downloads/arduino-1.8.5/hardware/tools/avr -built-in-libraries /home/anselm/Downloads/arduino-1.8.5/libraries -libraries /home/anselm/Arduino/libraries -fqbn=esp8266com:esp8266:d1_mini:CpuFrequency=80,VTable=flash,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=none,UploadSpeed=115200 -ide-version=10805 -build-path /tmp/arduino_build_792499 -warnings=none -build-cache /tmp/arduino_cache_76518 -prefs=build.warn_data_percentage=75 -verbose /home/anselm/Arduino/libraries/CmdMessenger/examples/Receive/Receive.ino
Using board 'd1_mini' from platform in folder: /home/anselm/Arduino/hardware/esp8266com/esp8266
Using core 'esp8266' from platform in folder: /home/anselm/Arduino/hardware/esp8266com/esp8266
Detecting libraries used...
"/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-I/tmp/arduino_build_792499/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI"   -DESP8266 "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/variants/d1_mini" "/tmp/arduino_build_792499/sketch/Receive.ino.cpp" -o "/dev/null"
"/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-I/tmp/arduino_build_792499/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI"   -DESP8266 "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/variants/d1_mini" "-I/home/anselm/Arduino/libraries/CmdMessenger" "/tmp/arduino_build_792499/sketch/Receive.ino.cpp" -o "/dev/null"
Using cached library dependencies for file: /home/anselm/Arduino/libraries/CmdMessenger/CmdMessenger.cpp
Using cached library dependencies for file: /home/anselm/Arduino/libraries/CmdMessenger/utility/DoEvery.cpp
"/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-I/tmp/arduino_build_792499/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI"   -DESP8266 "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/variants/d1_mini" "-I/home/anselm/Arduino/libraries/CmdMessenger" "-I/home/anselm/Arduino/libraries/CmdMessenger/utility" "/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp" -o "/dev/null"
Generating function prototypes...
"/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-I/tmp/arduino_build_792499/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11  -ffunction-sections -fdata-sections -w -x c++ -E -CC -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI"   -DESP8266 "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/variants/d1_mini" "-I/home/anselm/Arduino/libraries/CmdMessenger" "/tmp/arduino_build_792499/sketch/Receive.ino.cpp" -o "/tmp/arduino_build_792499/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/anselm/Downloads/arduino-1.8.5/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_792499/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...


"/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-I/tmp/arduino_build_792499/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI"   -DESP8266 "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/variants/d1_mini" "-I/home/anselm/Arduino/libraries/CmdMessenger" "/tmp/arduino_build_792499/sketch/Receive.ino.cpp" -o "/tmp/arduino_build_792499/sketch/Receive.ino.cpp.o"
Compiling libraries...
Compiling library "CmdMessenger"


Using previously compiled file: /tmp/arduino_build_792499/libraries/CmdMessenger/CmdMessenger.cpp.o
Using previously compiled file: /tmp/arduino_build_792499/libraries/CmdMessenger/utility/DoEvery.cpp.o
"/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/lwip2/include" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-I/tmp/arduino_build_792499/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536   -DARDUINO=10805 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD="ESP8266_WEMOS_D1MINI"   -DESP8266 "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266" "-I/home/anselm/Arduino/hardware/esp8266com/esp8266/variants/d1_mini" "-I/home/anselm/Arduino/libraries/CmdMessenger" "-I/home/anselm/Arduino/libraries/CmdMessenger/utility" "/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp" -o "/tmp/arduino_build_792499/libraries/CmdMessenger/utility/HeaterSim.cpp.o"


/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp: In member function 'void HeaterSim::CalcTemperature()':
/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:73:72: error: no matching function for call to 'max(long unsigned int, int)'
  if (currentTime >= _lastTime) _deltams = max(currentTime - _lastTime,1);
                                                                        ^
/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:73:72: note: candidates are:
In file included from /home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/algorithm:62:0,
                 from /home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h:254,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.h:25,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:23:
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4236:5: note:   template argument deduction/substitution failed:
/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:73:72: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
  if (currentTime >= _lastTime) _deltams = max(currentTime - _lastTime,1);
                                                                        ^
In file included from /home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/algorithm:62:0,
                 from /home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h:254,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.h:25,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:23:
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:4231:5: note:   template argument deduction/substitution failed:
/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:73:72: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
  if (currentTime >= _lastTime) _deltams = max(currentTime - _lastTime,1);
                                                                        ^
In file included from /home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/algorithm:61:0,
                 from /home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h:254,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.h:25,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:23:
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:260:5: note:   template argument deduction/substitution failed:
/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:73:72: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
  if (currentTime >= _lastTime) _deltams = max(currentTime - _lastTime,1);
                                                                        ^
In file included from /home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/algorithm:61:0,
                 from /home/anselm/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h:254,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.h:25,
                 from /home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:23:
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/home/anselm/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algobase.h:216:5: note:   template argument deduction/substitution failed:
/home/anselm/Arduino/libraries/CmdMessenger/utility/HeaterSim.cpp:73:72: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
  if (currentTime >= _lastTime) _deltams = max(currentTime - _lastTime,1);
                                                                        ^
Using library CmdMessenger at version 4.0.0 in folder: /home/anselm/Arduino/libraries/CmdMessenger 
exit status 1
Error compiling for board WeMos D1 R2 & mini.

Reading a string messes up all the arguments.

I've been using CmdMessenger for a while and it seemed to work, however my current application requires the reception of a string through serial. Here's the function:

void onBtChName() {
  sendAck(kACK, kBT_CHNAME, F("Storing new name."));
  uint8_t len = constrain(cmdMessenger.readInt16Arg(), 0, 30);
  cmdMessenger.copyStringArg(bt_newname, len+1);
  Serial.print("New name ");
  Serial.write(bt_newname, len);
  Serial.println(len);
  bt_newnamelen = len;
  bt_chname = true;
  sendAck(kDONE, kBT_CHNAME, F("New name stored. Please commit."));
}

This is the callback attached to kBT_CHNAME, which is command 15. I'd expect it to read two arguments, an integer and a string. However it does not work. If I comment out the string reading part, everything works fine (ex. if I send 15,12,34,56,78;, the len variable would contain 12 as I would expect). However, if I also read the string (which is odd, as the string is read after the integer), it skips two arguments. So while 15,9,Davideddu; does not work, 15,0,0,9,Davideddu; does. Another example, if I send 15,12,34,56,78; len would be set to 56 (actually 30 because of constrain, but it doesn't really matter) and bt_newname would contain 78 + 28 bytes of crap.

This is a pretty odd bug.

P.S.: I wrote a python port of CmdMessenger with a similar API that, however, tries to make use of Python-specific features. you can find it here. I'll document it and add a readme at some point.

Serial exception on Sleep and Disconnect.

So I am using cmdMessenger on a USB serial connection using the watchdog. Every time I sleep my computer and pull my desktop off the docking station. Once when the laptop wakes up I will get the following error and the app crashes.

System.ObjectDisposedException was unhandled Message: An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll Additional information: Safe handle has been closed

looking at a similar problem I found this.
https://stackoverflow.com/questions/3230311/problem-with-serialport/7471010#7471010

I will do some more research and see if I can find a solution.

EDIT:
BTW using .NET 4.5.2 on x64 Windows 10. It crashes with debugging on and off.

EDIT 2:
Also found this.
https://stackoverflow.com/questions/8927410/objectdisposedexception-when-closing-serialport-in-net-2-0
http://zachsaw.blogspot.com/2010/07/net-serialport-woes.html

EDIT 3:
Couldn't find a trace within the code but enabling traces for native windows code I get this.
Stack trace for SampleWatchdog

mscorlib.dll!System.StubHelpers.StubHelpers.SafeHandleAddRef(System.Runtime.InteropServices.SafeHandle pHandle, ref bool success)
System.dll!System.IO.Ports.SerialStream.EventLoopRunner.WaitForCommEvent()
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()	

Maximum baud rate

Hi, I am trying to use CmdMessenger library with over 115200 bps baud rate but didn't have any success. I uploaded a test sketch which sends a value with 250000 bps (using the library). When I opened the serial monitor in Arduino IDE, I can see the values. But the C# program was not triggering the callback routines (even if baud rate was correct). So I think the receiving end is the problem because it does not work although the values are being sent correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.