Skip to content

Commit

Permalink
hwdef: Update scripts to parse CSV files properly
Browse files Browse the repository at this point in the history
fails because of iterator not returning strings and 'dict' object has no attribute 'iterkeys'. Fixed so both scripts run.
  • Loading branch information
joshanne committed Dec 12, 2024
1 parent 85f29a7 commit 1b26522
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ChibiOS/hwdef/scripts/addfunc_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def is_pin(str):
return False

def parse_adc_table(fname, table):
csvt = csv.reader(open(fname,'rb'))
csvt = csv.reader(open(fname,'r'))
i = 0
for row in csvt:
for col in row:
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def parse_dma_table(fname, table):
dma_num = 1
csvt = csv.reader(open(fname,'rb'))
csvt = csv.reader(open(fname,'r'))
i = 0
last_channel = -1
for row in csvt:
Expand Down Expand Up @@ -78,7 +78,7 @@ def check_full_table(table):
sys.stdout.write('\t# format is (DMA_TABLE, StreamNum, Channel)\n')
sys.stdout.write('\t# extracted from %s\n' % os.path.basename(sys.argv[1]))

for k in sorted(table.iterkeys()):
for k in sorted(table.keys()):
s = '"%s"' % k
sys.stdout.write('\t%-10s\t:\t[' % s)
for i in range(len(table[k])):
Expand Down

0 comments on commit 1b26522

Please sign in to comment.