Added status_string method to return simple status strings#725
Added status_string method to return simple status strings#725felixdivo merged 8 commits intohardbyte:developfrom tamenol:status_string
Conversation
status_string returns the current status of the bus in a single word
Codecov Report
@@ Coverage Diff @@
## develop #725 +/- ##
===========================================
+ Coverage 66.72% 66.96% +0.24%
===========================================
Files 70 70
Lines 6398 6499 +101
===========================================
+ Hits 4269 4352 +83
- Misses 2129 2147 +18 |
can/interfaces/pcan/pcan.py
Outdated
| elif status == PCAN_ERROR_BUSOFF: | ||
| return "BUSOFF" | ||
| else: | ||
| return "NonImplementedError" |
There was a problem hiding this comment.
I' return None in this case, to make it more explicit that something went wrong.
There was a problem hiding this comment.
Yes, good idea. However, when looking back on this, wouldn't it be better if I made a dictonary with all the errors and their strings in basic.py and retrieve them with this function, so the class in pcan.py doesn't get cluttered much?
|
Sorry for the long delay, do you still have tome to fix this? |
|
@felixdivo No problem. And yes, I'll have a look this weekend/in the course of next week. |
|
Looks good to me. |
|
Except the formatter is complaining here. You can fix it by executing |
|
What a massive change 👍 |
status_string returns the current status of the bus in a single word.
Ok, so I have no idea this is warrented to get merged. I wrote this function as I needed a single word for the status of the bus (just like you have in PCAN-View). And I didn't want to import .basic in my project to get the needed values, hence why I put it in the
PcanBusclass