Author Topic: OTA GUI suggestion: parse target [ID] from hex file name  (Read 2276 times)

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
OTA GUI suggestion: parse target [ID] from hex file name
« on: November 03, 2020, 11:41:06 AM »
Hi. I have one suggestion for OTA.
Many, many, many times I send the wrong code via OTA because I forget to change the destination node ID.

Is it possible for the GUI to parse the name of the file and if it finds a number inside square brackets to load that number as the destination node ID automatically?
For instance: gateway[1].hex would load a 1 on the destination node ID automatically.

This way, if I'm making multiple changes to several nodes and sending those changes via OTA, it will be harder to send the new code to the wrong node.

Thank you
« Last Edit: November 05, 2020, 09:02:14 PM by Felix »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #1 on: November 03, 2020, 03:46:32 PM »
If I think I understand what you're really asking ... You mean change a compiled variable that holds the node ID, inside the HEX file being sent?
The short answer is no.

I would compile a generic HEX file and use EEPROM in each node to store their IDs. That would require some initial configuration for each node to set that. That is how you'd want to do it for networks with a lot of nodes that run the same firmware.

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #2 on: November 03, 2020, 06:52:51 PM »
No, my suggestion is much simpler. If you add something like [1] at the end of the hex file name, like gateway[1].hex, the OTA GUI would parse the number between the brackets and automatically fill the destination node ID with that number. So when you load a new hex to send via OTA, there would be less chance of it being sent to the wrong node, as long as you include the node number between brackets at the end of the filename.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #3 on: November 04, 2020, 07:44:25 PM »
Ok, fair enough, possibly a good thing. But hold on ... if you take the time and effort to type a number, as well as the parentheses around it, in a file name, which also requires some clicks, how is that easier than typing just the number in the destination ID?  ???

What I usually do is just copy the path of the Arduino_Temp directory where the sketch is being compiled, and paste it in the OTA GUI. Then I type the ID I just compiled with, in the OTA GUI, upload. Then I change the ID in both places, recompile, upload. Repeat. I personally cant remember if I ever sent a wrong sketch to the wrong node, I dont think I did.

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #4 on: November 05, 2020, 06:57:19 AM »
Well... you would only have to type the node ID once, when creating the name of the sketch. After that, no matter how many times you upload that sketch, it will always have the right ID number automatically preselected on the OTA GUI.

Sometimes I'm in an upload binge for my 10 nodes, and more then once I send the new code to the wrong node.

By the way, for those to whom this hasn't happened yet, if you send new code via OTA to the wrong node, and that node is embedded inside the wall, you don't always have to dig it out to flash it with the cable and the FTDI interface. Just cut the power to the "right" node and upload the code using the wrong node ID again.

Perhaps this only happens to me, but it happened often so I dare think it may have happened to others.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #5 on: November 05, 2020, 11:09:14 AM »
Well... you would only have to type the node ID once, when creating the name of the sketch. After that, no matter how many times you upload that sketch, it will always have the right ID number automatically preselected on the OTA GUI.
OK but isn't that also the same for doing it in the OTA GUI? You just while(remaining nodes to OTA) { type new ID; click upload; }

In fact, if I understand this right, it creates another situation to consider - you have to copy paste the same firmware file as many times as you have nodes, just to rename each and add the node ID. Instead of just typing node IDs in the GUI.

By the way, for those to whom this hasn't happened yet, if you send new code via OTA to the wrong node, and that node is embedded inside the wall, you don't always have to dig it out to flash it with the cable and the FTDI interface. Just cut the power to the "right" node and upload the code using the wrong node ID again.
Yes you'd have to use the latest ID you flashed to restore that node to its former ID. Again, never happened to me that I remember, maybe because I'm too OCD  :)

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #6 on: November 05, 2020, 02:38:52 PM »
I just figured out from what you said that I handle the hex file in a different way from you. I'm using Visual Studio with VSMicro add-on, which always produces the same hex filename every time you compile the same sketch. That's why my suggestion only makes sense to me.
Thanks

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #7 on: November 05, 2020, 03:34:27 PM »
Ok no problem.
In any case, I am willing to add this feature when I will work on the GUI the next time.

luisr320

  • Sr. Member
  • ****
  • Posts: 255
  • Country: pt
Re: Suggestion: Make OTA get the node ID from the file name
« Reply #8 on: November 05, 2020, 06:02:44 PM »
Excelent! Thank you