-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multisensor Code Ready for Testing #158
Conversation
- supports port B on chips where port B is the IOC port
leaving the timer1 or timer0 modules for the pic12 executive.
Conflicts: momo_modules/shared/pic12/src/peripheral/timer1.c momo_modules/shared/pic12/src/peripheral/timer1.h
#include <xc.h> | ||
|
||
|
||
uint16_t counter; | ||
uint16_t periods; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is ever explicitly initialized to 0, as counter
is in the module's initialization() function.
Should the mib12_reflash changes be included here? |
@@ -174,17 +195,14 @@ void acquire_pulse() | |||
|
|||
void read_pulses() | |||
{ | |||
mib_buffer[0] = pulse_count() & 0xFF; | |||
mib_buffer[1] = pulse_count() >> 8; | |||
mib_buffer[0] = counter & 0xFF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this cause unpredictable values if called after a few periods have past? For instance, if the board is acquiring pulses every 4 seconds and reporting them every minute, then somebody tries to inspect the pulse count after 30 seconds, the caller will get 30 seconds worth of pulses (with no indication of the period) and then the counter will be reset.
An alternative:
return both the counter
and periods
values, don't reset the counter, and compute the pulse/second value dynamically on the receiving (python) side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed in the new code version. There are separate mib calls now for reading the current state of the counters and clearing them.
Multisensor Code Ready for Testing
I revised and updated the multisensor code. The current version has changes to make it more robust. It differs from the previous version in the following ways:
This is for review, comments and testing. It needs to be squashed for merging.