mirror of https://github.com/FOME-Tech/fome-fw.git
sent
This commit is contained in:
parent
6c37f56eb8
commit
a9b866fff1
|
@ -543,9 +543,9 @@ static MAILBOX_DECL(sent_mb, sent_mb_buffer, SENT_MB_SIZE);
|
|||
|
||||
static THD_WORKING_AREA(waSentDecoderThread, 256);
|
||||
|
||||
void SENT_ISR_Handler(uint8_t ch, uint16_t clocks) {
|
||||
void SENT_ISR_Handler(uint8_t channel, uint16_t clocks) {
|
||||
/* encode to fit msg_t */
|
||||
msg_t msg = (ch << 16) | clocks;
|
||||
msg_t msg = (channel << 16) | clocks;
|
||||
|
||||
/* called from ISR */
|
||||
chSysLockFromISR();
|
||||
|
@ -565,17 +565,17 @@ static void SentDecoderThread(void*) {
|
|||
uint8_t n = (msg >> 16) & 0xff;
|
||||
|
||||
if (n < SENT_CHANNELS_NUM) {
|
||||
sent_channel &ch = channels[n];
|
||||
sent_channel &channel = channels[n];
|
||||
|
||||
if (ch.Decoder(tick) > 0) {
|
||||
if (channel.Decoder(tick) > 0) {
|
||||
|
||||
uint16_t sig0, sig1;
|
||||
ch.GetSignals(NULL, &sig0, &sig1);
|
||||
channel.GetSignals(NULL, &sig0, &sig1);
|
||||
engine->sent_state.value0 = sig0;
|
||||
engine->sent_state.value1 = sig1;
|
||||
|
||||
#if SENT_STATISTIC_COUNTERS
|
||||
engine->sent_state.errorRate = ch.statistic.getErrorRate();
|
||||
engine->sent_state.errorRate = channel.statistic.getErrorRate();
|
||||
#endif // SENT_STATISTIC_COUNTERS
|
||||
|
||||
|
||||
|
@ -588,10 +588,8 @@ static void SentDecoderThread(void*) {
|
|||
|
||||
static void printSentInfo() {
|
||||
for (int i = 0; i < SENT_CHANNELS_NUM; i++) {
|
||||
sent_channel &ch = channels[i];
|
||||
|
||||
efiPrintf("---- SENT ch %d ----", i);
|
||||
ch.Info();
|
||||
channels[i].Info();
|
||||
efiPrintf("--------------------");
|
||||
}
|
||||
}
|
||||
|
@ -601,9 +599,8 @@ static void printSentInfo() {
|
|||
float getSentValue(size_t index) {
|
||||
if (index < SENT_CHANNELS_NUM) {
|
||||
uint16_t sig0, sig1;
|
||||
sent_channel &ch = channels[index];
|
||||
|
||||
if (ch.GetSignals(NULL, &sig0, &sig1) == 0) {
|
||||
if (channels[index].GetSignals(NULL, &sig0, &sig1) == 0) {
|
||||
|
||||
// GM sig0 + sig1 == 0xfff but Ford does not
|
||||
/* scale to 0.0 .. 1.0 */
|
||||
|
@ -616,9 +613,7 @@ float getSentValue(size_t index) {
|
|||
|
||||
int getSentValues(size_t index, uint16_t *sig0, uint16_t *sig1) {
|
||||
if (index < SENT_CHANNELS_NUM) {
|
||||
sent_channel &ch = channels[index];
|
||||
|
||||
return ch.GetSignals(NULL, sig0, sig1);
|
||||
return channels[index].GetSignals(NULL, sig0, sig1);
|
||||
}
|
||||
|
||||
/* invalid channel */
|
||||
|
|
Loading…
Reference in New Issue