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

Setup/Loop Entry Point #3

Merged
merged 1 commit into from
May 28, 2020
Merged

Setup/Loop Entry Point #3

merged 1 commit into from
May 28, 2020

Conversation

pre63
Copy link
Contributor

@pre63 pre63 commented May 28, 2020

This fixes the issue were are after a short amount of time (~9 minutes) the Blink example stops working. Issue #1.

This also fixes the usb serial not being available after upload of a juniper program.

Tested on Arduino Nano 33 BLE. Initially the led stops blinking after 9 minutes. After using the setup and loop functions which are called by the Arduino library the led blinks for over 12 hours.

My suspicion is that since the Arduino code can't determine that there was a while loop running because the code was not using the loop function the Arduino device entered a sleep mode.

In this PR

  • Compiler changed to generate setup and loop functions instead of the main/while true.
  • Compiler warns if the setup and loop functions are missing.
  • Examples updated with setup/loop functions instead of main.

…to keep the device out of 'energy save mode/sleep' and the usb serial available.
@pre63 pre63 mentioned this pull request May 28, 2020
@calebh
Copy link
Owner

calebh commented May 28, 2020

It is probably best to use the setup and loop functions since this matches the Arduino standard. The call to init() is no longer necessary if we use setup/loop since the default Arduino main function calls it. It looks like we were missing some initialization code and a couple of other things (see here: https://github.com/arduino/ArduinoCore-avr/blob/2f67c916f6ab6193c404eebe22efe901e0f9542d/cores/arduino/main.cpp )

@calebh calebh merged commit 773b530 into calebh:master May 28, 2020
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.

None yet

2 participants