Skip to content

Commit

Permalink
bf2inav.py: clearer error messages, number PWM outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
sensei-hacker committed Jan 1, 2024
1 parent 4e14423 commit c14f030
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/utils/bf2inav.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def writeTargetC(folder, map):
# if found:
# file.write("//BUSDEV_REGISTER_SPI_TAG(busdev_%s, DEVHW_%s, %s_SPI_BUS, %s_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_%s_ALIGN);\n" % (supportedgyro.lower(), supportedgyro, supportedgyro, supportedgyro, supportedgyro))


snum=1
file.write("\ntimerHardware_t timerHardware[] = {\n")

motors = findPinsByFunction("MOTOR", map)
Expand All @@ -633,8 +633,9 @@ def writeTargetC(folder, map):
#print (timerInfo)
for (t, ch) in timerInfo:
if first:
file.write(" DEF_TIM(%s, %s, %s, TIM_USE_OUTPUT_AUTO, 0, %s),\n" % (t, ch, motor, 0))
file.write(" DEF_TIM(%s, %s, %s, TIM_USE_OUTPUT_AUTO, 0, %s), // S%i\n" % (t, ch, motor, 0, snum))
first = False
snum += 1
else:
file.write(" //DEF_TIM(%s, %s, %s, TIM_USE_OUTPUT_AUTO, 0, %s),\n" % (t, ch, motor, 0))
file.write("\n")
Expand All @@ -648,8 +649,9 @@ def writeTargetC(folder, map):
#print (timerInfo)
for (t, ch) in timerInfo:
if first:
file.write(" DEF_TIM(%s, %s, %s, TIM_USE_OUTPUT_AUTO, 0, %s),\n" % (t, ch, servo, 0))
file.write(" DEF_TIM(%s, %s, %s, TIM_USE_OUTPUT_AUTO, 0, %s), // S%i\n" % (t, ch, servo, 0, snum))
first = False
snum += 1
else:
file.write(" //DEF_TIM(%s, %s, %s, TIM_USE_OUTPUT_AUTO, 0, %s),\n" % (t, ch, servo, 0))
file.write("\n")
Expand Down Expand Up @@ -958,11 +960,14 @@ def main(argv):
print ("%s: %s" % (sys.argv[0], version))
sys.exit(0)

if (os.path.exists(inputfile) and os.path.isdir(outputdir)):
targetDefinition = buildMap(inputfile)
if (not os.path.isfile(inputfile) ):
print("no such file %s" % inputfile)
sys.exit(2)
if (not os.path.isdir(outputdir) ):
print("no such directory %s" % outputdir)
sys.exit(2)
else:
printHelp()
sys.exit(2)
targetDefinition = buildMap(inputfile)


map = buildMap(inputfile)
Expand Down

0 comments on commit c14f030

Please sign in to comment.