-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fixes and updates #1
base: tidy-up
Are you sure you want to change the base?
Conversation
Using INPUT_PULLUP as an argument for digitalWrite is risky at best as a method to enable the pullup on a pin (valid parameters are 0 (LOW) or 1 (HIGH). INPUT_PULLUP has a value of 2). Setting pullups should be done thorugh pinMode. See here: https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Arduino.h https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_digital.c
Replaced the low level SPI driver for a more generic RX5808 one. This should allow for more flexible control of receivers and later addition of new features, including individual control of receivers, setting arbitrary frequencies, and generally improving code structure.
…y' into Knifa/tidy-up
Comments for the last commit didn't propagate over when I merged my branches, not sure why... here it is. I hope they're of interest... |
Woah, thanks for this! Sorry for not checking sooner, GitHub didn't give me a notification for some reason. I'll have a bit of a better look shortly. :) |
src/rx5808-pro-diversity/state.cpp
Outdated
@@ -43,7 +43,7 @@ namespace StateMachine { | |||
currentHandler = newHandler; | |||
|
|||
if (newHandler) | |||
lastHandler->onEnter(); | |||
newHandler->onEnter(); |
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've fixed this in my most recent push which I think is the only merge conflict. Well spotted! Took me ages to find and fix this myself, haha.
This is awesome, thanks! Let me know when you're ready to merge. This branch is still a WIP for upstream too, so might get a little weird. Purely cosmetic, but can you aim to match existing conventions? Things like:
Happy to go over this myself afterwards either way. Pretty keen on making this is clean and standard as possible so we don't end up in a similar state as the master. |
As requested, replaced tabs with spaces and lowercase function names
No problem. I've been meaning to do a re-write such as you've done for a while as the upstream has clearly got a bit untidy but it was such a big task that I never really got into it. Now that there's a more sensible base, I'm keen to help with features, testing and tidying etc. I've just pushed a commit that clears up the spaces/tabs and naming. Let me know if there's anything else you think needs changing. I think I've also cleared up the conflict. I was going to try rebasing off you latest, but tbh, my github skills aren't great. |
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 really cool over all! Just a couple more convention things, sorry to be super pedantic. First time using GitHub's review thingie as well.
src/rx5808-pro-diversity/RX5808.cpp
Outdated
RX5808::RX5808(void) : | ||
minRSSI(DEFAULT_MIN_RSSI), | ||
maxRSSI(DEFAULT_MAX_RSSI) | ||
{} |
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.
You should be able to set these as defaults directly in the class definition instead rather than using initialisation lists.
src/rx5808-pro-diversity/RX5808.cpp
Outdated
} | ||
|
||
uint16_t RX5808::getRSSI(uint8_t averages) | ||
{ |
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.
Can you put braces on the same line rather than a separate line?
src/rx5808-pro-diversity/RX5808.cpp
Outdated
return (sum / averages); | ||
} | ||
|
||
uint16_t RX5808::setFrequencyMHz(uint16_t frequency) |
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 really great! I really wanted to allow manual fine tuning.
src/rx5808-pro-diversity/RX5808.h
Outdated
#define RTC6715_POWER_DOWN_CONTROL_REGISTER 0x0A | ||
#define RTC6715_STATUS_REGISTER 0x0F | ||
|
||
class RX5808 |
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.
Can you rename the class to Rx5808
? Like HtmlClass
or EepromSettings
.
src/rx5808-pro-diversity/RX5808.h
Outdated
void _chipSelectDeassert(void); | ||
}; | ||
|
||
#endif |
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.
Can you add new lines to the end of your files?
src/rx5808-pro-diversity/RX5808.h
Outdated
|
||
private: | ||
// interface pins | ||
uint8_t _pChipSelect; |
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.
Can you drop the leading _
from your privates? I am still so-so on this because of conflicting rules about it being reserved or not reserved, but if we could stick without for now that would be cool.
#endif | ||
|
||
RX5808 hReceivers[RECEIVER_COUNT]; |
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.
What does the h
mean?
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.
the 'h' is because it's a handle
@@ -56,22 +72,10 @@ namespace Receiver { | |||
uint16_t updateRssi() { | |||
waitForStableRssi(); | |||
|
|||
rssiARaw = 0; |
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 way tidier! Love it.
@@ -122,6 +122,9 @@ screens drawScreen; | |||
|
|||
#endif | |||
|
|||
void setupPins(); | |||
void setupSettings(); | |||
void haltWithError(); |
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.
Thanks for making these explicit. I keep forgetting the Arduino IDE does a bunch of weird stuff to "help" you.
Formatting changes, as requested
Only a few months late, but I've now made the requested formatting changes. Because I'm a bit behind, I think there's some conflicts, but they should be pretty simple fixes. |
We want to run the entry setup of the new state, not the previous one :)