mirror of https://github.com/rusefi/wideband.git
move CAN loop
This commit is contained in:
parent
2d483cc586
commit
ea1f528aea
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "can_helper.h"
|
||||
#include "heater_control.h"
|
||||
#include "lambda_conversion.h"
|
||||
#include "sampling.h"
|
||||
|
||||
static const CANConfig canConfig500 =
|
||||
{
|
||||
|
@ -10,9 +12,25 @@ static const CANConfig canConfig500 =
|
|||
CAN_BTR_SJW(0) | CAN_BTR_BRP(5) | CAN_BTR_TS1(12) | CAN_BTR_TS2(1) | CAN_BTR_LBKM,
|
||||
};
|
||||
|
||||
static THD_WORKING_AREA(waCanTxThread, 256);
|
||||
void CanTxThread(void*)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
float esr = GetSensorInternalResistance();
|
||||
float lambda = GetLambda();
|
||||
|
||||
SendCanData(lambda, esr);
|
||||
SendEmulatedAemXseries(lambda, 0);
|
||||
|
||||
chThdSleepMilliseconds(10);
|
||||
}
|
||||
}
|
||||
|
||||
void InitCan()
|
||||
{
|
||||
canStart(&CAND1, &canConfig500);
|
||||
chThdCreateStatic(waCanTxThread, sizeof(waCanTxThread), NORMALPRIO, CanTxThread, nullptr);
|
||||
}
|
||||
|
||||
struct StandardDataFrame
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "pump_control.h"
|
||||
#include "pump_dac.h"
|
||||
#include "sampling.h"
|
||||
#include "lambda_conversion.h"
|
||||
|
||||
static const UARTConfig uartCfg =
|
||||
{
|
||||
|
@ -44,13 +43,10 @@ int main() {
|
|||
|
||||
InitCan();
|
||||
|
||||
while(1) {
|
||||
float esr = GetSensorInternalResistance();
|
||||
float lambda = GetLambda();
|
||||
|
||||
SendCanData(lambda, esr);
|
||||
SendEmulatedAemXseries(lambda, 0);
|
||||
|
||||
chThdSleepMilliseconds(10);
|
||||
while(true)
|
||||
{
|
||||
palTogglePad(GPIOB, 6);
|
||||
chThdSleepMilliseconds(400);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue