dhhagan / opcn2

C++ Library for the Alphasense OPC-N2 particle counter
MIT License
15 stars 9 forks source link

Minor issue with old versions of OPC firmware #16

Closed paultanner closed 8 years ago

paultanner commented 8 years ago

I noticed that the version is not reported when the device sends back this string

OPC-N2 FirmwareVer=OPC-017b...............................BD

You mention this in the code but not in the READ.ME; I patched it to address this. I'll do it properly when the project is further along.

BTW. Thx for doing this. Your code is a lot more readable than the device documentation ;-)

dhhagan commented 8 years ago

Hi Paul!

I'll take a look at that. I made some changes when firmware v18 came out which includes a method for firmware version...Alphasense also changed the way they do firmware versioning from number.letter to major.minor as seen here which is a bit frustrating. Depending on what your use case is, the firmware version should be held in a class method OPCN2.firmware which returns a python dictionary that contains the major, minor, and combined versions. Basically, the information string is parsed on initialization. Is that sufficient for what you need? I don't pay attention to the letter because there aren't any major differences in the firmware between versions.

paultanner commented 8 years ago

Probably not good use of your time to fix. Maybe just tell people to use another way to find the version. It functions OK as is because major version shows up as zero which does not break anything else. Most people will probably upgrade to >=18 anyway.

dhhagan commented 8 years ago

Ahhh. What version of the library are you using? I thought I fixed that issue in the past minor release...I believe it was 1.0.1 On Mon, Jul 4, 2016 at 10:41 AM Paul Tanner notifications@github.com wrote:

Probably not good use of your time to fix. Maybe just tell people to use another way to find the version. It functions OK as is because major version shows up as zero which does not break anything else. Most people will probably upgrade to >=18 anyway.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/dhhagan/opcn2/issues/16#issuecomment-230305389, or mute the thread https://github.com/notifications/unsubscribe/AEKwSElyRmzhcF5Xu5j5lyThD687OIN4ks5qSRt-gaJpZM4JEMo1 .

Regards,

David H Hagan PhD Student | Atmospheric Chemistry & Physics Department of Civil & Environmental Engineering Massachusetts Institute of Technology Cambridge, MA 02139 707.227.6695 | dhagan@mit.edu | https://www.davidhagan.me

dhhagan commented 8 years ago

Wait a sec...haha For some reason I thought this was an issue with the Python Library...I'll take a look at this in the next 48 hours or so. Curious...which device are you using this library with? A particle photon/electron? Or an Arduino?

paultanner commented 8 years ago

I downloaded it from github in the last few days. I do not see a version number in opcn2.cpp. the examples .cpp file indicates that it was updated in June 2016. I got it working OK on a Photon (apart from the firmware version).

dhhagan commented 8 years ago

Ahh okay. The version number is usually in the spark.json file. It should also be able to be downloaded straight from the library management tool within the Particle Build IDE. Let me know if it's not!

paultanner commented 8 years ago

BTW. With a small change (Serial1 instead of Serial) it also runs on Bluz. All good :-) And yes, "version": "0.3.2" is in spark.json (which I had not downloaded).

dhhagan commented 8 years ago

Awesome! It looks like anytime I make an update to the library, the Particle IDE makes the library private again, which is pretty obnoxious. They told me it would be fixed when they release their new library management system soon.

dhhagan commented 8 years ago

@paultanner I think I patched it last night with v0.3.3. Do you mind checking to see if it worked with your OPC? I don't have any with firmware < 18.2

paultanner commented 8 years ago

thx @dhhagan. This now comes back with 17.0 which is near enough to 17b. All your good work is much appreciated :-)

dhhagan commented 8 years ago

Awesome! I'll go ahead and close this then!