LPP payload with Lmic library

Hi there,

I am working with Lmic library and using LPP packet format for sending data, and my current payload size 18 elememnts of array. the lpp works fine for uplink messages but when I would expand the array of payload by adding two additoinal sensors for soil moisture " analog input 0x02" the payload does not work or unable to be sent with the new size,whihc is 26.

Am I right by expanding the payload ??

from

static const u1_t PROGMEM APPKEY[16] ={0xea, 0x53, 0x80, 0x44, 0x83, 0x7d, 0xb2, 0x6d, 0x9d, 0xdf, 0xd8, 0xcd, 0x1b, 0xdc, 0xaf, 0x1c };

to

//ch1: for Temp 67 , ch2 for Humidity 68, ch3: light sensor Analog input0x02 , ch4 digital output 0x01 Relay, ch5 for soil moisture 1 0x02 Analog Input .
// ch 6:  for soil moisture 2 0x02 analog input  ch7: for soil moisture3 analog input 0x02. 
static uint8_t  LPP_data[26] = {0x01,0x67,0x00,0x00,0x02,0x68,0x00,0x03,0x02,0x00,0x00,0x04,0x01,0x00,0x05,0x02,0x00,0x00,0x06,0x02,0x00,0x00,0x07,0x02,0x00,0x00};

and this is the shifting bits for sedning packets:

   tem_LPP=tem * 10; 
       LPP_data[2] = tem_LPP>>8;
       LPP_data[3] = tem_LPP;
       LPP_data[6] = hum * 2;
     //sensor moisture0
     
       int16_t soil_final= moist_result*100;
       LPP_data[16]= soil_final>>8;
       LPP_data[17]=soil_final;
       int16_t lightresult= mapped_brightness*100;
       LPP_data[9]= lightresult>>8 ;
       LPP_data[10]=  lightresult;
     //sensor moisture 2
     int16_t soil_final2= moist_result2*100;
     LPP_data[20]= soil_final2>>8;
       LPP_data[21]=soil_final2;
     //sensor mositure 3
            int16_t soil_final3= moist_result3*100;
     LPP_data[24]= soil_final3>>8;
       LPP_data[25]=soil_final3;

Regards
Mohamad

you can use cayenneLPP library to sumplify it.

#include <CayenneLPP.h>
CayenneLPP lpp(51);


void do_send(osjob_t* j) {
  // Check if there is not a current TX/RX job running
  if (LMIC.opmode & OP_TXRXPEND) {
    Serial.println(F("OP_TXRXPEND, not sending"));
  } else {
    // Prepare upstream data transmission at the next possible time.
    lpp.reset();
    lpp.addAnalogInput(1, tem_LPP);    
    LMIC_setTxData2(1, lpp.getBuffer(), lpp.getSize(), 0);
    Serial.println(F("Packet queued"));
  }
  // Next TX is scheduled after TX_COMPLETE event.
}