in d mix
Dependencies: xtoff2 RF24Network mbed
Fork of RF24Network_Receive by
Revision 14:3e69c8a9c730, committed 2018-07-12
- Comitter:
- pietor
- Date:
- Thu Jul 12 08:56:54 2018 +0000
- Parent:
- 13:f54dfb74247e
- Commit message:
- f
Changed in this revision
diff -r f54dfb74247e -r 3e69c8a9c730 Ontvanger.h --- a/Ontvanger.h Wed Mar 21 16:22:28 2018 +0000 +++ b/Ontvanger.h Thu Jul 12 08:56:54 2018 +0000 @@ -31,6 +31,7 @@ }; enum State2 {init_state, + testConnection_state, send_state, receive_state, };
diff -r f54dfb74247e -r 3e69c8a9c730 RF24.lib --- a/RF24.lib Wed Mar 21 16:22:28 2018 +0000 +++ b/RF24.lib Thu Jul 12 08:56:54 2018 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/akashvibhute/code/RF24/#f79c43f3b5b9 +https://os.mbed.com/users/pietor/code/xtoff2/#f0eedb69ad1e
diff -r f54dfb74247e -r 3e69c8a9c730 RF24Network.lib --- a/RF24Network.lib Wed Mar 21 16:22:28 2018 +0000 +++ b/RF24Network.lib Thu Jul 12 08:56:54 2018 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/akashvibhute/code/RF24Network/#80195a45b25c +https://os.mbed.com/users/pietor/code/RF24Network/#80195a45b25c
diff -r f54dfb74247e -r 3e69c8a9c730 main.cpp --- a/main.cpp Wed Mar 21 16:22:28 2018 +0000 +++ b/main.cpp Thu Jul 12 08:56:54 2018 +0000 @@ -22,7 +22,7 @@ ---- ----- */ //uncommend #define PRINT_ENABLE to see informational prints -//#define PRINT_ENABLE +#define PRINT_ENABLE #include "mbed.h" #include "Ontvanger.h" @@ -58,37 +58,51 @@ int main() { - IF_PRINT_ENABLE( pc.printf("\r\nOntvanger: \r\n"); - pc.printf("testing Radio... %d\r\n", receive.isValid()); + IF_PRINT_ENABLE( pc.printf("\r\nVOntvanger: \r\n"); + pc.printf("Vtesting Radio... %d\r\n", receive.isValid()); ); while(1) { receive.update(); switch (current_state) { case init_state: - IF_PRINT_ENABLE(pc.printf("Init State\n\r");); + IF_PRINT_ENABLE(pc.printf("XInit State\n\r");); pc.baud(9600); t.start(); state_Packet packet; payload_t payload; - setCurrentState(receive_state); + setCurrentState(testConnection_state); + break; + + case testConnection_state: + IF_PRINT_ENABLE(pc.printf("XTesting State\n\r");); + packet.setState = 't'; + + if (receive.write(packet)){ + pc.printf("VConnection test passed.\n\r"); + setCurrentState(receive_state); + } + else + IF_PRINT_ENABLE(pc.printf("VConnection failed, trying again...\n\r");); + + wait_ms(500); break; case send_state: - IF_PRINT_ENABLE(pc.printf("Send State\n\r");); + IF_PRINT_ENABLE(pc.printf("SSend State\n\r");); if(c == 's') { - IF_PRINT_ENABLE(pc.printf("Send state: Tare\n\r");); + IF_PRINT_ENABLE(pc.printf("VSend state: Tare\n\r");); packet.setState = 's'; } if (c == 'c') { - IF_PRINT_ENABLE(pc.printf("Send state: Calibrate\n\r");); + IF_PRINT_ENABLE(pc.printf("VSend state: Calibrate\n\r");); packet.setState = 'c'; } bool ok = receive.write(packet); if (ok) - IF_PRINT_ENABLE(pc.printf("ok.\n\r");); + IF_PRINT_ENABLE(pc.printf("Vok.\n\r");); else - IF_PRINT_ENABLE(pc.printf("failed.\n\r");); + IF_PRINT_ENABLE(pc.printf("Vfailed.\n\r");); wait(0.1); setCurrentState(receive_state); break;