Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial.read(serialBuffer,TIMEOUT) can't work under lorawan? #241

Open
jackqfzhang opened this issue Jun 23, 2022 · 0 comments
Open

Serial.read(serialBuffer,TIMEOUT) can't work under lorawan? #241

jackqfzhang opened this issue Jun 23, 2022 · 0 comments

Comments

@jackqfzhang
Copy link

Serial.read(serialBuffer,TIMEOUT) worked well on stand alone application ,

but size = Serial.read(serialBuffer,TIMEOUT) always return 0 under lorawan example (disable AT command)

For example : Lorawan

void processCmd()
{
size = Serial.read(serialBuffer,TIMEOUT);
if(size)
{
Serial.printf("rev data size %d : ",size);
Serial.write(serialBuffer,size);
}
}

void loop()
{

  processCmd();


switch( deviceState )
{
	case DEVICE_STATE_INIT:
	{

#if(LORAWAN_DEVEUI_AUTO)
LoRaWAN.generateDeveuiByChipID();
#endif
#if(AT_SUPPORT)
getDevParam();
#endif
printDevParam();
LoRaWAN.init(loraWanClass,loraWanRegion);
deviceState = DEVICE_STATE_JOIN;
break;
}
case DEVICE_STATE_JOIN:
{
LoRaWAN.join();
break;
}
case DEVICE_STATE_SEND:
{
prepareTxFrame( appPort );
LoRaWAN.send();
deviceState = DEVICE_STATE_CYCLE;
break;
}
case DEVICE_STATE_CYCLE:
{
// Schedule next packet transmission
txDutyCycleTime = appTxDutyCycle + randr( 0, APP_TX_DUTYCYCLE_RND );
LoRaWAN.cycle(txDutyCycleTime);
deviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
{
LoRaWAN.sleep();
break;
}
default:
{
deviceState = DEVICE_STATE_INIT;
break;
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant