Conversation
…re_Revision_Telem
Added global failure that prevents programming from occuring if a length is too long.,
Force all GPS lat/lon/alt to float and also create packet with ASCII padding (0x30 for 0's) just like NMEA ASCII uses.
Update fields to generic configurations.
Working com port variable for scripter.
Test.py is programming from command line!
Single BAT file for running working. Not as cleanly modular as I'd like to much better than before.
Fixed absolute links that were broken to relative for GitHub.
Deleted and renamed folders to better organize.
Changed to REPLACEME's local_device_callsign = 'REPLACEME' # Should match the connected Faraday unit as assigned in Proxy configuration local_device_node_id = REPLACEME # Should match the connected Faraday unit as assigned in Proxy configuration
Proxy config
Just inserted a few newlines to clean up output.
…per_Tutorial_Clean
#68 (review) * Prepend instead of append Zero's * Do not convert to float, all Lat, Lon, Alt remains ASCII string * Fixed bug in the submitted deviceconfig.py that padded ALTITUDE with the ALTITUDE_UNIT length (1 instead of 8 bytes)
GGA format.
Working!
As intended!
Cleaned up debug code in device config. Moved inline INI comments to non-inline.
| units=1 | ||
| unit0call=REPLACEME | ||
| unit0id=REPLACEME No newline at end of file | ||
| unit0call= REPLACEME |
There was a problem hiding this comment.
Style: do you have a style reference for your .ini files? Do you want a space between = and REPLACEME
There was a problem hiding this comment.
That's what I thought as well. I vote for sticking with that.
| padded_data = pad + data | ||
| return padded_data | ||
|
|
||
|
|
There was a problem hiding this comment.
Style: How many newlines do you put between top level defs? For me, it's usually 2.
There was a problem hiding this comment.
We're trying to move towards PEP8 or at least very close to it. I believe it's 2 in there as well. We've been scrambling to get functionality and tutorials updated so lots missed in the last few days and in general. Thanks for pointing out! You;re welcome to clone this branch and fix up some styling towards PEP8. That would be super helpful!
| self.rf_default_boot_freq = [freq_list[2], freq_list[1], freq_list[0]] | ||
| self.rf_PATable = patable_byte | ||
| return True | ||
|
|
There was a problem hiding this comment.
Style: Method definitions inside a class are surrounded by a single blank line.
| altitude_str = commandmodule.create_fixed_length_packet_leading_padding(str(float(altitude_str)), | ||
| self.MAX_ALTITUDE_LEN, 0x30) | ||
|
|
||
|
|
There was a problem hiding this comment.
Style: Too many blank lines between statements
| gps = pkt_struct_gps.pack(self.gps_latitude, self.gps_latitude_dir, self.gps_longitude, self.gps_longitude_dir, | ||
| self.gps_altitude, self.gps_altitude_units, self.gps_boot_bitmask) | ||
|
|
||
|
|
There was a problem hiding this comment.
Style: too many blank lines between statements
| units=1 | ||
| unit0call=REPLACEME | ||
| unit0id=REPLACEME No newline at end of file | ||
| unit0call= REPLACEME |
There was a problem hiding this comment.
That's what I thought as well. I vote for sticking with that.
kb1lqc
left a comment
There was a problem hiding this comment.
Left lots of comments. Overall I agree with @hdkmike that we should improve formatting more towards PEP8 but I think we should let it pass on this commit. Let's get good functionality and then in a new pull request attack code style.
Overall the update appears to work but I did not physically test bootstrap loading. You need to sanitize input better per my comments and possibly some I missed.
I am not sure why you are moving the Tutorials folder?
| """ | ||
| pad_len = fixed_legth - len(data) | ||
| pad = chr(padding_byte) * pad_len | ||
| pad = pad |
There was a problem hiding this comment.
Yep, pretty much does what it says.
Removed on all 3 padding functions.
| :Example: | ||
|
|
||
| >>> pack_data("Test data message", 20, 0x30) | ||
| 'Test data message\x00\x00\x00' |
There was a problem hiding this comment.
You're example differs from the example code output. When I chr(0x30) I get "000" which is not "\x00\x00\x00"
| """ | ||
| pad_len = fixed_legth - len(data) | ||
| pad = chr(padding_byte) * pad_len | ||
| pad = pad |
There was a problem hiding this comment.
Removed as stated above.
| :Example: | ||
|
|
||
| >>> pack_data("Test data message", 20, 0x30) | ||
| '\x00\x00\x00Test data message' |
There was a problem hiding this comment.
Again your example differs from the input 0x30 padding
| return padded_data | ||
|
|
||
|
|
||
| def create_fixed_length_packet_padding(data, fixed_legth, padding_byte): |
There was a problem hiding this comment.
I feel like this could be less brute force by doing something similar to what I did in my aprs.py formatting:
https://github.com/FaradayRF/Faraday-Software/blob/master/Applications/APRS/aprs.py#L137
For example I performed
latDec = str("%.2f" % latDec).zfill(5)
This rounded an input float to two decimal places followed by string conversion. Then ensured the entire string was five characters long, including the decimal point, appending zeros (strings) to the end to fill up.
To do leading Zeros you could split() the string at the decimal point and take the int to the left of the decimal and then use string formatting with something like ("%02d" % int(a)).zfill(5) which would fill up to five characters with leading zeros. Then join*() the strings back together. This uses built in functions in a pretty straightforward way to me.
There was a problem hiding this comment.
I see your point for Zfill on the leading zeros but what about trailing? I can use Zfill and remove trailing zero support completely but how would I ensure the size 4 bytes on righthand decimal side?
There was a problem hiding this comment.
Trailing zeros is exactly what the "%.2f" above does. Notice the two different formatting statements.
| import array | ||
| import sys | ||
|
|
||
| #filename = sys.argv[1] |
There was a problem hiding this comment.
Committing a bunch of commented out code?
| self.CreateOutputFile() | ||
| self.CreateBslScript() | ||
|
|
||
| # ParseTiTxtHexFile(file_program_hex) |
|
|
||
| def CreateBslScript(self): | ||
| #global device_com_port | ||
| #com_string = 'MODE 6xx UART 9600 COM%d PARITY' % device_com_port |
| @@ -55,7 +55,7 @@ To run the code example we've placed hello-world.py in the start folder | |||
| Ensure that Proxy is running in the background! | |||
|
|
|||
| ### Linux (Debian-based) | |||
| * Navigate in terminal to `/git/faraday-software/Tutorials/start` and run `sudo python hello-world.py` | |||
| * Navigate in terminal to `/git/faraday-software/Python_Developer_Tutorials/start` and run `sudo python hello-world.py` | |||
There was a problem hiding this comment.
Why are you changing this? I direct faradayrf.com/start to the readme in Tutorials/start, we need to coordinate this.
| @@ -19,7 +19,7 @@ | |||
| import os | |||
| import sys | |||
| sys.path.insert(0, os.path.abspath('../Faraday_Proxy_Tools/FaradayIO')) #FaradayIO toolset | |||
| sys.path.insert(0, os.path.abspath('../Tutorials/FaradayIO/Tutorial_0')) #FaradayIO toolset | |||
| sys.path.insert(0, os.path.abspath('../Python_Developer_Tutorials/FaradayIO/Tutorial_0')) #FaradayIO toolset | |||
There was a problem hiding this comment.
Again, why changing? Needs coordination.
Fixed padding function examples to have more accurate examples.
For callsign, callsign id, and GPIO defaults.
Min and Max allowable frequency.
|
@kb1lqc This pull request has changed from fixing the noted issue for GPS into a "implement complete configuration file checking" |
Updated a few relavent ones but this is just crazy out of scope for this puyll request. Will make future issue enhancement. All intended updates are shown working, optimized or not.
kb1lqc
left a comment
There was a problem hiding this comment.
I've made my comments and overall we just need the fixes this offers. We'e created issue tickets for relevant fixes we know need to be made to these files. Time to move on.
|
|
||
| >>> pack_data("Test data message", 20) | ||
| >>> testdata = create_fixed_length_packet("Test data message", 20) | ||
| >>> print repr(testdata) |
There was a problem hiding this comment.
Should eventually remove test print cases
| >>> pack_data("Test data message", 20, 0x30) | ||
| 'Test data message\x00\x00\x00' | ||
| >>> testdata = create_fixed_length_packet_padding("Test data message", 20, 0x7E) | ||
| >>> print testdata |
| >>> pack_data("Test data message", 20, 0x30) | ||
| '\x00\x00\x00Test data message' | ||
| >>> testdata = create_fixed_length_packet_leading_padding("Test data message", 20, 0x7E) | ||
| >>> print testdata |
kb1lqc
left a comment
There was a problem hiding this comment.
We've made necessary fixes and created relevant issue tickets for more thorough checks and formatting. Let's move on.






Combining Pull request #68 and a developer tutorial cleanup. Accidentally edited both into a single branch and it's easier to just push them both through.
GPS Bug
Fixed #63 and updated other similar items.
Device Configuration (General)
#Developer Tutorial Cleaning