magic numbers
This commit is contained in:
parent
f028280963
commit
ae779dc2f5
@ -6,15 +6,19 @@
|
||||
#define CON 0x0004 // connect
|
||||
#define ACK 0x0005
|
||||
|
||||
#define SIZE_COMMAND_PACKET 4
|
||||
#define SIZE_DATA_PACKET 496
|
||||
#define SIZE_DATA_PACKET_PAYLOAD 492 // = SIZE_DATA_PACKET - SIZE_COMMAND_PACKET
|
||||
|
||||
#define SIZE_ID 128
|
||||
#define SIZE_STATUS 128
|
||||
#define SIZE_CODE 51
|
||||
// This structure will be used to (dis-)connect to KOB servers
|
||||
struct command_packet_format{
|
||||
unsigned short command; // CON / DIS
|
||||
unsigned short channel; // Channel number
|
||||
};
|
||||
#define SIZE_COMMAND_PACKET 4
|
||||
// This structure will be used for id, rx and tx packets
|
||||
#define SIZE_ID 128
|
||||
#define SIZE_STATUS 128
|
||||
struct data_packet_format{
|
||||
unsigned short command;
|
||||
unsigned short length;
|
||||
@ -24,14 +28,12 @@ struct data_packet_format{
|
||||
unsigned int a21;
|
||||
unsigned int a22;
|
||||
unsigned int a23;
|
||||
signed int code[51];
|
||||
signed int code[SIZE_CODE];
|
||||
unsigned int n;
|
||||
char status[SIZE_STATUS]; /* This is called version in MorseKob */
|
||||
char a4[8];
|
||||
|
||||
};
|
||||
#define SIZE_DATA_PACKET 496
|
||||
#define SIZE_DATA_PACKET_PAYLOAD 492 // = SIZE_DATA_PACKET - SIZE_COMMAND_PACKET
|
||||
|
||||
// Define the packets used
|
||||
#define DEFAULT_CHANNEL 103
|
||||
|
@ -163,7 +163,7 @@ txloop (void)
|
||||
if(tx_timeout > TX_TIMEOUT) return;
|
||||
}
|
||||
key_press_t1 = fastclock();
|
||||
if(tx_data_packet.n == 50) {
|
||||
if(tx_data_packet.n == SIZE_CODE) {
|
||||
printf("irmc: warning packet is full.\n");
|
||||
return;
|
||||
}
|
||||
@ -348,7 +348,7 @@ int main(int argc, char *argv[])
|
||||
printf("version: %s\n", rx_data_packet.status);
|
||||
printf("n: %i\n", rx_data_packet.n);
|
||||
printf("code:\n");
|
||||
for(i = 0; i < 51; i++)printf("%i ", rx_data_packet.code[i]); printf("\n");
|
||||
for(i = 0; i < SIZE_CODE; i++)printf("%i ", rx_data_packet.code[i]); printf("\n");
|
||||
#endif
|
||||
if(rx_data_packet.n > 0 && rx_sequence != rx_data_packet.sequence){
|
||||
message(2);
|
||||
|
Loading…
Reference in New Issue
Block a user