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

Speed control is broken on Esp32Cam if ENABLE_CAMERA is not defined #7

Open
Ezward opened this issue Feb 7, 2021 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@Ezward
Copy link
Owner

Ezward commented Feb 7, 2021

There was a previous commit that create a new preprocessor symbol, ENABLE_CAMERA, that must be defined for the camera support to be fully compiled into the rover's C++ code. By default this is defined in platformio.ini.
When it is not defined, the camera api is turned into function that just return failure, exception for getCameraPropertiesJson() which is the method underlying the status/ endpoint. When camera is enabled, it return all the camera properties and an enabled property with value of "true". When camera is disabled, it only returns enabled with value of "false".
So that's the context. The bug is that if ENABLE_CAMERA is not defined, then speed control does NOT work. The issue seems to be the interrupts are not firing, so the encoder never counts any ticks. This is likely because the camera internals may turn on interrupts, but if we don't initialize it, they never get turned on.

  • One way to confirm this is to disable the camera AND encoder interrupts; to do this, comment out these two lines in platformio.ini;
    -D USE_ENCODER_INTERRUPTS=1
    -D ENABLE_CAMERA=1
  • This will then make the rover C++ code using polling to read the encoder; this is not very accurate, but if it works it would prove the issue is with interrupts.
  • If it is interrupts, then we probably have to make a call to enable interrupts ourselves.
@Ezward Ezward added the bug Something isn't working label Feb 7, 2021
@Ezward Ezward self-assigned this Feb 7, 2021
@Ezward
Copy link
Owner Author

Ezward commented Feb 7, 2021

I did the experiment where I disabled the camera and used polling for the encoder ticks. If found a bug in the code related t polling and once that was fixed, the code again worked. So we can correctly read the pins, but we are not getting interrupts from the pins. So it does seem to be an interrupt issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant