Author Topic: Windows Program for Wireless Programming  (Read 10317 times)

msjfb

  • Newbie
  • *
  • Posts: 28
  • Country: ca
Windows Program for Wireless Programming
« on: April 25, 2015, 12:36:14 PM »
Hi everyone,

I have decided to share a stand-alone program I wrote  that allows wireless programming of Moteino nodes. I essentially decoded Felix's Python script and put everything in a single program. I have been testing it for a couple of days, and it worked perfectly. All the serial code is in a Class, and is event driven.

Now for the bad news: this is written in VB6 :P  So I am supplying the source code so that anyone fluent in DotNet could port it. All the serial code is in a Class, and is event driven.
Not many comments or error checking in the code yet: I ran out of time, I am leaving for a vacation tomorrow...

You can find the EXE program and source files on GitHub at:
[Edit] https://github.com/msjfb/Moteino-Wireless-Programming

A direct link for the (larger) Runtime package (may not be required, see below) can also be found at CNET here:
http://download.cnet.com/Visual-Basic-6-0-Extended-Runtime/3000-2070_4-76018551.html


If you get a 'COMDLG' error when starting the EXE program you need to install VB6 EXTENDED runtimes. You will find the install package in the directory.
I tested this in Windows 7, SP1 and it ran fine. Just install the Run-times only (see enclosed screenshot), and ignore and 'STDOLE' error you may get (I did).

WARNING: If you decide to install the runtime, please create a restore point before. I cannot guarantee that the setup will not damaged your Windows installation!
I can only confirm that I installed it on a clean Windows7, SP1 machine and had no problems.

Usage is pretty simple: Choose the HEX file to upload, local serial port number and Baud rate, and finally the destination NodeId.
Press the START button and the bottom status bar will keep you informed.

Prerequisites have not changed from the Python method: you must have the 'magic code line' present in your destination node sketch to allow wireless programming, and you must have the Wireless Gateway sketch running on your local Gateway node (that is connected to your PC).


Enjoy and please report any bugs, difficulties, etc.

François


« Last Edit: December 14, 2015, 02:16:18 PM by msjfb »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5705
  • Country: us
    • LowPowerLab
Re: Windows Program for Wireless Programming
« Reply #1 on: April 25, 2015, 04:23:16 PM »
François,
Thanks for sharing this in the forum!
I will try to find some time to port this to .net where it should be less dependent on other libs.

luisr320

  • Full Member
  • ***
  • Posts: 227
  • Country: pt
Re: Windows Program for Wireless Programming
« Reply #2 on: September 18, 2015, 02:57:42 PM »
I finally had the opportunity to test your wireless programming application. It works very well and gets read of all that messing around with Pyton.
I would like to ask you if you can make a small change in it: when you click on the HEX file to to look for, make the default directory open in the Temp directory where the build HEX are. Is it possible?
« Last Edit: December 14, 2015, 02:20:19 PM by Felix »

msjfb

  • Newbie
  • *
  • Posts: 28
  • Country: ca
Re: Windows Program for Wireless Programming
« Reply #3 on: October 28, 2015, 11:55:45 PM »
Hi Luis,
sorry for the delay but it looks like I am not getting notifications on this post. Had a great trip to Lisbon and Porto. Lots of walking up and down steep hills! Beats San-Francisco by a mile...
I will look into the change. Would remembering the last directory used fit the bill ?
François

luisr320

  • Full Member
  • ***
  • Posts: 227
  • Country: pt
Re: Windows Program for Wireless Programming
« Reply #4 on: November 03, 2015, 07:54:26 AM »
Hello François. Hope you tried the "Francesinhas" in Porto.

Yes, remembering the last directory would be a major upgrade.

Luis

msjfb

  • Newbie
  • *
  • Posts: 28
  • Country: ca
Re: Windows Program for Wireless Programming
« Reply #5 on: November 03, 2015, 05:24:03 PM »
Luis,
You will find a version 1.1 of the program on Dropbox...
That version stores and retrieves(local INI file) the last path+file chosen.
François



luisr320

  • Full Member
  • ***
  • Posts: 227
  • Country: pt
Re: Windows Program for Wireless Programming
« Reply #6 on: November 10, 2015, 07:56:24 AM »
Thanks  ;)

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Windows Program for Wireless Programming
« Reply #7 on: November 11, 2015, 12:50:13 PM »
It looks very nice.   :)
@luisr320 Is it working for you?

luisr320

  • Full Member
  • ***
  • Posts: 227
  • Country: pt
Re: Windows Program for Wireless Programming
« Reply #8 on: November 13, 2015, 02:41:09 AM »
It works very well. I had devoped my own solution to this problem but now I only use François's app. Much cleaner and no need to mess with Python, the easeast hardest programming language to use.
Being able to remotely program a node is a very convenient feature provided by the Moteino. You can even dip a Moteino in epoxy resin, Han Solo style, and still be able to change its software. And this app really makes it a no brainer.
You should check my video explaining the concept of Wirelessly programming the Moteino (
), but use François app to do it.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Windows Program for Wireless Programming
« Reply #9 on: November 13, 2015, 10:33:11 AM »
@luisr320 Thanks!  BTW, if you're not already aware of it, there's an easier way for creating and locating the .hex file, as compared to the way you're doing it in the video.  I think you'll prefer it.  If you're running Arduino IDE 1.6.5 and above, then
1. go to the Sketch menu on the sketch you want to convert to .hex.  Click on "Export Compiled Binary"
2.  Next, click on Sketch>Show Sketch Folder

Bang.  There the .hex file is, right before your eyes.  Even shorter, (Ctl+Alt+S) followed by (Ctl+K).  Done!   :)
« Last Edit: November 13, 2015, 10:58:10 AM by WhiteHare »

msjfb

  • Newbie
  • *
  • Posts: 28
  • Country: ca
Re: Windows Program for Wireless Programming
« Reply #10 on: November 13, 2015, 01:39:13 PM »
I am thinking of adding command line support to enable 'hands free' programming.
Structure:  MoteinoWirelessProgramming <port>,<BaudRate>,<TargetNode>,<FilePath>

Example (in a .BAT file for instance):
 MoteinoWirelessProgramming 1,115200,6,c:\MyHexFile\TestHexFile.hex

would launch the program in minimized mode, run it with the supplied parameters and exit with an error code that a batch file can read (0=success, 1-9= error code) if needed.

What do you think ?

Francois

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5705
  • Country: us
    • LowPowerLab
Re: Windows Program for Wireless Programming
« Reply #11 on: November 13, 2015, 04:08:07 PM »
I am thinking of adding command line support to enable 'hands free' programming.
Structure:  MoteinoWirelessProgramming <port>,<BaudRate>,<TargetNode>,<FilePath>

Example (in a .BAT file for instance):
 MoteinoWirelessProgramming 1,115200,6,c:\MyHexFile\TestHexFile.hex
would launch the program in minimized mode, run it with the supplied parameters and exit with an error code that a batch file can read (0=success, 1-9= error code) if needed.

What do you think ?
That would be awesome!

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Windows Program for Wireless Programming
« Reply #12 on: November 13, 2015, 04:39:03 PM »
@msjfb I notice that in Linux it's easy to "virtualize" your serial com port by specifying <ip address>:<port number> instead of the serial com port id, for example in the avrdude command line.  If it were possible (?) to do the same with your proposed windows command line, that would be really handy because then you wouldn't need to have your Moteino Wireless Programming Gateway tethered to whatever computer you're using to invoke the wireless upload.  I don't know whether doing that in Windows would be easy or hard, but it's nice to be un-tethered.   ;)
« Last Edit: November 13, 2015, 04:47:14 PM by WhiteHare »

msjfb

  • Newbie
  • *
  • Posts: 28
  • Country: ca
Re: Windows Program for Wireless Programming
« Reply #13 on: November 13, 2015, 05:47:36 PM »
Felix,
A command line option will be in the next revision :)

WhiteHare,
I have done this in the past i.e. open a socket to send out the data instead of a  serial port. Let me look into it.

I also have another idea (also something I have done before): have the program run in 'server' mode and have it listen to commands coming in from a socket.
Ex of possible scenario:
 - Start the program in server mode (gateway on local serial port or remote IP port per local configuration)
 - Wait for a TCP socket connection request from anywhere on the network. Accept the connection.
 - Receive  a command from the 'remote' client: Remote Node number + filepath to send (could be a file on the network or shared directory as long at the account running the program has access to it)
- send the HEX file OTA to the node, with real time feedback on the progress (in %)
- send completed or error message

To initiate a transfer:
- Open a TCPsocket to the 'server'
- wait for a 'OK' response
- send command : "PUSH: File=yyy, Node=x"
- server sends progress until completed, then sends "COMPLETE".

This would allow launching an OTA update from anywhere on the network (manually with any terminal emulation program or through any type of program that can open a TCP socket).

Since this is a bit more involved, it would be nice to have a couple of beta testers before I release it. Any takers ?

Francois
 
« Last Edit: November 13, 2015, 06:08:22 PM by msjfb »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1297
  • Country: us
Re: Windows Program for Wireless Programming
« Reply #14 on: November 13, 2015, 07:34:13 PM »
Since this is a bit more involved, it would be nice to have a couple of beta testers before I release it. Any takers ?

@msjfb:  I ordered a couple more moteino's earlier today, so I'd be happy to help beta test after they arrive.  I wouldn't want that to slow you down though, so I also don't mind deferring to anyone who already has available gear on hand.  Whatever helps.

« Last Edit: November 13, 2015, 08:46:43 PM by WhiteHare »