_repeater.ino 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // 1-channel LoRa Gateway for ESP8266
  2. // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
  3. // Verison 6.1.0
  4. // Date: 2019-10-20
  5. //
  6. // All rights reserved. This program and the accompanying materials
  7. // are made available under the terms of the MIT License
  8. // which accompanies this distribution, and is available at
  9. // https://opensource.org/licenses/mit-license.php
  10. //
  11. // NO WARRANTY OF ANY KIND IS PROVIDED
  12. //
  13. // Author: Maarten Westenberg (mw12554@hotmail.com)
  14. //
  15. // This file contains code for using the single channel gateway also as a repeater node.
  16. // Please note that for node to node communication your should change the polarity
  17. // of messages.
  18. //
  19. // ============================================================================
  20. #if _REPEATER==1
  21. // Define input channel and output channel
  22. #define _ICHAN 0
  23. #define _OCHAN 1
  24. #ifdef _TTNSERVER
  25. #error "Please undefined _THINGSERVER, for REPEATER shutdown WiFi"
  26. #endif
  27. // Send a LoRa message out from the gateway transmitter
  28. // XXX Maybe we should block the received ontul the message is transmitter
  29. int sendLora(char *msg, int len) {
  30. // Check when len is not exceeding maximum length
  31. Serial.print("sendLora:: ");
  32. for (int i=0; i< len; i++) {
  33. Serial.print(msg[1],HEX);
  34. Serial.print('.');
  35. }
  36. if (debug>=2) Serial.flush();
  37. return(1);
  38. }
  39. #endif //_REPEATER==1