Index: Teensy_Python_scripts/.idea/vcs.xml =================================================================== diff -u --- Teensy_Python_scripts/.idea/vcs.xml (revision 0) +++ Teensy_Python_scripts/.idea/vcs.xml (revision d2f07b0563ab2aaeca34241d3f6ebb2da5dd3c0c) @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file Index: Teensy_Python_scripts/__pycache__/sensorCommands.cpython-313.pyc =================================================================== diff -u -r449f6936bd3fd84d8c4da61448702ca24015d778 -rd2f07b0563ab2aaeca34241d3f6ebb2da5dd3c0c Binary files differ Index: Teensy_Python_scripts/conductivity.py =================================================================== diff -u -rffd8133b92274cfd07e4d94068c938534a41813d -rd2f07b0563ab2aaeca34241d3f6ebb2da5dd3c0c --- Teensy_Python_scripts/conductivity.py (.../conductivity.py) (revision ffd8133b92274cfd07e4d94068c938534a41813d) +++ Teensy_Python_scripts/conductivity.py (.../conductivity.py) (revision d2f07b0563ab2aaeca34241d3f6ebb2da5dd3c0c) @@ -22,21 +22,21 @@ start_time = time.time() # # Execute initialization function -# print("\nStart initialization") -# sensorCommands.initializeAllSensors(ser) -# time.sleep(init_delay) +print("\nStart initialization") +sensorCommands.initializeAllSensors(ser) +time.sleep(init_delay) # # # # Get initialization status -# print("\nGet initialization status") -# sensorCommands.getInitStatus(ser) +print("\nGet initialization status") +sensorCommands.getInitStatus(ser) # # # # # Read single sensor value j 4 # # # print("\nRead Sensor 4") # # # sensorCommands.readSingleSensorMeasurement(ser, 4) # # # # # Read single sensor value j 6 -# print("\nRead Sensor 6") -# sensorCommands.readSingleSensorMeasurement(ser, 6) +print("\nRead Sensor 6") +sensorCommands.readSingleSensorMeasurement(ser, 6) # # # # # Read all sensor value # print("\nRead All Sensors") @@ -51,28 +51,27 @@ # sensorCommands.loopAllSensorReadings(ser) # # Get EEPROM data -print("\nGet EEPROM data") -sensorCommands.getEEPROMdata(ser) - -print("\nUpdate EEPROM data") -sensorCommands.updateEEPROMData(ser, 45.342, 3634.3442, 63232.322, 6232.22) +# print("\nGet EEPROM data") +# sensorCommands.getEEPROMdata(ser) # -print("\nGet EEPROM data") -sensorCommands.getEEPROMdata(ser) +# print("\nUpdate EEPROM data") +# # sensorCommands.updateEEPROMData(ser, 45.342, 3634.3442, 63232.322, 6232.22) +# # +# print("\nGet EEPROM data") +# sensorCommands.getEEPROMdata(ser) # -# # # Get measurement settings -# print("\nGet Measurement Settings") -# sensorCommands.getMeasurementSettings(ser) -# -# # Get measurement settings -# print("\nUpdate Measurement Settings") -# sensorCommands.updateMeasurementSettingsStruct(ser) -# -# # # # Get measurement settings -# print("\nGet Measurement Settings") -# sensorCommands.getMeasurementSettings(ser) +# Get measurement settings +print("\nGet Measurement Settings") +sensorCommands.getMeasurementSettings(ser) -# +# Get measurement settings +print("\nUpdate Measurement Settings") +sensorCommands.updateMeasurementSettingsStruct(ser) + +# Get measurement settings +print("\nGet Measurement Settings") +sensorCommands.getMeasurementSettings(ser) + # Get all sensor data # print("\nGet all sensor data") # sensorCommands.getAllSensorData(ser) Index: Teensy_Python_scripts/sensorCommands.py =================================================================== diff -u -rffd8133b92274cfd07e4d94068c938534a41813d -rd2f07b0563ab2aaeca34241d3f6ebb2da5dd3c0c --- Teensy_Python_scripts/sensorCommands.py (.../sensorCommands.py) (revision ffd8133b92274cfd07e4d94068c938534a41813d) +++ Teensy_Python_scripts/sensorCommands.py (.../sensorCommands.py) (revision d2f07b0563ab2aaeca34241d3f6ebb2da5dd3c0c) @@ -10,6 +10,27 @@ loop_time = 10 +# List of Measurement Settings parameters used to unpack the update status response +cfgSettingsParam = [ + "sinfreq", + "dacpp", + "bias", + "rtia", + "pga", + "dftnum", + "avgnum" +] + +# List of expected update measurement settings status response +UPDATE_CFG_STATUS = { + 0: "ERR_UNRECOGNIZED_PARAM", + 1: "NO_CHANGE_TO_TIA", + 2: "NO_CHANGE_TO_PGA", + 3: "NO_CHANGE_TO_DFT_NUM", + 4: "NO_CHANGE_TO_AVG_NUM", + 5: "SUCCESS" +} + ########################################################################################## # Execute initialization function def initializeAllSensors(ser): @@ -71,6 +92,7 @@ parsePackets.parseMesaurementData(serial_data) ########################################################################################## +# Function to pack measurement settings in CSV format def packMeasurementSettingsCSV(): # Define measurement settings values SinFreq = 11000.0 @@ -87,27 +109,7 @@ return csv_command ########################################################################################## - - -cfgSettingsParam = [ - "sinfreq", - "dacpp", - "bias", - "rtia", - "pga", - "dftnum", - "avgnum" -] - -UPDATE_CFG_STATUS = { - 0: "ERR_UNRECOGNIZED_PARAM", - 1: "NO_CHANGE_TO_TIA", - 2: "NO_CHANGE_TO_PGA", - 3: "NO_CHANGE_TO_DFT_NUM", - 4: "NO_CHANGE_TO_AVG_NUM", - 5: "SUCCESS" -} - +# Function to send measurement settings in CSV format and receive status response def updateMeasurementSettingsStruct(ser): ser.reset_input_buffer() printTimestamp() @@ -122,15 +124,6 @@ time.sleep(0.2) response = ser.read(7) # MAX_CONDUCTIVITY_MST_PARAM_IDX = 7 - UPDATE_CFG_STATUS = { - 0: "ERR_UNRECOGNIZED_PARAM", - 1: "NO_CHANGE_TO_TIA", - 2: "NO_CHANGE_TO_PGA", - 3: "NO_CHANGE_TO_DFT_NUM", - 4: "NO_CHANGE_TO_AVG_NUM", - 5: "SUCCESS" - } - if len(response) == len(cfgSettingsParam): print("Received update status for all parameters:") for idx, status_byte in enumerate(response): @@ -141,7 +134,6 @@ else: print(f"Expected {len(cfgSettingsParam)} bytes, received {len(response)} bytes. Response incomplete.") - ########################################################################################## # Function to read all the sensor values def getMeasurementSettings(ser): @@ -158,7 +150,7 @@ ########################################################################################## def updateEEPROMData(ser, *values): """ - Sends a 'save' command with 1 to N EEPROM values over UART in CSV format, + Sends a 'upe' command with 1 to N EEPROM values over UART in CSV format, and interprets the response using Update_EEPROM_Status codes. Args: