lorawan network setup tuned (RX2==SF9 for TTN)
This commit is contained in:
		
							parent
							
								
									88e73e2eb8
								
							
						
					
					
						commit
						a52b4aa858
					
				@ -246,9 +246,9 @@ void lora_send(void *pvParameters) {
 | 
				
			|||||||
  while (1) {
 | 
					  while (1) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // postpone until we are joined if we are not
 | 
					    // postpone until we are joined if we are not
 | 
				
			||||||
    while (!LMIC.devaddr) {
 | 
					    // while (!LMIC.devaddr) {
 | 
				
			||||||
      vTaskDelay(pdMS_TO_TICKS(500));
 | 
					    //  vTaskDelay(pdMS_TO_TICKS(500));
 | 
				
			||||||
    }
 | 
					    //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // fetch next or wait for payload to send from queue
 | 
					    // fetch next or wait for payload to send from queue
 | 
				
			||||||
    if (xQueueReceive(LoraSendQueue, &SendBuffer, portMAX_DELAY) != pdTRUE) {
 | 
					    if (xQueueReceive(LoraSendQueue, &SendBuffer, portMAX_DELAY) != pdTRUE) {
 | 
				
			||||||
@ -259,7 +259,8 @@ void lora_send(void *pvParameters) {
 | 
				
			|||||||
    // attempt to transmit payload
 | 
					    // attempt to transmit payload
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      switch (LMIC_sendWithCallback_strict(
 | 
					      // switch (LMIC_sendWithCallback_strict(
 | 
				
			||||||
 | 
					      switch (LMIC_sendWithCallback(
 | 
				
			||||||
          SendBuffer.MessagePort, SendBuffer.Message, SendBuffer.MessageSize,
 | 
					          SendBuffer.MessagePort, SendBuffer.Message, SendBuffer.MessageSize,
 | 
				
			||||||
          (cfg.countermode & 0x02), myTxCallback, NULL)) {
 | 
					          (cfg.countermode & 0x02), myTxCallback, NULL)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -427,9 +428,6 @@ void lmictask(void *pvParameters) {
 | 
				
			|||||||
  LMIC_setClockError(CLOCK_ERROR_PROCENTAGE * MAX_CLOCK_ERROR / 100);
 | 
					  LMIC_setClockError(CLOCK_ERROR_PROCENTAGE * MAX_CLOCK_ERROR / 100);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // do the network-specific setup prior to join.
 | 
					 | 
				
			||||||
  lora_setupForNetwork(true);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  while (1) {
 | 
					  while (1) {
 | 
				
			||||||
    os_runloop_once(); // execute lmic scheduled jobs and events
 | 
					    os_runloop_once(); // execute lmic scheduled jobs and events
 | 
				
			||||||
    delay(2);          // yield to CPU
 | 
					    delay(2);          // yield to CPU
 | 
				
			||||||
@ -460,10 +458,13 @@ void myEventCallback(void *pUserData, ev_t ev) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  case EV_JOINING:
 | 
					  case EV_JOINING:
 | 
				
			||||||
    strcpy_P(buff, PSTR("JOINING"));
 | 
					    strcpy_P(buff, PSTR("JOINING"));
 | 
				
			||||||
 | 
					    // do the network-specific setup prior to join.
 | 
				
			||||||
 | 
					    lora_setupForNetwork(true);
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  case EV_JOINED:
 | 
					  case EV_JOINED:
 | 
				
			||||||
    strcpy_P(buff, PSTR("JOINED"));
 | 
					    strcpy_P(buff, PSTR("JOINED"));
 | 
				
			||||||
 | 
					    // do the after join network-specific setup.
 | 
				
			||||||
    lora_setupForNetwork(false);
 | 
					    lora_setupForNetwork(false);
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -508,9 +509,7 @@ void myEventCallback(void *pUserData, ev_t ev) {
 | 
				
			|||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  case EV_TXSTART:
 | 
					  case EV_TXSTART:
 | 
				
			||||||
    if (!(LMIC.opmode & OP_JOINING)) {
 | 
					 | 
				
			||||||
      strcpy_P(buff, PSTR("TX START"));
 | 
					      strcpy_P(buff, PSTR("TX START"));
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  case EV_TXCANCELED:
 | 
					  case EV_TXCANCELED:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user