DefaultReceiver/BUTTONDesc.h

48 lines
1,019 B
C
Raw Normal View History

2022-08-21 14:10:45 +02:00
#include "descriptionStruct.h"
#define jType_ANALOG_Desc 50
#define jType_BUTTON_Desc 51
#define jCommand_OUT_OF_BOUND 0xff
typedef struct{
byte type; //jType_ANALOG_Desc || jType_BUTTON_Desc
byte command; //0-31 button channel || 0-11
byte use = 0xff; //0-3 || 0-1
char text[29] = "error"; //Text
}Channel_Desc_Send;
void initBUTTON_Desc(){
}
void BUTTON_DescLoop(){
}
void BUTTON_DescradioTask(){
byte num = jRCbuff[1];
Channel_Desc_Send data;
data.type = jType_BUTTON_Desc;
data.command = num;
if(num>31){
jSendNRF(&data, sizeof(data));
return;
}
data.use = buttonDesc[num].use;
strncpy(data.text, buttonDesc[num].text, 29);
jSendNRF(&data, sizeof(data));
}
void ANALOG_DescradioTask(){
byte num = jRCbuff[1];
Channel_Desc_Send data;
data.type = jType_ANALOG_Desc;
data.command = num;
if(num>11){
jSendNRF(&data, sizeof(data));
return;
}
data.use = analogDesc[num].use;
strncpy(data.text, analogDesc[num].text, 29);
jSendNRF(&data, sizeof(data));
}