Skip to content
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

Open
wants to merge 7 commits into
base: tidy-up
Choose a base branch
from
Open

Fixes and updates #1

wants to merge 7 commits into from

Conversation

bluesign2k
Copy link

We want to run the entry setup of the new state, not the previous one :)

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.
@bluesign2k bluesign2k changed the title Fix handler setup Fixes and updates Jan 22, 2017
@bluesign2k
Copy link
Author

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...
"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."

@Knifa
Copy link
Owner

Knifa commented Jan 30, 2017

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. :)

@@ -43,7 +43,7 @@ namespace StateMachine {
currentHandler = newHandler;

if (newHandler)
lastHandler->onEnter();
newHandler->onEnter();
Copy link
Owner

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.

@Knifa
Copy link
Owner

Knifa commented Jan 30, 2017

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:

  • Spaces over tabs
  • camelCase for methods rather than CamelCase
  • etc.

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
@bluesign2k
Copy link
Author

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.

Copy link
Owner

@Knifa Knifa left a 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.

RX5808::RX5808(void) :
minRSSI(DEFAULT_MIN_RSSI),
maxRSSI(DEFAULT_MAX_RSSI)
{}
Copy link
Owner

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.

}

uint16_t RX5808::getRSSI(uint8_t averages)
{
Copy link
Owner

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?

return (sum / averages);
}

uint16_t RX5808::setFrequencyMHz(uint16_t frequency)
Copy link
Owner

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.

#define RTC6715_POWER_DOWN_CONTROL_REGISTER 0x0A
#define RTC6715_STATUS_REGISTER 0x0F

class RX5808
Copy link
Owner

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.

void _chipSelectDeassert(void);
};

#endif
Copy link
Owner

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?


private:
// interface pins
uint8_t _pChipSelect;
Copy link
Owner

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];
Copy link
Owner

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?

Copy link
Author

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;
Copy link
Owner

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();
Copy link
Owner

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
@bluesign2k
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants