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

Add two animations: Rainbow and Theater #159

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

randomgrace
Copy link
Contributor

Rainbow is a slow transition through the rainbow
Theater is a 'crawl' paired with the rainbow fade

enums are allocated, but these are not hooked up anywhere yet.

Rainbow is a slow transition through the rainbow
Theater is a 'crawl' paired with the rainbow fade

enums are allocated, but these are not hooked up anywhere yet.
@@ -95,6 +95,8 @@ enum
kClimb,
kVision,
kEject,
kRainbow,
kTheater,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kRainbow and kTheater are animations and not specific robot states. Given that, why not just change the existing animations (ex. auto_mode, see switch statement) to use these instead of creating new commands? Do you have specific robot state use cases for these animations, if so the enums should reflect that state.

@@ -443,3 +443,60 @@ void flash(unsigned long timeInterval, uint32_t color, uint8_t brightness)
setAllPixelsOff();
showPixels();
}

void rainbowCycle(int SpeedDelay) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a note, delay() function in Arduino is an unsigned long. Regardless, you don't want an accidental signed argument pass to this function, it will result in an unpredictable delay.

byte *c;
uint16_t i, j;

for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reformat the code to match the existing coding style, i.e. placement of {}

@randomgrace
Copy link
Contributor Author

randomgrace commented Feb 27, 2020 via email

@binnur
Copy link
Contributor

binnur commented Feb 27, 2020

it is not clear to me what animations we will finally want for the current robot states
I don't understand this comment -- All the robot states and animations are implemented and integrated. Arduino loop() switch statement lists out the currently planned robot states & animations. Other than vision, these robot states are already integrated into the command actions via joystick button controls. Note that the existing animations can easily be replaced with others w/o a problem. With that said two important things to note: 1) as far as I know, we don't have LED installed on the robot; 2) this PR will get merged after the competition weekend to avoid unnecessary code churn.

@randomgrace
Copy link
Contributor Author

randomgrace commented Feb 27, 2020 via email

@randomgrace
Copy link
Contributor Author

Per request - changed PR.

for(j=0; j<256*5; j++)
{ // 5 cycles of all colors on wheel
for(i=0; i< NUM_LEDS; i++)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@randomgrace here and in other place indentation is all messed up - looks like the problem is a mixture of tabs and spaces. (even though i like tabs better) i'd suggest using spaces.

for (int j=0; j < 256; j++)
{ // cycle all 256 colors in the wheel
for (int q=0; q < 3; q++)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like some tab characters are eight-width characters while space indents are two...


if(WheelPos < 85)
{
c[0]=WheelPos * 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these one-space indents?

void theaterChaseRainbow(unsigned long SpeedDelay) {
byte *c;

for (int j=0; j < 256; j++)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also throughout this file (including outside of your pr) i see different uses of non-indentation spaces, ex. int j = 0 or int j=0.

@randomgrace
Copy link
Contributor Author

randomgrace commented Feb 28, 2020 via email

@randomgrace
Copy link
Contributor Author

randomgrace commented Feb 28, 2020 via email

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.

3 participants