SequentMicrosystems / smtc-rpi

Command line interface, Python, Node-RED drivers for Eight Thermocouples DAQ HAT
MIT License
1 stars 1 forks source link

Python library smtc returns invalid value once temperature value goes negative #1

Closed rbogdan closed 9 months ago

rbogdan commented 11 months ago

If it is below freezing the command line smtc 1 read 3 reads the temperature as : -0.7 but the python library function sensor.get_temp(3) returns 6552.9

I instantiated and set sensor type using: sensor = sm_tc.SMtc(1) sensor.set_sensor_type(1, 3)

Values returned by get_temp appear to be correct until temperature values go negative.

alexburcea2877 commented 11 months ago

Hi, It is a wrong data conversion in python. We will fix it asap. Thank you.

alexburcea2877 commented 11 months ago

Hi, Please update the library, instructions in readme.

rbogdan commented 11 months ago

Hello, I did the update according to the guide. The update did not work properly and the temperatures below zero degs C were still incorrect. So I reinstalled from scratch and the problem remains. The last attempt via reinstall used the following steps: mv smtc-rpi smtc-rpi-oldgit clone https://github.com/SequentMicrosystems/smtc-rpi.git cd smtc-rpi/python/sm_tc/ sudo python setup.py install And the problem still exists. Is there a library or Src file I can verify the changes in? Bob

On Friday, November 3, 2023 at 02:28:37 AM EDT, Alexandru Burcea ***@***.***> wrote:  

Hi, It is a wrong data conversion in python. We will fix it asap. Thank you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

alexburcea2877 commented 11 months ago

Hi,

I do not understand why you move the old repo, the steps should look like this: 1) go to the repo folder : "cd smtc-rpi" 2) run the pull command: "git pull" (this will override the old repo with the new one) 3) go to the python folder: "cd python/smtc " 4) reinstall the library: " sudo python setup.py install"

Alex.

On Wed, Nov 15, 2023 at 5:57 AM rbogdan @.***> wrote:

Hello, I did the update according to the guide. The update did not work properly and the temperatures below zero degs C were still incorrect. So I reinstalled from scratch and the problem remains. The last attempt via reinstall used the following steps: mv smtc-rpi smtc-rpi-oldgit clone https://github.com/SequentMicrosystems/smtc-rpi.git cd smtc-rpi/python/sm_tc/ sudo python setup.py install And the problem still exists. Is there a library or Src file I can verify the changes in? Bob

On Friday, November 3, 2023 at 02:28:37 AM EDT, Alexandru Burcea @.***> wrote:

Hi, It is a wrong data conversion in python. We will fix it asap. Thank you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/SequentMicrosystems/smtc-rpi/issues/1#issuecomment-1811770870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3ZCWW2JUZNTF32FHAR57DYEQ4UPAVCNFSM6AAAAAA633BNDGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJRG43TAOBXGA . You are receiving this because you commented.Message ID: @.***>

rbogdan commented 11 months ago

I could have been much clearer, sorry. I did do the git pull update first. No errors and everything went well doing the update. The I rebooted and let my SW run, it took a day or so to get down to 0 deg C but the same problem occurred. Then I decided to do a full install. So for that, so git would not complain, I moved the original directory and did a fresh git clone and install. It also was a few more days before it got down to 0 deg C but once it did the temperature values were still wrong. That why I was asking if there was some way I could verify the changes made it to my installation, both SRC and LIB. Is there a way I can verify the change? Bob

On Wednesday, November 15, 2023 at 04:01:03 AM EST, Alexandru Burcea ***@***.***> wrote:  

Hi,

I do not understand why you move the old repo, the steps should look like this: 1) go to the repo folder : "cd smtc-rpi" 2) run the pull command: "git pull" (this will override the old repo with the new one) 3) go to the python folder: "cd python/smtc " 4) reinstall the library: " sudo python setup.py install"

Alex.

On Wed, Nov 15, 2023 at 5:57 AM rbogdan @.***> wrote:

Hello, I did the update according to the guide. The update did not work properly and the temperatures below zero degs C were still incorrect. So I reinstalled from scratch and the problem remains. The last attempt via reinstall used the following steps: mv smtc-rpi smtc-rpi-oldgit clone https://github.com/SequentMicrosystems/smtc-rpi.git cd smtc-rpi/python/sm_tc/ sudo python setup.py install And the problem still exists. Is there a library or Src file I can verify the changes in? Bob

On Friday, November 3, 2023 at 02:28:37 AM EDT, Alexandru Burcea @.***> wrote:

Hi, It is a wrong data conversion in python. We will fix it asap. Thank you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/SequentMicrosystems/smtc-rpi/issues/1#issuecomment-1811770870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD3ZCWW2JUZNTF32FHAR57DYEQ4UPAVCNFSM6AAAAAA633BNDGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJRG43TAOBXGA . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

alexburcea2877 commented 11 months ago

I was sure about the conversion in python but let me test it. The line I am talking about is line 73 in init.py

alexburcea2877 commented 11 months ago

Hi I manage to test the library and it gives me good results: thermocouples

rbogdan commented 11 months ago

Thanks Alex, I will pull my unit and bring it inside to set up a test bed using our freezer. Its been hovering right above freezing here so I have to wait days to test with it outside and then it's in the middle of the night. I will let you know what I find even if it is embarrassing on my part since you took the time to verify for me. Bob

On Thursday, November 16, 2023 at 08:42:28 AM EST, Alexandru Burcea ***@***.***> wrote:  

Hi I manage to test the library and it gives me good results:

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

rbogdan commented 11 months ago

Alex, I'm not sure how I get myself into these situations but what I found was that there were two versions of the sm_tc package after doing the update and the import in my program was selecting the older one. I had a heck of a time trying to resolve that and ended up having to delete them and then use pip install instead of setup.py install. Once I ran pip install in the ~/smtc-rpi/python/sm_tc directory it worked and the values returned were fixed as well. Thanks for your help, Bob @.***:~ $ pythonPython 3.9.2 (default, Mar 12 2021, 04:06:34)[GCC 10.2.1 20210110] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import sm_tc>>> print(sm_tc.file)/usr/lib/python3.9/site-packages/sm_tc-1.0.1-py3.9.egg/sm_tc/init.py

@.:~ $ ll /usr/lib/python3.9/site-packages/sm_tc-1.0.1-py3.9.egg-rw-r--r-- 1 root root 3622 Sep  3 15:02 /usr/lib/python3.9/site-packages/sm_tc-1.0.1-py3.9.egg @.:~ $ cd @.***:/usr/lib/python3.9/site-packages $ lltotal 32drwxr-xr-x 35 root root 12288 Sep  2 17:50 ..drwxr-xr-x  4 root root  4096 Sep  2 17:50 smbus2-0.4.3-py3.9.egg-rw-r--r--  1 root root  3622 Sep  3 15:02 sm_tc-1.0.1-py3.9.egg-rw-r--r--  1 root root  3791 Nov 19 18:34 sm_tc-1.0.2-py3.9.egg

On Thursday, November 16, 2023 at 08:42:28 AM EST, Alexandru Burcea ***@***.***> wrote:  

Hi I manage to test the library and it gives me good results:

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

alexburcea2877 commented 11 months ago

I am glad you solve it. I did not know you could use pip install on the local folder, this is cool. Could you please describe how you did so I can put it in the readme, because few customers told me that the setup method is obsolete. Thank you for using our products and for helping us improve them.

Alex.

rbogdan commented 11 months ago

Sure, I am no python expert but I was reading that use of easy path was obsolete and that pip was the appropriate "drop in" way to install user libraries. It was as simple as going into the directory that has the setup.py file which I believe is still required and typing "pip install .". That worked for me with no errors. Bob

On Monday, November 20, 2023 at 10:06:53 AM EST, Alexandru Burcea ***@***.***> wrote:  

I am glad you solve it. I did not know you could use pip install on the local folder, this is cool. Could you please describe how you did so I can put it in the readme, because few customers told me that the setup method is obsolete. Thank you for using our products and for helping us improve them.

Alex.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

alexburcea2877 commented 11 months ago

Thank you.

rbogdan commented 11 months ago

No problem Alex, I appreciate your company and your products! By the way, the pip install option gets more complicated when running Raspberry Pi with the recent release of bookworm. That environment will not let you use pip unless you use it within a virtual environment. I'm just giving you a heads up because it will be coming your way someday soon. I used the following command to create a virtual environment and then activate it which is very similar to starting a shell inside a shell: Once in the virtual environment I was able to use pip. @.:~/mydir $ python -m venv --system-site-packages @.:~/mydir $ source venv/bin/activate(venv) @.:~/mydir $(venv) @.:~/mydir $(venv) @.:~/amydir $ @.:~/mydir $  This PI is running bookworm and has Python v3.11.2 Bob

On Monday, November 20, 2023 at 04:07:55 PM EST, Alexandru Burcea ***@***.***> wrote:  

Thank you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

alexburcea2877 commented 11 months ago

Thank you. I hope to publish the libraries on pypi until then.

Alex.