mirror of https://github.com/rusefi/bldc.git
main: Added CAN boot-frame notification.
The boot CAN frame is dispatched at system boot and contains a payload that holds the hw-name (ASCII). This to serve as a notifier for other nodes on the CAN bus. Change-Id: I2edb3d58bb51003d9160ceb83905cf93b63a9396 Reviewed-on: https://review.gerrithub.io/c/RadinnAB/vedder_vesc_fw/+/530857 Tested-by: Mr. Jenkins <jenkins@radinn.com> Tested-by: aleksandar rodzevski <aleks@radinn.com> Reviewed-by: aleksandar rodzevski <aleks@radinn.com> Reviewed-by: Daniel Nordahl <daniel.nordahl@radinn.com>
This commit is contained in:
parent
a30e259549
commit
ed88dbe5b0
13
main.c
13
main.c
|
@ -55,6 +55,11 @@
|
||||||
#include "mempools.h"
|
#include "mempools.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#ifdef CAN_ENABLE
|
||||||
|
#include "comm_can.h"
|
||||||
|
|
||||||
|
#define CAN_FRAME_MAX_PL_SIZE 8
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_LISPBM
|
#ifdef USE_LISPBM
|
||||||
#include "lispif.h"
|
#include "lispif.h"
|
||||||
|
@ -309,6 +314,14 @@ int main(void) {
|
||||||
palSetPad(BOOT_OK_GPIO, BOOT_OK_PIN);
|
palSetPad(BOOT_OK_GPIO, BOOT_OK_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CAN_ENABLE
|
||||||
|
// Transmit a CAN boot-frame to notify other nodes on the bus about it.
|
||||||
|
comm_can_transmit_eid(
|
||||||
|
app_get_configuration()->controller_id | (CAN_PACKET_NOTIFY_BOOT << 8),
|
||||||
|
(uint8_t *)HW_NAME, (strlen(HW_NAME) <= CAN_FRAME_MAX_PL_SIZE) ?
|
||||||
|
strlen(HW_NAME) : CAN_FRAME_MAX_PL_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue