Fix attribution and revert changes to main

This commit is contained in:
Lucian Copeland 2021-04-21 16:34:03 -04:00
parent 779169da26
commit beb7e33db3
10 changed files with 37 additions and 28 deletions

16
main.c
View File

@ -404,8 +404,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
new_status_color(BLACK);
board_deinit();
if (!supervisor_workflow_active()) {
// Enter deep sleep. When we wake up we'll return from
// this loop.
// Enter true deep sleep. When we wake up we'll be back at the
// top of main(), not in this loop.
common_hal_alarm_enter_deep_sleep();
// Does not return.
} else {
@ -426,18 +426,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
#if CIRCUITPY_ALARM
common_hal_alarm_pretending_deep_sleep();
bool serial_in = (serial_connected() &&
serial_bytes_available());
supervisor_set_run_reason(RUN_REASON_STARTUP);
board_init();
if (serial_in) {
bool ctrl_d = serial_read() == CHAR_CTRL_D;
if (ctrl_d) {
supervisor_set_run_reason(RUN_REASON_REPL_RELOAD);
}
return ctrl_d;
}
return true;
#else
port_idle_until_interrupt();
#endif

View File

@ -3,8 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 microDev
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,8 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -167,6 +166,9 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t
alarm_touch_touchalarm_set_alarm(deep_sleep, n_alarms, alarms);
}
// TODO: this handles all possible types of wakeup, which is redundant with main.
// revise to extract all parts essential to enabling sleep wakeup, but leave the
// alarm/non-alarm sorting to the existing main loop.
nrf_sleep_source_t system_on_idle_until_alarm(int64_t timediff_ms, uint32_t prescaler) {
bool have_timeout = false;
uint64_t start_tick = 0, end_tick = 0;
@ -382,7 +384,7 @@ void common_hal_alarm_pretending_deep_sleep(void) {
print_wakeup_cause(cause);
#endif
alarm_reset();
// alarm_reset();
#if 0
// if one of Alarm event occurred, reset myself

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Dan Halbert for Adafruit Industries.
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,8 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Dan Halbert for Adafruit Industries
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -1,6 +1,27 @@
/*
* debug functions
* (will be removed)
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jun2Sak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stdio.h>