Replies: 1 comment 4 replies
-
Use
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There is a small code that, when compiled with the Arduino kernel (version 4.1.1), produces the correct results:
992 992 174 992 191 191 191 191 191 191 997 997 0 0 319 1811
But when compiling with the Earle F. Philhower, III kernel (version 3.7.2), I get error results:
992 992 1984 382 764 764 1528 1832 7 0 612 284 0 0 0 0
I don’t understand the nuances of programming so deeply, so please indicate where is my mistake or is it a compiler error?
I use RP2040 board in Arduino IDE 2.3.2
`typedef struct crsf_channels_t
{
unsigned ch0 : 11;
unsigned ch1 : 11;
unsigned ch2 : 11;
unsigned ch3 : 11;
unsigned ch4 : 11;
unsigned ch5 : 11;
unsigned ch6 : 11;
unsigned ch7 : 11;
unsigned ch8 : 11;
unsigned ch9 : 11;
unsigned ch10 : 11;
unsigned ch11 : 11;
unsigned ch12 : 11;
unsigned ch13 : 11;
unsigned ch14 : 11;
unsigned ch15 : 11;
} PACKED;
String LeadBy(String aS, char aC, int aL) {
String res = aS;
while (res.length() < aL)
res = aC + res;
return res;
}
uint8_t elrsMsg[]={0xc8,0x18,0x16,0xe0,0x03,0x9f,0x2b,0xc0,0xf7,0x8b,0x5f,0xfc,0xe2,0x17,0xbf,0xf8,0x45,0xf9,0xca,0x07,0x00,0x00,0xfc,0x64,0xe2,0x48};
byte BF_channels[64];
crsf_channels_t *cr_channels = (crsf_channels_t *)BF_channels;
void setup() {
Serial.begin(115200);
}
void loop() {
for (int ix = 0; ix < 23; ix++) BF_channels[ix] = elrsMsg[ix+3];
// printELRS();
printCh();
delay(10000);
}
//-----------------------------------------------------
void setup1(){
}
void loop1() {
// if (channels_are_readed) printCh();
}
//-----------------------------------------------------
void printCh() {
Serial.print(LeadBy(String(cr_channels->ch0), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch1), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch2), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch3), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch4), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch5), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch6), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch7), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch8), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch9), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch10), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch11), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch12), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch13), ' ', 5));
Serial.print(LeadBy(String(cr_channels->ch14), ' ', 5));
Serial.println(LeadBy(String(cr_channels->ch15), ' ', 5));
}`
Beta Was this translation helpful? Give feedback.
All reactions