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 standalone operational mode #17

Merged
merged 7 commits into from
Jun 22, 2017
Merged

Add standalone operational mode #17

merged 7 commits into from
Jun 22, 2017

Conversation

HotelCalifornia
Copy link
Contributor

@HotelCalifornia HotelCalifornia commented Jun 20, 2017

This needs testing. I had a dubious rig set up, but then I lost the toolchain. Oh 🐳.

@HotelCalifornia HotelCalifornia requested a review from edjubuh June 20, 2017 04:00
@HotelCalifornia HotelCalifornia added this to the 2.12.0 milestone Jun 20, 2017
@HotelCalifornia HotelCalifornia requested a review from baylessj June 20, 2017 04:02
@edjubuh edjubuh requested review from jbuschjr and removed request for baylessj June 20, 2017 05:12
@HotelCalifornia
Copy link
Contributor Author

HotelCalifornia commented Jun 20, 2017

Testing checklist:

  • code runs in auto with tether
  • code runs without waiting for vexnet (without tether)

@@ -194,7 +194,7 @@ void svSynchronize() {
// HELLO message!
kwait(50);
print("\r\nPowered by PROS " FW_VERSION "\r\n" FW_DISCLAIMER
"\r\nPROS (C)2011-2014 Purdue ACM SIGBOTS\r\n");
"\r\nPROS (C)2011-2017 Purdue ACM SIGBOTS\r\n");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know it's not strictly related, but while we're here and editing supervisor.c...

baylessj and others added 2 commits June 21, 2017 19:53
Standalone mode no longer interacts with the spi communication at its
initialization phase but instead changes the mode flag during its normal
communication in the initializeIO() routine.

Update the API header to point out that the Cortex will run the operator
control task when in standalone mode.
- Re-added synchronization of the supervisor in svSynchronize
- Simplified logic for setting the standalone mode flag
src/supervisor.c Outdated
@@ -137,7 +137,9 @@ void _svNextByte() {

// standaloneModeEnable - enable standalone operation
void standaloneModeEnable() {
svInitFlags = 0x1;
Copy link
Member

Choose a reason for hiding this comment

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

This didn't work because svInit runs before initIO, so the actual TX SPI buffer never gets updated.

@edjubuh edjubuh requested a review from baylessj June 22, 2017 00:56
@baylessj
Copy link
Contributor

The final version of this feature implements standalone mode by setting a flag in the outgoing SPI communication buffer between the user and master processors to specify to the master processor that the controller should run in standalone mode. Because this process occurs during the initializeIO() function, there is a very brief moment of time between the SPI communication's initialize at boot-up and when the initializeIO() function runs where the controller has not yet entered standalone mode (evidenced by typical "searching for a VEXNet connection" lights), but as soon as the initializeIO() function runs then the VEXNet light drops out and the controller enters standalone mode.

Succesful test cases include:

  • standaloneModeEnable() called in initializeIO(), running tethered.
  • standaloneModeEnable() called in initializeIO(), running standalone (no VEXNet/USB connection)
  • no call to standaloneModeEnable(), running tethered

@edjubuh
Copy link
Member

edjubuh commented Jun 22, 2017

@baylessj, can you test no standalone mode with a joystick (one of USB A-A or VEXNet - don't care which)

@HotelCalifornia
Copy link
Contributor Author

Bonus points if you test them both

@edjubuh
Copy link
Member

edjubuh commented Jun 22, 2017

kernel-2.11.2.zip

To test, extract the files to %AppData%\PROS\pros-mainline\kernel-2.11.2 such that the file %AppData%\PROS\pros-mainline\kernel-2.11.2\template.pros exists. For Linux and MacOS, the same applies but the folder is ~/.pros instead of %AppData%\pros

// standaloneModeEnable - enable standalone operation
void standaloneModeEnable() {
// set flag in outgoing SPI buffer to enable standlone mode
SV_OUT->flags |= 1;

Choose a reason for hiding this comment

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

Are we aware currently of what the remaining bits of this flags byte (I assume it to be uint8_t) do?

Copy link
Member

Choose a reason for hiding this comment

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

No, we'll have to take a look at the other bit values during the fall semester.

Copy link
Member

@edjubuh edjubuh left a comment

Choose a reason for hiding this comment

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

Got a thumbs up from a user, changes make sense and look good. We'll do another PR to release 2.12.0

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.

4 participants