Lorawan confirmed/unconfirmed

Is it possible to switch dynamically in the code between confirmed and unconfirmed Lorawan send or only in the controller settings?

yes set this to true for confirmed and false for unconfirmed.

bool isTxConfirmed = true; //confirmed
isTxConfirmed = false; //unconfirmed

I added before the cycle case. but it seems it doesnt affect the code

case DEVICE_STATE_CYCLE:
{
isTxConfirmed = true;
txDutyCycleTime = appTxDutyCycle + randr( 0, APP_TX_DUTYCYCLE_RND );
LoRaWAN.cycle(txDutyCycleTime);
deviceState = DEVICE_STATE_SLEEP;
break;
}

not sure how your code is organized, but i would recommend you add it right before the send function:

isTxConfirmed = true;
LoRaWAN.send();

I use the standard cubecell example https://github.com/HelTecAutomation/CubeCell-Arduino/blob/master/libraries/LoRa/examples/LoRaWAN/LoRaWan/LoRaWan.ino.
I think in the cycle Case, if the cubecell wakes up, it doesn’t use the case DEVICE_STATE_SEND:

yes it does… put this in your:

case DEVICE_STATE_SEND:
  {
     printf("\n\t *********************DEVICE_STATE_SEND: %d .... ");
....
}

and it will print every time it wakes up.