Open DavidB445 opened 3 years ago
Hi Dave,
Thanks for that - I'll look at it.
I was going to mention two things: It might be worth (in the UI) checking the exit code of the python script - if it is non-zero, it's failed (I know, I wish it didn't have bugs...!) and so, you could pop up an error message showing what the script printed to stderr, and then at least the users would know roughly what had happened. The reason I was using strings was to avoid the leading 0 (ie 017) being stripped to 17, as it should be left alone, as the DCS code should be 3 digit.
Clearly I've been inconsistent, in that it is being read and stored as a number in the json descriptor - I think I should change that so it is a string, then everything will be consistent.
Will try to get that updated in a day or so - do let me know if that doesn't fix it!
Cheers David
I checked the channel on the radio that had DCS set to 017, which was stored as 17 in the json, and it was still set correctly. I didn't check any other value but it may be fine to read and write them as a number. Although if its stored on the radio with the leading zero it may be best to parse them as strings instead.
Yeah, I did add some extra exit codes to the script as well as a timeout to the serial connection to exit with code 1 if it couldn't get a response from the radio, rather than sitting in a loop. That way I can tell if it either completed the download/upload or failed. As I'm simply calling the script via the compiled exe version with the parameters needed and then waiting for the process to complete before continuing, which would try to continue even if it failed. So checking the exit code I can tell if it failed or not. I'm not sure how complicated it would be to read the actual console output in order to get the stderr output into the editor to show. I guess using different exit codes for standard errors may be a way around it. Possibly keeping the script console open to show the error before closing it.
I have uploaded the version with my changes, which I'm using in the editor. So you can see where I've added the exit codes, and some other small tweaks. Python isn't a language I've used very often so there's probably better ways of doing it than what I've done haha https://github.com/DavidB445/RT73-JSON-CPS
Hi David,
I'm hoping I'll have a chance to look at this over the next few days and hopefully fix it - I suspect that using a str() call before the JSON is stored would be easiest - that way, things will get force-stored as strings.
What you might want to do is fork my github repository then apply your changes. That way, it makes it easier for you to pull in new changes I make in the base repository, and also, if and when it suits, you can submit patches back to me - it makes it easier for us both to keep things in sync, rather than just having a 'fresh import' of mine, if that makes sense. Up to you, either way!
Cheers
David
On Wed, 26 May 2021 at 20:23, DavidB445 @.***> wrote:
I checked the channel on the radio that had DCS set to 017, which was stored as 17 in the json, and it was still set correctly. I didn't check any other value but it may be fine to read and write them as a number. Although if its stored on the radio with the leading zero it may be best to parse them as strings instead.
Yeah, I did add some extra exit codes to the script as well as a timeout to the serial connection to exit with code 1 if it couldn't get a response from the radio, rather than sitting in a loop. That way I can tell if it either completed the download/upload or failed. As I'm simply calling the script via the compiled exe version with the parameters needed and then waiting for the process to complete before continuing, which would try to continue even if it failed. So checking the exit code I can tell if it failed or not. I'm not sure how complicated it would be to read the actual console output in order to get the stderr output into the editor to show. I guess using different exit codes for standard errors may be a way around it. Possibly keeping the script console open to show the error before closing it.
I have uploaded the version with my changes, which I'm using in the editor. So you can see where I've added the exit codes, and some other small tweaks. Python isn't a language I've used very often so there's probably better ways of doing it than what I've done haha https://github.com/DavidB445/RT73-JSON-CPS
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davidmpye/RT73-utils/issues/2#issuecomment-849056198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARIHYNEISPQ2XGFG6EYGE3TPVDDRANCNFSM45RW3GNQ .
Hi David,
I noticed an issue with the DCS Codes when trying to upload a JSON codeplug to the radio. The script console window would open immediately close without doing anything. After looking at why this was happening I found that it was related to the DCS Codes where it would say that the value isn't in the list (of DCS Codes).
The list of DCS_Codes is written as strings but read and stored in the JSON as a number (integer) so changing the list to suit seems to have solved the issue and will now successfully upload the same JSON codeplug that has the DCS Code selected.
Cheers, Dave MM7DBT