Some explainations about code
Posted: Tue Jan 12, 2016 12:32 pm
Hi all,
I open this thread about some part of codes I'd like to have explained(to avoid to open multiple threads with same argument). My questions are newbie so don't esitate to answer with all informations that can be usefull!
They do almost same thing, what's their main difference? I suppose one save inside internal flash and the second on the external eeprom, it's right?
About this struct:
There is this variables:
Used in this way:
Can you explain me use of variable MAGIC? also, what is purpose of this calibrations and where are set/get this calibPitch/calibRoll values?
About pidctrl.c
As I understand in previous thread it's used just to set pids values when a param packet is recived. But some functions have this (void* param) as paramenters in their definition. I've looked into code references to (void* param) but found nothing. I suppose that is used from PARAM functions, but I can't understand what (void* param) means. It pass a pointer of a function?
Thank you!
I open this thread about some part of codes I'd like to have explained(to avoid to open multiple threads with same argument). My questions are newbie so don't esitate to answer with all informations that can be usefull!
Code: Select all
configblockeeprom.c
configblockflash.c
About this struct:
Code: Select all
struct configblock_v1_s {
/* header */
uint32_t magic;
uint8_t version;
/* Content */
uint8_t radioChannel;
uint8_t radioSpeed;
float calibPitch;
float calibRoll;
uint8_t radioAddress_upper;
uint32_t radioAddress_lower;
/* Simple modulo 256 checksum */
uint8_t cksum;
} __attribute__((__packed__));
Code: Select all
uint32_t magic;
float calibPitch;
float calibRoll;
Code: Select all
cosPitch = cosf(configblockGetCalibPitch() * (float) M_PI/180);
sinPitch = sinf(configblockGetCalibPitch() * (float) M_PI/180);
cosRoll = cosf(configblockGetCalibRoll() * (float) M_PI/180);
sinRoll = sinf(configblockGetCalibRoll() * (float) M_PI/180);
About pidctrl.c
As I understand in previous thread it's used just to set pids values when a param packet is recived. But some functions have this (void* param) as paramenters in their definition. I've looked into code references to (void* param) but found nothing. I suppose that is used from PARAM functions, but I can't understand what (void* param) means. It pass a pointer of a function?
Thank you!