From f45fd4ae7ecedfa90e3e0a8a323f8169ce70ec93 Mon Sep 17 00:00:00 2001 From: Klagarge Date: Mon, 4 Sep 2023 15:20:54 +0200 Subject: [PATCH] add Steering --- 306-controller_interface.X/app/can_message.c | 12 +- 306-controller_interface.X/app/can_message.h | 13 -- .../app/factory/factory.c | 8 + .../app/factory/factory.h | 3 + 306-controller_interface.X/app/steering.c | 164 ++++++++++++++++++ 306-controller_interface.X/app/steering.h | 124 +++++++++++++ .../nbproject/Makefile-default.mk | 26 ++- .../nbproject/configurations.xml | 2 + UML/steering.uxf | 124 +++++++++++++ 9 files changed, 457 insertions(+), 19 deletions(-) create mode 100644 306-controller_interface.X/app/steering.c create mode 100644 306-controller_interface.X/app/steering.h create mode 100644 UML/steering.uxf diff --git a/306-controller_interface.X/app/can_message.c b/306-controller_interface.X/app/can_message.c index 62442da..8e24eb7 100644 --- a/306-controller_interface.X/app/can_message.c +++ b/306-controller_interface.X/app/can_message.c @@ -232,9 +232,19 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, bool rtr, uint32_t data){ } + if(idMsg == 0x3) { // STEERING_READY + // - - - - + + } + if(idMsg == 0xF) { // STEERING_ALIVE // statusH statusL - - - // TODO steering say ALIVE with his status + ALIVE_ISALIVE(&steering()->myChecker); + if(steering()->myChecker.state == STST_DEAD) { + KART_CST.STEERING_ALIVE_TIME = MEM_read_1_byte(MEMADD_STEERING_ALIVE_TIME); + ALIVE_emitResurrect(&steering()->myChecker, 0, 0); + ALIVE_emitBorn(&steering()->myChecker, 0, 0); + } } break; diff --git a/306-controller_interface.X/app/can_message.h b/306-controller_interface.X/app/can_message.h index 7a7a352..77fcb77 100644 --- a/306-controller_interface.X/app/can_message.h +++ b/306-controller_interface.X/app/can_message.h @@ -12,19 +12,6 @@ #include // usage of boolean types #include "../mcc_generated_files/mcc.h" -/* -S R M -1 0 F CONTROL_ALIVE - - - - -1 2 0 JOY_SETUP Mode Param1 Param2 aliveTime -1 3 0 DISPLAY_SETUP reset - - aliveTime -1 3 2 DISPLAY_SPEED valH valL - - -1 3 3 DISPLAY_DIRECTION direction - - - -1 4 0 DRIVE_SETUP Reset/init speedTime stopTime aliveTime -1 4 1 DRIVE_POWER valH valL - - -1 5 0 STEERING_SETUP Reset/init homing setCenter aliveTime -1 5 1 STEERING_SET valHH valH valL valLL -1 6 0 SETUP_CONTROL batteryVoltTime batteryCurrentTime batteryEnergyTime aliveTime -*/ /** * Process an incoming message diff --git a/306-controller_interface.X/app/factory/factory.c b/306-controller_interface.X/app/factory/factory.c index 41b271d..de5e20b 100644 --- a/306-controller_interface.X/app/factory/factory.c +++ b/306-controller_interface.X/app/factory/factory.c @@ -46,6 +46,10 @@ DRIVE* drive(){ return &theFactory.drive_; } +STEERING* steering(){ + return &theFactory.steering_; +} + //initialize all objects void Factory_init() { @@ -80,6 +84,7 @@ void Factory_init() { ALIVE_init(ALjoy()); DRIVE_init(drive()); + STEERING_init(steering()); } //connect objects if required @@ -100,6 +105,9 @@ void Factory_build() { DRIVE_onRun(drive(), LED_on, l2()); DRIVE_onDead(drive(), LED_off, l2()); + STEERING_onRun(drive(), LED_on, l3()); + STEERING_onDead(drive(), LED_off, l3()); + } //start all state machines diff --git a/306-controller_interface.X/app/factory/factory.h b/306-controller_interface.X/app/factory/factory.h index 1a35e49..fd3b51f 100644 --- a/306-controller_interface.X/app/factory/factory.h +++ b/306-controller_interface.X/app/factory/factory.h @@ -16,6 +16,7 @@ #include "../can_message.h" #include "../eeprom.h" #include "../drive.h" +#include "../steering.h" #include "../../board/led/led.h" #include "../../board/button/button.h" #include "../../middleware/alive.h" @@ -38,6 +39,7 @@ typedef struct { ALIVE ALcontroller_; ALIVE ALjoy_; DRIVE drive_; + STEERING steering_; } Factory; @@ -61,6 +63,7 @@ BLINKER* b1(); ALIVE* ALcontroller(); ALIVE* ALjoy(); DRIVE* drive(); +STEERING* steering(); #endif \ No newline at end of file diff --git a/306-controller_interface.X/app/steering.c b/306-controller_interface.X/app/steering.c new file mode 100644 index 0000000..2d3a703 --- /dev/null +++ b/306-controller_interface.X/app/steering.c @@ -0,0 +1,164 @@ +/** + * @author Rémi Heredero + * @version 1.0.0 + * @date September 2023 + * @file steering.c + */ + +#include "steering.h" +#include "can_message.h" +#include "car.h" +//#include "drive.h" + +void STEERING_init(STEERING* me){ + me->state = STST_INIT; + ALIVE_init(&me->myChecker); + ALIVE_onSetup(&me->myChecker, CM_STEERING_SETUP, &ALWAYSFALSE); + ALIVE_onWait(&me->myChecker, STEERING_emitStart, me); + ALIVE_onDead(&me->myChecker, STEERING_emitStop, me); + ALIVE_onBorn(&me->myChecker, STEERING_emitResurrect, me); + me->wait.f = NULL; + me->run.f = NULL; + me->dead.f = NULL; +} + +void STEERING_startBehaviour(STEERING* me){ + POST(me, &STEERING_processEvent, evSTinit, 100, 0); +} + +bool STEERING_processEvent(Event* ev) { + bool processed = false; + STEERING* me = (STEERING*)Event_getTarget(ev); + STEERING_STATES oldState = me->state; + evIDT evid = Event_getId(ev); + uint64_t data = Event_getData(ev); + + switch (me->state) { // onState + case STST_INIT: + if (ev->id == evSTinit) { + me->state = STST_WAIT; + ALIVE_startBehaviourChecker(&me->myChecker); // Start alive checker + } + break; + + case STST_WAIT: + if (ev->id == evSTstart) { + me->state = STST_RUN; + } + ALIVE_setAliveTime(&me->myChecker, KART_CST.STEERING_ALIVE_TIME); + ALIVE_emitBorn(&me->myChecker, 100, 0); + ALIVE_emitReady(&me->myChecker, 200, 0); + break; + + case STST_RUN: + if (ev->id == evSTstop) { + me->state = STST_DEAD; + } + + if (ev->id == evSTpollDir) { + //if(drive()->state == STDR_RUN) { + CM_STEERING_SET(&eKart.position); + //} + } + break; + + case STST_DEAD: + if (ev->id == evSTresurrect) { + me->state = STST_WAIT; + } + break; + } + + if(oldState != me->state){ + switch (oldState) { // onExit + case STST_INIT: + break; + + case STST_WAIT: + break; + + case STST_RUN: + break; + + case STST_DEAD: + break; + } + + switch (me->state) { // onEntry + case STST_INIT: + break; + + case STST_WAIT: + if (me->wait.f != NULL) { + me->wait.f(me->wait.p); + } + break; + + case STST_RUN: + if (me->run.f != NULL) { + me->run.f(me->run.p); + } + break; + + case STST_DEAD: + if (me->dead.f != NULL) { + me->dead.f(me->dead.p); + } + break; + } + + processed = true; + } + return processed; +} + +/************* + * Callbacks * + *************/ + +void STEERING_onWait(STEERING* me, STEERING_CALLBACK_FUNCTION f, void* p) { + me->wait.f = f; + me->wait.p = p; +} + +void STEERING_onRun(STEERING* me, STEERING_CALLBACK_FUNCTION f, void* p) { + me->run.f = f; + me->run.p = p; +} + +void STEERING_onDead(STEERING* me, STEERING_CALLBACK_FUNCTION f, void* p) { + me->dead.f = f; + me->dead.p = p; +} + +/************ + * EMITTERS * + ************/ + +void STEERING_emitStart(void* p) { + STEERING* me = (STEERING*) p; + POST(me, &STEERING_processEvent, evSTstart, 0, 0); +} + +void STEERING_emitStop(void* p) { + STEERING* me = (STEERING*) p; + POST(me, &STEERING_processEvent, evSTstop, 0, 0); +} + +void STEERING_emitResurrect(void* p) { + STEERING* me = (STEERING*) p; + POST(me, &STEERING_processEvent, evSTresurrect, 0, 0); +} + +void STEERING_emitPollDir(void* p) { + STEERING* me = (STEERING*) p; + POST(me, &STEERING_processEvent, evSTpollDir, 0, 0); +} + +/*********** + * SETTERS * + ***********/ + +void STEERING_setMyChecker(STEERING* me, ALIVE v) { + me->myChecker = v; +} diff --git a/306-controller_interface.X/app/steering.h b/306-controller_interface.X/app/steering.h new file mode 100644 index 0000000..27d764d --- /dev/null +++ b/306-controller_interface.X/app/steering.h @@ -0,0 +1,124 @@ +/** + * @author Rémi Heredero + * @version 1.0.0 + * @date September 2023 + * @file steering.h + */ +#ifndef STEERING_H +#define STEERING_H + +#include "../xf/xf.h" +#include "../middleware/alive.h" + +typedef enum { + STST_INIT = 110, + STST_WAIT, + STST_RUN, + STST_DEAD +} STEERING_STATES; + +typedef enum { + evSTinit = 110, + evSTstart, + evSTstop, + evSTresurrect, + evSTpollDir +} STEERING_EVENTS; + +typedef void (*STEERING_CALLBACK_FUNCTION)(void*); +typedef struct { + STEERING_CALLBACK_FUNCTION f; // function + void* p; // param(s) +} STEERING_CALLBACK; + +typedef struct { + STEERING_STATES state; + ALIVE myChecker; + STEERING_CALLBACK wait; + STEERING_CALLBACK run; + STEERING_CALLBACK dead; +} STEERING; + +/** + * Initialize the STEERING + * @param me the STEERING itself + */ +void STEERING_init(STEERING* me); + +/** + * Start the STEERING state machine + * @param me the STEERING itself + */ +void STEERING_startBehaviour(STEERING* me); + +/** + * Process the event + * @param ev the event to process + * @return true if the event is processed + */ +bool STEERING_processEvent(Event* ev); + +/************* + * Callbacks * + *************/ + +/** + * Set the callback function to call when the STEERING is entering state wait + * @param me the STEERING itself + * @param f the function to call + * @param p the param(s) to pass to the function + */ +void STEERING_onWait(STEERING* me, STEERING_CALLBACK_FUNCTION f, void* p); + +/** + * Set the callback function to call when the STEERING is entering state run + * @param me the STEERING itself + * @param f the function to call + * @param p the param(s) to pass to the function + */ +void STEERING_onRun(STEERING* me, STEERING_CALLBACK_FUNCTION f, void* p); + +/** + * Set the callback function to call when the STEERING is entering state dead + * @param me the STEERING itself + * @param f the function to call + * @param p the param(s) to pass to the function + */ +void STEERING_onDead(STEERING* me, STEERING_CALLBACK_FUNCTION f, void* p); + +/************ + * EMITTERS * + ************/ + +/** + * Emit the start event + * @param p the STEERING itself + */ +void STEERING_emitStart(void* p); + +/** + * Emit the stop event + * @param p the STEERING itself + */ +void STEERING_emitStop(void* p); + +/** + * Emit the resurrect event + * @param p the STEERING itself + */ +void STEERING_emitResurrect(void* p); + +/** + * Emit the pollDir event + * @param me the STEERING itself + * @param t time to wait in ms before triggering event + * @param data data to put on the event for XF + */ +void STEERING_emitPollDir(void* p); + +/*********** + * SETTERS * + ***********/ + + +#endif diff --git a/306-controller_interface.X/nbproject/Makefile-default.mk b/306-controller_interface.X/nbproject/Makefile-default.mk index 17547ef..4c5f504 100644 --- a/306-controller_interface.X/nbproject/Makefile-default.mk +++ b/306-controller_interface.X/nbproject/Makefile-default.mk @@ -51,17 +51,17 @@ OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced -SOURCEFILES_QUOTED_IF_SPACED=app/factory/factory.c app/can_message.c app/kartculator.c app/eeprom.c app/drive.c board/led/led.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c mcc_generated_files/pin_manager.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/ecan.c mcc_generated_files/memory.c middleware/can_interface.c middleware/alive.c middleware/blinker.c xf/event.c xf/xf.c main.c +SOURCEFILES_QUOTED_IF_SPACED=app/factory/factory.c app/can_message.c app/kartculator.c app/eeprom.c app/drive.c board/led/led.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c mcc_generated_files/pin_manager.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/ecan.c mcc_generated_files/memory.c middleware/can_interface.c middleware/alive.c middleware/blinker.c xf/event.c xf/xf.c main.c app/steering.c # Object Files Quoted if spaced -OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/app/factory/factory.p1 ${OBJECTDIR}/app/can_message.p1 ${OBJECTDIR}/app/kartculator.p1 ${OBJECTDIR}/app/eeprom.p1 ${OBJECTDIR}/app/drive.p1 ${OBJECTDIR}/board/led/led.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/ecan.p1 ${OBJECTDIR}/mcc_generated_files/memory.p1 ${OBJECTDIR}/middleware/can_interface.p1 ${OBJECTDIR}/middleware/alive.p1 ${OBJECTDIR}/middleware/blinker.p1 ${OBJECTDIR}/xf/event.p1 ${OBJECTDIR}/xf/xf.p1 ${OBJECTDIR}/main.p1 -POSSIBLE_DEPFILES=${OBJECTDIR}/app/factory/factory.p1.d ${OBJECTDIR}/app/can_message.p1.d ${OBJECTDIR}/app/kartculator.p1.d ${OBJECTDIR}/app/eeprom.p1.d ${OBJECTDIR}/app/drive.p1.d ${OBJECTDIR}/board/led/led.p1.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d ${OBJECTDIR}/mcc_generated_files/ecan.p1.d ${OBJECTDIR}/mcc_generated_files/memory.p1.d ${OBJECTDIR}/middleware/can_interface.p1.d ${OBJECTDIR}/middleware/alive.p1.d ${OBJECTDIR}/middleware/blinker.p1.d ${OBJECTDIR}/xf/event.p1.d ${OBJECTDIR}/xf/xf.p1.d ${OBJECTDIR}/main.p1.d +OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/app/factory/factory.p1 ${OBJECTDIR}/app/can_message.p1 ${OBJECTDIR}/app/kartculator.p1 ${OBJECTDIR}/app/eeprom.p1 ${OBJECTDIR}/app/drive.p1 ${OBJECTDIR}/board/led/led.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/ecan.p1 ${OBJECTDIR}/mcc_generated_files/memory.p1 ${OBJECTDIR}/middleware/can_interface.p1 ${OBJECTDIR}/middleware/alive.p1 ${OBJECTDIR}/middleware/blinker.p1 ${OBJECTDIR}/xf/event.p1 ${OBJECTDIR}/xf/xf.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/app/steering.p1 +POSSIBLE_DEPFILES=${OBJECTDIR}/app/factory/factory.p1.d ${OBJECTDIR}/app/can_message.p1.d ${OBJECTDIR}/app/kartculator.p1.d ${OBJECTDIR}/app/eeprom.p1.d ${OBJECTDIR}/app/drive.p1.d ${OBJECTDIR}/board/led/led.p1.d ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1.d ${OBJECTDIR}/mcc_generated_files/tmr0.p1.d ${OBJECTDIR}/mcc_generated_files/pin_manager.p1.d ${OBJECTDIR}/mcc_generated_files/device_config.p1.d ${OBJECTDIR}/mcc_generated_files/mcc.p1.d ${OBJECTDIR}/mcc_generated_files/ecan.p1.d ${OBJECTDIR}/mcc_generated_files/memory.p1.d ${OBJECTDIR}/middleware/can_interface.p1.d ${OBJECTDIR}/middleware/alive.p1.d ${OBJECTDIR}/middleware/blinker.p1.d ${OBJECTDIR}/xf/event.p1.d ${OBJECTDIR}/xf/xf.p1.d ${OBJECTDIR}/main.p1.d ${OBJECTDIR}/app/steering.p1.d # Object Files -OBJECTFILES=${OBJECTDIR}/app/factory/factory.p1 ${OBJECTDIR}/app/can_message.p1 ${OBJECTDIR}/app/kartculator.p1 ${OBJECTDIR}/app/eeprom.p1 ${OBJECTDIR}/app/drive.p1 ${OBJECTDIR}/board/led/led.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/ecan.p1 ${OBJECTDIR}/mcc_generated_files/memory.p1 ${OBJECTDIR}/middleware/can_interface.p1 ${OBJECTDIR}/middleware/alive.p1 ${OBJECTDIR}/middleware/blinker.p1 ${OBJECTDIR}/xf/event.p1 ${OBJECTDIR}/xf/xf.p1 ${OBJECTDIR}/main.p1 +OBJECTFILES=${OBJECTDIR}/app/factory/factory.p1 ${OBJECTDIR}/app/can_message.p1 ${OBJECTDIR}/app/kartculator.p1 ${OBJECTDIR}/app/eeprom.p1 ${OBJECTDIR}/app/drive.p1 ${OBJECTDIR}/board/led/led.p1 ${OBJECTDIR}/mcc_generated_files/interrupt_manager.p1 ${OBJECTDIR}/mcc_generated_files/tmr0.p1 ${OBJECTDIR}/mcc_generated_files/pin_manager.p1 ${OBJECTDIR}/mcc_generated_files/device_config.p1 ${OBJECTDIR}/mcc_generated_files/mcc.p1 ${OBJECTDIR}/mcc_generated_files/ecan.p1 ${OBJECTDIR}/mcc_generated_files/memory.p1 ${OBJECTDIR}/middleware/can_interface.p1 ${OBJECTDIR}/middleware/alive.p1 ${OBJECTDIR}/middleware/blinker.p1 ${OBJECTDIR}/xf/event.p1 ${OBJECTDIR}/xf/xf.p1 ${OBJECTDIR}/main.p1 ${OBJECTDIR}/app/steering.p1 # Source Files -SOURCEFILES=app/factory/factory.c app/can_message.c app/kartculator.c app/eeprom.c app/drive.c board/led/led.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c mcc_generated_files/pin_manager.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/ecan.c mcc_generated_files/memory.c middleware/can_interface.c middleware/alive.c middleware/blinker.c xf/event.c xf/xf.c main.c +SOURCEFILES=app/factory/factory.c app/can_message.c app/kartculator.c app/eeprom.c app/drive.c board/led/led.c mcc_generated_files/interrupt_manager.c mcc_generated_files/tmr0.c mcc_generated_files/pin_manager.c mcc_generated_files/device_config.c mcc_generated_files/mcc.c mcc_generated_files/ecan.c mcc_generated_files/memory.c middleware/can_interface.c middleware/alive.c middleware/blinker.c xf/event.c xf/xf.c main.c app/steering.c @@ -240,6 +240,14 @@ ${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk @-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d @${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ +${OBJECTDIR}/app/steering.p1: app/steering.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/app" + @${RM} ${OBJECTDIR}/app/steering.p1.d + @${RM} ${OBJECTDIR}/app/steering.p1 + ${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -D__DEBUG=1 -mdebugger=pickit3 -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o ${OBJECTDIR}/app/steering.p1 app/steering.c + @-${MV} ${OBJECTDIR}/app/steering.d ${OBJECTDIR}/app/steering.p1.d + @${FIXDEPS} ${OBJECTDIR}/app/steering.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + else ${OBJECTDIR}/app/factory/factory.p1: app/factory/factory.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/app/factory" @@ -393,6 +401,14 @@ ${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk @-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d @${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ +${OBJECTDIR}/app/steering.p1: app/steering.c nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} "${OBJECTDIR}/app" + @${RM} ${OBJECTDIR}/app/steering.p1.d + @${RM} ${OBJECTDIR}/app/steering.p1 + ${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c -mdfp="${DFP_DIR}/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=3 -Wa,-a -DXPRJ_default=$(CND_CONF) -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits $(COMPARISON_BUILD) -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o ${OBJECTDIR}/app/steering.p1 app/steering.c + @-${MV} ${OBJECTDIR}/app/steering.d ${OBJECTDIR}/app/steering.p1.d + @${FIXDEPS} ${OBJECTDIR}/app/steering.p1.d $(SILENT) -rsi ${MP_CC_DIR}../ + endif # ------------------------------------------------------------------------------------ diff --git a/306-controller_interface.X/nbproject/configurations.xml b/306-controller_interface.X/nbproject/configurations.xml index ded209f..1566bbf 100644 --- a/306-controller_interface.X/nbproject/configurations.xml +++ b/306-controller_interface.X/nbproject/configurations.xml @@ -11,6 +11,7 @@ app/kartculator.h app/eeprom.h app/drive.h + app/steering.h board/led/led.h @@ -50,6 +51,7 @@ app/kartculator.c app/eeprom.c app/drive.c + app/steering.c board/led/led.c diff --git a/UML/steering.uxf b/UML/steering.uxf new file mode 100644 index 0000000..05a4d97 --- /dev/null +++ b/UML/steering.uxf @@ -0,0 +1,124 @@ + + + 15 + + Relation + + 660 + 90 + 210 + 120 + + lt=-> +evInit +/startAliveChecker + + 10.0;10.0;10.0;60.0 + + + UMLSpecialState + + 660 + 75 + 30 + 30 + + type=initial + + + + UMLState + + 540 + 405 + 270 + 105 + + RUN +-- +/entry: LED ON +-- +emitPollDirEv + + + + UMLState + + 480 + 180 + 390 + 135 + + WAIT +-- +ALIVE_emitBorn(ALsteering(), 0, 0); +ALIVE_emitReady(ALsteering(), 100, 0); +setAliveTime + + + + Relation + + 660 + 300 + 120 + 135 + + lt=-> +m1=evStart\n(onWait) + + 10.0;10.0;10.0;70.0 + + + Relation + + 735 + 450 + 195 + 180 + + lt=-> +m1= evPollDir\n/sendDir + + 10.0;40.0;10.0;100.0;110.0;100.0;110.0;10.0;50.0;10.0 + + + Relation + + 390 + 240 + 345 + 555 + + lt=-> +m1= evResurrect\n(onBorn) + + 130.0;300.0;130.0;350.0;10.0;350.0;10.0;10.0;60.0;10.0 + + + UMLState + + 450 + 600 + 270 + 90 + + DEAD +-- +/entry: LED OFF + + + + Relation + + 570 + 495 + 135 + 135 + + lt=-> +m1=evStop\n(onDead) + + 10.0;10.0;10.0;70.0 + +