Skip to content

Commit

Permalink
Adding more debugging points
Browse files Browse the repository at this point in the history
  • Loading branch information
RaiBnod committed Nov 27, 2024
1 parent 84eb5e4 commit ff844a8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,20 @@ def read_di(io_num=None):
@app.route('/api/' + api_ver + '/read/' + ui + '/<io_num>', methods=['GET'])
def read_ai(io_num=None):
gpio = analog_in(io_num)
print("gpio", gpio)
min_range = ui_calibration_table(io_num)[0]
max_range = ui_calibration_table(io_num)[1]
print("min_range", min_range)
print("max_range", max_range)
if gpio == -1:
return jsonify({'1_state': "unknownType", '2_ioNum': io_num, '3_gpio': gpio, '4_val': 'null',
"5_msg": analogInTypes}), http_error
else:
print("ADC", ADC)
print("ADC.read(gpio)", ADC.read(gpio))
print("Check...")
val = ui_scale(io_num, ADC.read(gpio)) # !!! GPIO CALL !!!
print("val", val)
# val = fake_analogue_data() # !!! FOR TESTING !!!
return jsonify({'1_state': "readOk", '2_ioNum': io_num, '3_gpio': gpio, '4_val': val,
'5_msg': 'read value ok', '6_min_range': min_range, '7_max_range': max_range}), http_success
Expand Down

0 comments on commit ff844a8

Please sign in to comment.