r0ket can be made asleep while showing the "accomplished" screen
This commit is contained in:
parent
41101edfca
commit
1e98199e7b
|
@ -10,7 +10,7 @@
|
|||
#include "funk/nrf24l01p.h"
|
||||
|
||||
|
||||
#define POEM_ID 4
|
||||
#define POEM_ID 2
|
||||
|
||||
#define BTN_WAKEUP (1 << 5)
|
||||
#define BTN_STANDBY (1 << 6)
|
||||
|
@ -397,10 +397,11 @@ uint8_t poem_getInputBlocking(uint8_t filter) {
|
|||
uint8_t poem_getInputNonBlocking(void) {
|
||||
uint8_t pkt[32];
|
||||
uint8_t input;
|
||||
if (nrf_rcv_pkt_poll(sizeof(pkt), pkt) == 32) {
|
||||
// wait up to 200 ms for a packet
|
||||
if (nrf_rcv_pkt_time(200, sizeof(pkt), pkt) == 32) {
|
||||
input = poem_identifyPacket(pkt);
|
||||
if (input == BTN_NONE)
|
||||
input == getInput();
|
||||
input = getInput();
|
||||
}
|
||||
else {
|
||||
input = getInput();
|
||||
|
@ -515,17 +516,18 @@ static void poem_sendSuccessMessage(packet_type_t pktWinner) {
|
|||
// send our winner information packet
|
||||
static uint8_t pkt[32];
|
||||
|
||||
nrf_rcv_pkt_start();
|
||||
while (1) {
|
||||
memcpy(pkt, poem_gPackets[pktWinner], sizeof(pkt));
|
||||
nrf_snd_pkt_crc(sizeof(pkt), pkt);
|
||||
delayms_queue(80 + (getRandom() % 50));
|
||||
// wait between 100 and 500 ms (including a potential 200 ms timeout of
|
||||
// poem_getInputNonBlocking) to prevent polluting the channel with
|
||||
// winner packets
|
||||
delayms(100 + (getRandom() % 200));
|
||||
uint8_t input = poem_getInputNonBlocking();
|
||||
if (input == BTN_STANDBY) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nrf_rcv_pkt_end();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue