dspectrumgui icon indicating copy to clipboard operation
dspectrumgui copied to clipboard

undefined method `flip_pwm' for nil:NilClass after exporting symbols to stdout

Open CollegiateComputer opened this issue 5 years ago • 2 comments

Issue Type

Bug - NoMethodError

Expected Behaviour

Capture added to unit via stdout from nspIectrum and return to dspectrumgui.

Actual Behaviour

Receive NoMethodError: undefined method flip_pwm' for nil:NilClass` in rails better_errors. image

What commit were you running?

v1.0.0-3-gd80d063 || d80d063cd7c820f0fc2885f9dbb899d44bc90207

CollegiateComputer avatar Sep 01 '20 14:09 CollegiateComputer

I can confirm this bug.

TN-1 avatar Sep 25 '20 09:09 TN-1

I can confirm and willing to help resolving the issue (ubuntu 18.04.5 / commit d80d063) How ever i just say what i tried : 1 installed inspectrum ,dspectrumgui both from git 2 seeded the db, created a device then unit then capturing first file every thing was ok (except issue #20 that i commented there) 3 decoding the signal was perfect :) 4 tried to capture another file in that unit (it was really signal of another button of that keyfob if that matters) and after capturing from inspectrum, the above bug was generated! 5 tried to go to device page no luck! 6 tried to go to unit page no luck! step 6 and 7 was exactly stuck on the line symbols = (device.flip_pwm ? (flip symbols) : symbols) from app/models/capture.rb line 45. the problem is that device is null! Ctrl+C the server and start again, no luck! same error! checked the file app/models/capture.rb to see how device is initialized but i saw it came from another model and cause i'm not familiar with ruby i couldn't investigate anymore.

P.S : See your device controller and figured out you output a json as well! http://localhost:3001/devices/1.json produces right output {"id":1,"fcc_id":"","baudrate":"","frequency":123.4,"modulation":"PWM","encoding":"66/33","name":"xxx","notes":"","created_at":"2020-11-25T22:23:59.651Z","updated_at":"2020-11-25T22:47:43.601Z"}

P.S 2: Tnx for json output bro! i figured out http://localhost:3001/units/1.json works well to... and found my way up to http://localhost:3001/captures/1.json it was correct (name/data/belong to unit 1 / belong to device 1) But something interesting happened when checking the http://localhost:3001/captures/2.json name and content were ok even unit_id was 1 and ok ... but device_id was 0 !!! I don't know how is that set in the code but i think there's something related to the issue. also i forgot to say that before commenting and checking this things i seeded the db again to see if it will works fine but no luck as i described before. Also note that http://localhost:3001/captures/1 , http://localhost:3001/captures/2 and http://localhost:3001/captures loads with no error. Just destroyed the second capture file with delete method available at http://localhost:3001/captures/1, and poof every thing worked fine! I try to investigate more and report if succeeded in anything!

P.S 3: Added a new capture file and it's ok now! for my third capture file device_id is 1 and it's correct. So as a temporary solution you can go to http://localhost:3001/captures and it will load with no error, scroll the page to right and destroy the capture file with wrong deviceId (0). then try to submit your capture file again and it works fine. @CollegiateComputer @TN-1

amir1376irani avatar Nov 26 '20 00:11 amir1376irani