_repeater.ino 1.3 KB

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