aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-18 16:52:16 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-18 16:52:16 +0300
commit2baa6b0a84284804c699c48b0bbbde85cd8d3975 (patch)
treed2b789c59521c2a7e7fe331c9ebb9b58a1e9da68 /Software/Embedded_SW
parent054debe0f90ef6312f669963c2c62810fc766a8d (diff)
parent0bd5bb08169bf0c72dc686b48b12499f61122958 (diff)
downloadTango-2baa6b0a84284804c699c48b0bbbde85cd8d3975.tar.gz
Tango-2baa6b0a84284804c699c48b0bbbde85cd8d3975.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/.cproject2
-rw-r--r--Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.h2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.h2
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/filter.c2
-rw-r--r--Software/Embedded_SW/Embedded/DataDef.h9
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h15
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c47
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h20
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c65
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c51
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c82
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Valves/Valve.h22
-rw-r--r--Software/Embedded_SW/Embedded/Main.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c94
-rw-r--r--Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/StubRealTimeUsage.c1
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ReadEmbeddedVersion.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c5
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c21
27 files changed, 363 insertions, 99 deletions
diff --git a/Software/Embedded_SW/Embedded/.cproject b/Software/Embedded_SW/Embedded/.cproject
index 81a1f510b..19f15e70d 100644
--- a/Software/Embedded_SW/Embedded/.cproject
+++ b/Software/Embedded_SW/Embedded/.cproject
@@ -280,7 +280,7 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="builds also the PMR" errorParsers="org.eclipse.rtsc.xdctools.parsers.ErrorParser;com.ti.ccstudio.errorparser.CoffErrorParser;com.ti.ccstudio.errorparser.LinkErrorParser;com.ti.ccstudio.errorparser.AsmErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.87225697.838615887" name="debug_w_pmr" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug" postbuildStep="&quot;${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin&quot; &quot;${BuildArtifactFileName}&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; &quot;${CG_TOOL_ROOT}/bin/armofd&quot; &quot;${CG_TOOL_ROOT}/bin/armhex&quot; &quot;${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin&quot;;" prebuildStep="&quot;../../../Visual_Studio/Build/Debug/proto-tc.exe&quot; -i ../../../PMR/Messages -o ../Communication/PMR -l C -c&quot;Common,Connection,Hardware,Printing,Debugging,Stubs&quot;;">
+ <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="builds also the PMR" errorParsers="org.eclipse.rtsc.xdctools.parsers.ErrorParser;com.ti.ccstudio.errorparser.CoffErrorParser;com.ti.ccstudio.errorparser.LinkErrorParser;com.ti.ccstudio.errorparser.AsmErrorParser;org.eclipse.cdt.core.GmakeErrorParser" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.87225697.838615887" name="debug_w_pmr" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug" postbuildStep="&quot;${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin&quot; &quot;${BuildArtifactFileName}&quot; &quot;${BuildArtifactFileBaseName}.bin&quot; &quot;${CG_TOOL_ROOT}/bin/armofd&quot; &quot;${CG_TOOL_ROOT}/bin/armhex&quot; &quot;${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin&quot;;" prebuildStep="&quot;../../../Visual_Studio/Build/Debug/proto-tc.exe&quot; -i ../../../PMR/Messages -o ../Communication/PMR -l C -c&quot;Common,Connection,Diagnostics,Hardware,Printing,Debugging,Stubs&quot;;">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.87225697.838615887." name="/" resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.DebugToolchain.374121404" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.9.exe.linkerDebug.2015775392">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1715586318" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
index cd5e6c034..10b496573 100644
--- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
+++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
@@ -7,9 +7,9 @@
#include <string.h>
#include <stdint.h>
#include <assert.h>
+#include <DataDef.h>
#include <utils/ustdlib.h>
-#include "DataDef.h"
typedef struct
{
diff --git a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.c b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.c
index 88198353e..bd9336db3 100644
--- a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.c
+++ b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.c
@@ -40,9 +40,9 @@
//
//*****************************************************************************
+#include <DataDef.h>
#include <stdbool.h>
#include <stdint.h>
-#include "datadef.h"
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
diff --git a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.h b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.h
index 94a9e8c0b..d97ab0e0a 100644
--- a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.h
+++ b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/MCU_MAIN_pinout.h
@@ -54,7 +54,7 @@
extern "C"
{
#endif
-#include "datadef.h"
+#include "../../DataDef.h"
//*****************************************************************************
//
diff --git a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.c b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.c
index 9a2ecd5af..5798b01ee 100644
--- a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.c
+++ b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.c
@@ -38,7 +38,6 @@
#include <stdint.h>
#include <stdbool.h>
-#include "datadef.h"
#include <inc/hw_types.h>
#include <inc/hw_memmap.h>
#include <inc/hw_gpio.h>
@@ -46,6 +45,7 @@
#include <driverlib/pin_map.h>
#include <driverlib/rom_map.h>
#include <driverlib/gpio.h>
+#include <DataDef.h>
#include "Common/Sys_PinOut_Config/Pin.h"
diff --git a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.h b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.h
index abdb85cbe..90cfe166c 100644
--- a/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.h
+++ b/Software/Embedded_SW/Embedded/Common/Sys_PinOut_Config/Pin.h
@@ -38,7 +38,7 @@
#ifndef __PIN_H__
#define __PIN_H__
-#include "datadef.h"
+#include "../../DataDef.h"
#ifdef EVALUATION_BOARD
extern void PortFunctionInit(void);
diff --git a/Software/Embedded_SW/Embedded/Common/report/filter.c b/Software/Embedded_SW/Embedded/Common/report/filter.c
index f6ce8fda4..b922e53bc 100644
--- a/Software/Embedded_SW/Embedded/Common/report/filter.c
+++ b/Software/Embedded_SW/Embedded/Common/report/filter.c
@@ -18,6 +18,7 @@
*
******************************************************************************/
+#include <DataDef.h>
#include "report.h"
#include <stdio.h>
#include <string.h>
@@ -27,7 +28,6 @@
#include "filter.h"
#include "distributor.h" /* reportDistribute */
-#include <DataDef.h>
//#define MAX_STRING_LEN 255
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h
index 12f896c77..7e06853af 100644
--- a/Software/Embedded_SW/Embedded/DataDef.h
+++ b/Software/Embedded_SW/Embedded/DataDef.h
@@ -29,6 +29,15 @@ enum
#define ENABLE 1
#define DISABLE 0
+//Valves Directions:
+#define MidTank_Dispenser 1 //?
+#define Dispenser_Mixer 0 //?
+#define Cartridge_MidTank_ON 1
+#define Cartridge_MidTank_OFF 0
+#define Atm_MidTank_ON 1
+#define Atm_MidTank_OFF 0
+
+
#define NEW 0
#define USED 1
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c
index 50b3d627e..3cd4c8f0d 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA.c
@@ -1,5 +1,4 @@
#include "include.h"
-#include <DataDef.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
@@ -10,6 +9,7 @@
#include "FPGA_COMM.h"
#include "driverlib/sysctl.h" //for SysCtlDelay
#include <driverlib/sysctl.h>
+#include <DataDef.h>
#include "Drivers/Peripheral_GPIO/GPIO.h"
unsigned short GPO_01_Reg;
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h
index 49da97aa5..6cdf486e7 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_Comm.h
@@ -1405,6 +1405,21 @@ typedef union
unsigned short ushort;
}LS_DISPENSER_7_8;
+//F1_GPI_EXTWINDER_D
+typedef union
+{
+ struct
+ {
+ bool F1_GPI_EXTWINDER_3 : 1; //0
+ bool F1_GPI_EXTWINDER_2 : 1; //1
+ bool F1_GPI_EXTWINDER_1 : 1; //2
+ bool F1_GPI_TFEED_BREAK_2 : 1; //3
+ bool F1_GPI_TFEED_BREAK_1 : 1; //4
+ unsigned short RESERVE : 11; //5-15
+
+ }bits;
+ unsigned short ushort;
+}GPI_EXTWINDER_TFEED_BREAK;
//------------------------------ MOTOR DRIVER L_6470 ------------------------------
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c
index e848c1b94..e05979f6e 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c
@@ -9,7 +9,6 @@
#include <stdbool.h>
#include <drivers/FPGA/FPGA_Comm.h>
#include <DataDef.h>
-
#include "modules/control/millisecTask.h"
#include "modules/thread/thread.h"
@@ -30,11 +29,14 @@ void Read_FPGA_GPI_Rgisters()
FPGA_Gpi.Reg.GPI_LS2_D = F1_GPI_LS2_D;
FPGA_Gpi.Reg.GPI_LS3_D = F1_GPI_LS3_D;
+
FPGA_Gpi.Reg.LS_01 = F2_LS_01_Direct;
FPGA_Gpi.Reg.LS_01 = F2_LS_01_Direct;
FPGA_Gpi.Reg.LS_01 = F2_LS_01_Direct;
FPGA_Gpi.Reg.LS_01 = F2_LS_01_Direct;
+ FPGA_Gpi.Reg.GPI_EXTWINDER = F1_GPI_EXTWINDER_D;
+
for(i=0;i<MAX_GPI;i++)
{
index_buf = i / Size;
@@ -56,30 +58,39 @@ if(FPGA_Gpi_Buf[GPI_LS_RLOADRAM_UP] == LIMIT)
void test_fpga_gpi()
{
- bool nop = false;
+ int nop = 0;
+//while(1)
+//{
Read_FPGA_GPI_Rgisters();
- if( FPGA_Gpi_Buf[GPI_LS_LPIVOT_UP] |
- FPGA_Gpi_Buf[GPI_LS_LPIVOT_DOWN] |
- FPGA_Gpi_Buf[GPI_LS_LLOADMOTOR_UP] |
- FPGA_Gpi_Buf[GPI_LS_LLOADMOTOR_DOWN] |
- FPGA_Gpi_Buf[GPI_LS_LDANCER1_UP] |
- FPGA_Gpi_Buf[GPI_LS_LDANCER1_DOWN] |
-
- FPGA_Gpi_Buf[GPI_LS_RDANCER_LONG] |
- FPGA_Gpi_Buf[GPI_LS_RLOADMOTOR_UP] |
- FPGA_Gpi_Buf[GPI_LS_RLOADMOTOR_DOWN] |
- FPGA_Gpi_Buf[GPI_LS_RDANCER_UP] |
- FPGA_Gpi_Buf[GPI_LS_RDANCER_DOWN] |
-
- FPGA_Gpi_Buf[GPI_LS_SCREW_RIGHT] |
- FPGA_Gpi_Buf[GPI_LS_SCREW_LEFT]
+ if( //FPGA_Gpi_Buf[GPI_LS_LPIVOT_UP] |
+// FPGA_Gpi_Buf[GPI_LS_LPIVOT_DOWN] |
+// FPGA_Gpi_Buf[GPI_LS_LLOADMOTOR_UP] |
+// FPGA_Gpi_Buf[GPI_LS_LLOADMOTOR_DOWN] |
+// FPGA_Gpi_Buf[GPI_LS_LDANCER1_UP] |
+// FPGA_Gpi_Buf[GPI_LS_LDANCER1_DOWN] |
+//
+// FPGA_Gpi_Buf[GPI_LS_RDANCER_LONG] |
+// FPGA_Gpi_Buf[GPI_LS_RLOADMOTOR_UP] |
+// FPGA_Gpi_Buf[GPI_LS_RLOADMOTOR_DOWN] |
+// FPGA_Gpi_Buf[GPI_LS_RDANCER_UP] |
+// FPGA_Gpi_Buf[GPI_LS_RDANCER_DOWN] |
+//
+// FPGA_Gpi_Buf[GPI_LS_SCREW_RIGHT] |
+ //FPGA_Gpi_Buf[GPI_LS_SCREW_LEFT] // |
+ FPGA_Gpi_Buf[GPI_F1_GPI_TFEED_BREAK_2]
== LIMIT)
{
- nop = true;
+ nop += 1;
+ }
+ else
+ {
+ nop += 2;
}
+//}
+
}
LS_LEFT LS_Left;
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h
index e1de68cbb..7ac15de5b 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h
@@ -136,6 +136,24 @@ typedef enum
GPI_LS_04_Direct_BIT14, //110
GPI_LS_04_Direct_BIT15, //111
+ //F1_GPI_EXTWINDER_Direct
+ GPI_F1_GPI_EXTWINDER_3, //112
+ GPI_F1_GPI_EXTWINDER_2, //113
+ GPI_F1_GPI_EXTWINDER_1, //114
+ GPI_F1_GPI_TFEED_BREAK_2, //115
+ GPI_F1_GPI_TFEED_BREAK_1, //116
+ GPI_EXTWINDER_Direct_BIT05, //117
+ GPI_EXTWINDER_Direct_BIT06, //118
+ GPI_EXTWINDER_Direct_BIT07, //119
+ GPI_EXTWINDER_Direct_BIT08, //120
+ GPI_EXTWINDER_Direct_BIT09, //121
+ GPI_EXTWINDER_Direct_BIT10, //122
+ GPI_EXTWINDER_Direct_BIT11, //123
+ GPI_EXTWINDER_Direct_BIT12, //124
+ GPI_EXTWINDER_Direct_BIT13, //125
+ GPI_EXTWINDER_Direct_BIT14, //126
+ GPI_EXTWINDER_Direct_BIT15, //127
+
//-----------------------
MAX_GPI
}FPGA_GPI_ENUM;
@@ -151,6 +169,7 @@ typedef union
unsigned short LS_02;
unsigned short LS_03;
unsigned short LS_04;
+ unsigned short GPI_EXTWINDER;
}Reg;
unsigned short Buf[MAX_GPI/sizeof(unsigned short)];
}FPGA_GPI;
@@ -159,6 +178,7 @@ extern bool FPGA_Gpi_Buf[MAX_GPI];
void Read_FPGA_GPI_Rgisters();
bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch);
+void FPGA_Read_limit_Switches_Registers();
diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
index 9fc17fa37..cec8b74af 100644
--- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
+++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_SPI_Comm.c
@@ -13,6 +13,7 @@
#include "PMR/Hardware/HardwareDancerType.pb-c.h"
extern TempSensorResponseStruct TempSensorResponse[MAX_TEMPERATURE_SENSOR_ID];
+void FPGA_SetMotStop(TimerMotors_t _motorId);
#include <drivers/FPGA/FPGA_SSI_Comm.h>
///////////////////////////////////////////////////////////////////////////////
@@ -294,9 +295,34 @@ int MotorSendFPGARequest(TimerMotors_t MotorId,uint32_t Data, uint32_t Length)
// return ERROR;
}
+typedef enum
+{
+ MOTOR_CONFIG_INIT,
+ MOTOR_CONFIG_HARD_HIZ,
+ MOTOR_CONFIG_ACC,
+ MOTOR_CONFIG_DEC,
+ MOTOR_CONFIG_MAX_SPEED,
+ MOTOR_CONFIG_STEP_MODE,
+ MOTOR_CONFIG_CONFIG,
+ MOTOR_CONFIG_KVAL_HOLD,
+ MOTOR_CONFIG_KVAL_RUN,
+ MOTOR_CONFIG_KVAL_ACC,
+ MOTOR_CONFIG_KVAL_DEC,
+ MOTOR_CONFIG_ST_SLP,
+ MOTOR_CONFIG_INT_SPD,
+ MOTOR_CONFIG_FN_SLP_ACC,
+ MOTOR_CONFIG_FN_SLP_DEC,
+ MOTOR_CONFIG_OCD_TH,
+ MOTOR_CONFIG_STALL_TH,
+ MOTOR_CONFIG_K_THERM,
+ MOTOR_CONFIG_END
+}MOTOR_CONFIG_STAGES_ENUM;
+MOTOR_CONFIG_STAGES_ENUM ConfigStages[NUM_OF_MOTORS] = {MOTOR_CONFIG_INIT};
void FPGA_SetMotorsInit()
{
+ uint8_t i=0;
+
//LOW logic level resets the logic and puts the device into Standby mode.
F1_Moto_Driver_NSTBYRST1 = 0;
F1_Moto_Driver_NSTBYRST2 = 0;
@@ -310,6 +336,12 @@ void FPGA_SetMotorsInit()
F2_Moto_Driver_NSTBYRST1 = 0xFFFF;
F3_Moto_Driver_NSTBYRST1 = 0xFFFF;
+ for(i=0;i<NUM_OF_MOTORS;i++)
+ {
+ MotorDriverRequest[i].Stop = Hard_Hiz;
+ FPGA_SetMotStop((HardwareMotorType)i);
+ }
+
//TODO Prescaler settings for SPI
//F1_Prescaler1_reg3 = //3bit spi moto low duty cycle value for pmw
//F1_Prescaler1_reg4 = //3bit spi moto high duty cycle value for pmw
@@ -318,30 +350,7 @@ void FPGA_SetMotorsInit()
//F3_Prescaler1_reg3 = //3bit spi moto low duty cycle value for pmw
//F3_Prescaler1_reg4 = //3bit spi moto high duty cycle value for pmw
}
-typedef enum
-{
- MOTOR_CONFIG_INIT,
- MOTOR_CONFIG_HARD_HIZ,
- MOTOR_CONFIG_ACC,
- MOTOR_CONFIG_DEC,
- MOTOR_CONFIG_MIN_SPEED,
- MOTOR_CONFIG_MAX_SPEED,
- MOTOR_CONFIG_STEP_MODE,
- MOTOR_CONFIG_CONFIG,
- MOTOR_CONFIG_KVAL_HOLD,
- MOTOR_CONFIG_KVAL_RUN,
- MOTOR_CONFIG_KVAL_ACC,
- MOTOR_CONFIG_KVAL_DEC,
- MOTOR_CONFIG_ST_SLP,
- MOTOR_CONFIG_INT_SPD,
- MOTOR_CONFIG_FN_SLP_ACC,
- MOTOR_CONFIG_FN_SLP_DEC,
- MOTOR_CONFIG_OCD_TH,
- MOTOR_CONFIG_STALL_TH,
- MOTOR_CONFIG_K_THERM,
- MOTOR_CONFIG_END
-}MOTOR_CONFIG_STAGES_ENUM;
-MOTOR_CONFIG_STAGES_ENUM ConfigStages[NUM_OF_MOTORS] = {MOTOR_CONFIG_INIT};
+
uint32_t FPGA_MotorConfig_callback(TimerMotors_t _motorId, uint32_t ReadValue)
{
char MultiStep[8] = {1,2,4,8,16,32,64,128};
@@ -566,10 +575,12 @@ void FPGA_SetMotSpeed(TimerMotors_t _motorId)//Run
temp |= MotorDriverRequest[_motorId].Speed;
MillisecSetMotorSpeed(_motorId, temp, 4, NULL);
- //Fpga_Spi[_motorId].TX_MOSI = temp;//<<8;
- //Fpga_Spi[_motorId].AMT_OF_Words = 4;
- //FPGA_SPI_Transnit(_motorId);
+///--------------------------------------------
+// Fpga_Spi[_motorId].TX_MOSI = temp;//<<8;
+ //Fpga_Spi[_motorId].AMT_OF_Words = 4;
+// FPGA_SPI_Transnit(_motorId);
+//-----------------------------------------------------
}
void FPGA_SetMotMaxSpeed(TimerMotors_t _motorId)//Mov
{
diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c
index 29fe18b1a..b543e01f4 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c
@@ -2,7 +2,6 @@
* Heater.c
* Heater Driver
**************************************************************************************************************************/
-#include <DataDef.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
@@ -20,6 +19,7 @@
#include "driverlib/sysctl.h"
#include <drivers/FPGA/FPGA_Comm.h>
+#include <DataDef.h>
#include "Drivers/Peripheral_GPIO/GPIO.h"
#include <Modules/Stubs_Handler/User_Leds.h>
#include "PMR/Hardware/HardwarePIDControl.pb-c.h"
diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c
index 9dce895b9..2f4afed73 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Motors/Motor.c
@@ -48,21 +48,22 @@ MotorDriverRequestStruct MotorDriverRequest[NUM_OF_MOTORS];
//MotorDriverConfigStruc MotorsCfg[NUM_OF_MOTORS];
TimerMotors_t FastMotorToMotorId[4] = {HARDWARE_MOTOR_TYPE__MOTO_RDRIVING,HARDWARE_MOTOR_TYPE__MOTO_DRYER_DRIVING,HARDWARE_MOTOR_TYPE__MOTO_LDRIVING,HARDWARE_MOTOR_TYPE__MOTO_WINDER};
-callback_fptr MotorMoveModuleCallback = 0;
-callback_fptr MotorSetSpeedModuleCallback = 0;
-callback_fptr MotorMovetoLimitSwitchCallback = 0;
+callback_fptr MotorMoveModuleCallback[NUM_OF_MOTORS];
+callback_fptr MotorSetSpeedModuleCallback[NUM_OF_MOTORS];
+callback_fptr MotorMovetoLimitSwitchCallback[NUM_OF_MOTORS];
uint32_t ControlCallBackFunction(uint32_t deviceID, uint32_t ReadValue);
uint32_t MotorMoveCallBackFunction(uint32_t deviceId, uint32_t BusyFlag);
uint32_t MotorSetSpeedCallBackFunction(uint32_t deviceId, uint32_t BusyFlag);
-uint32_t MotorMoveControlId = 0;
-uint32_t MotorSetSpeedControlId = 0;
-uint32_t MotorMovetoLimitSwitchControlId[NUM_OF_MOTORS] = {0};
+uint32_t MotorMoveControlId[NUM_OF_MOTORS];
+uint32_t MotorSetSpeedControlId[NUM_OF_MOTORS];
+uint32_t MotorMovetoLimitSwitchControlId[NUM_OF_MOTORS];
//initialize general motors driver database
uint32_t MotorsInit(void)
{
+ int i = 0;
#ifdef EVALUATION_BOARD
//MOTOR Driver L6470 SPI
SPI2_Init();
@@ -76,6 +77,16 @@ uint32_t MotorsInit(void)
#else
FPGA_SetMotorsInit();
#endif
+ for (i=0;i<NUM_OF_MOTORS;i++)
+ {
+ MotorMoveControlId[i] = 0xFF;
+ MotorSetSpeedControlId[i] = 0xFF;
+ MotorMovetoLimitSwitchControlId[i] = 0xFF;
+ MotorMoveModuleCallback[i] = 0;
+ MotorSetSpeedModuleCallback[i] = 0;
+ MotorMovetoLimitSwitchCallback[i] = 0;
+ }
+
return OK;
}
@@ -347,23 +358,23 @@ uint32_t MotorMoveWithCallback (TimerMotors_t _motorId,bool direction, uint32_t
//call driver action to device id with the parameter
//SetMotorSpeed (deviceId, parameter);
- MotorMoveModuleCallback = callback;
+ MotorMoveModuleCallback[_motorId] = callback;
MotorStop(_motorId,2 );
MotorMove(_motorId,direction,Steps );
- MotorMoveControlId = AddControlCallback( MotorMoveCallBackFunction, eTenMilliSecond, MotorControlGetnBusyState,(IfTypeMotors*0x100+_motorId), _motorId, 0 );
- return MotorMoveControlId;
+ MotorMoveControlId[_motorId] = AddControlCallback( MotorMoveCallBackFunction, eTenMilliSecond, MotorControlGetnBusyState,(IfTypeMotors*0x100+_motorId), _motorId, 0 );
+ return MotorMoveControlId[_motorId];
}
uint32_t MotorSetSpeedWithCallback (TimerMotors_t _motorId, uint32_t _freq, callback_fptr callback) //TODO
{
assert (callback);
- MotorSetSpeedModuleCallback = callback;
+ MotorSetSpeedModuleCallback[_motorId] = callback;
- MotorSetSpeedControlId = AddControlCallback( MotorSetSpeedCallBackFunction, eTenMilliSecond, MotorControlGetnBusyState,(IfTypeMotors*0x100+_motorId), _motorId, 0 );
+ MotorSetSpeedControlId[_motorId] = AddControlCallback( MotorSetSpeedCallBackFunction, eTenMilliSecond, MotorControlGetnBusyState,(IfTypeMotors*0x100+_motorId), _motorId, 0 );
MotorSetSpeed(_motorId, _freq);
- return MotorSetSpeedControlId;
+ return MotorSetSpeedControlId[_motorId];
}
uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
@@ -379,12 +390,13 @@ uint32_t MotorMoveCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TODO
if (BusyFlag == NOTBUSY)
{
//stop this control loop
- RemoveControlCallback(MotorMoveControlId, MotorMoveCallBackFunction );
+ RemoveControlCallback(MotorMoveControlId[MotorId], MotorMoveCallBackFunction );
//possibly: start regular control (speed etc)
//uint32_t ControlId = AddControlCallback(ControlCBFunction Callback, eOneMillisecond, (IfTypeMotors*0x100+_motorId), deviceId, Parameter );
//call the module callback
- MotorMoveModuleCallback(MotorId,BusyFlag);
+ if (MotorMoveModuleCallback[MotorId])
+ MotorMoveModuleCallback[MotorId](MotorId,BusyFlag);
}
return OK;
@@ -403,12 +415,13 @@ uint32_t MotorSetSpeedCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag) //TO
if (BusyFlag == 1)
{
//stop this control loop
- RemoveControlCallback(MotorSetSpeedControlId, MotorSetSpeedCallBackFunction );
+ RemoveControlCallback(MotorSetSpeedControlId[MotorId], MotorSetSpeedCallBackFunction );
//possibly: start regular control (speed etc)
//uint32_t ControlId = AddControlCallback(ControlCBFunction Callback, eOneMillisecond, (IfTypeMotors*0x100+_motorId), deviceId, Parameter );
//call the module callback
- MotorMoveModuleCallback(MotorId,BusyFlag);
+ if (MotorSetSpeedModuleCallback[MotorId])
+ MotorSetSpeedModuleCallback[MotorId](MotorId,BusyFlag);
}
return OK;
@@ -436,8 +449,8 @@ uint32_t MotorMoveToLimitSwitchCallBackFunction(uint32_t IfIndex, bool LimitSwit
//uint32_t ControlId = AddControlCallback(ControlCBFunction Callback, eOneMillisecond, (IfTypeMotors*0x100+_motorId), deviceId, Parameter );
//call the module callback
- if (MotorMovetoLimitSwitchCallback)
- MotorMovetoLimitSwitchCallback(MotorId,LimitSwitch);
+ if (MotorMovetoLimitSwitchCallback[MotorId])
+ MotorMovetoLimitSwitchCallback[MotorId](MotorId,LimitSwitch);
}
return OK;
@@ -455,7 +468,7 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t _motorId,bool direction, uint32_t
if (MotorMovetoLimitSwitchControlId[_motorId] != 0xFF)
return ERROR;
MotorMovetoLimitSwitchControlId[_motorId] = AddControlCallback( MotorMoveToLimitSwitchCallBackFunction, eOneMillisecond , FPGA_Read_limit_Switches,(IfTypeMotors*0x100+_motorId), LimitSwitchId, 0 );
- MotorMovetoLimitSwitchCallback = callback;
+ MotorMovetoLimitSwitchCallback[_motorId] = callback;
return MotorMoveControlId;
}
diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c
index 5013bbc16..8b375b311 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.c
@@ -18,6 +18,8 @@
#include "drivers/FPGA/FPGA_Comm.h"
#include <Drivers/Valves/Valve.h>
+#include "Modules/Control/Control.h"
+
VALVE_GPO_REG Valve_GPO_Reg;
F1_GPO_REG F1_GPO_Reg;
DISPENSER_VALVE_GPO_REG Dispenser_Valve_GPO_Reg;
@@ -41,13 +43,28 @@ typedef struct
ValveRequestStruct ValveRequest[NUM_OF_VALVES];
ValveResponseStruct ValveRsponse[NUM_OF_VALVES];
+typedef enum
+{
+ IfValvesTypeNone,
+ IfTypeMidTankToManif,
+ IfTypeCartToMidTank,
+ IfTypeWasteTank,
+ IfTypeMixchipWastech,
+ IfTypeDisopenser,
+ MAX_INTERFACE_VALVES_TYPES
+}SYSTEM_INTERFACE_VALVES_TYPES_ID_ENUM;
+
+#define Number_Of_Disopensers 8
+callback_fptr Valve3WayModuleCallback[Number_Of_Disopensers] = {0, 0, 0, 0, 0, 0, 0, 0,};
+uint32_t Valve3WayControlId[Number_Of_Disopensers] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
void Valve_Command(Valves_t Valve_Id)
{
switch(Valve_Id)
{
//Dry air Valves
- case VALVE_MIDTANK_To_MANIF_4_2:
+ case VALVE_MIDTANK_To_MANIF_4_2:
Valve_GPO_Reg.bits.MIDTANK2MANIF4_VALVE_2 = ValveRequest[Valve_Id].Direction;
break;
case VALVE_MIDTANK_To_MANIF_4_1:
@@ -139,7 +156,7 @@ void Valve_Command(Valves_t Valve_Id)
{
F1_gpo_01 |= F1_GPO_Reg.ushort;
}
- else if((Valve_Id >= VALVE_DISPENSER_1) | (Valve_Id <= VALVE_DISPENSER_8))
+ else if(/*(Valve_Id >= VALVE_DISPENSER_1) |*/ (Valve_Id <= VALVE_DISPENSER_8))
{
F2_DISPENSER_VALVE_OUT |= Dispenser_Valve_GPO_Reg.ushort;
}
@@ -162,7 +179,7 @@ void SetAllDispensersValves(bool Direction)
}
}
-void FPGA_GetDispenserValveBusyOCD()
+void FPGA_GetDispenserValveBusyOCD() // MillisecLoop
{
uint8_t i;
@@ -263,3 +280,62 @@ void EnableDisableAllDispensersValves(bool EnableOrDisable )
}
}
+
+void Valve_Set(Valves_t Valve_Id, bool Direction)
+{
+ ValveRequest[Valve_Id].Direction = Direction;
+ Valve_Command( Valve_Id);
+}
+
+//------------------------------------------------------------------------------------------------------------------------
+bool Valve3WayGetBusyState(uint32_t _ValveId, uint32_t parameter)
+{
+
+ return ValveRsponse[_ValveId].Busy;
+}
+
+//Internal handling
+uint32_t Valve3WayCallBackFunction(uint32_t IfIndex, uint32_t BusyFlag)
+{
+ uint32_t ValveId;
+ if (IfIndex>>8 != IfTypeDisopenser)
+ {
+ LOG_ERROR (IfIndex, "Wrong 3Way Valve Interface type");
+ return 0xFFFFFFFF;
+ }
+ ValveId = IfIndex&0xFF;
+
+ if (BusyFlag == NOTBUSY)
+ {
+ //stop this control loop
+ RemoveControlCallback(Valve3WayControlId[ValveId], Valve3WayCallBackFunction );
+
+ //call the module callback
+ Valve3WayModuleCallback[ValveId](ValveId,BusyFlag);
+
+ }
+ return OK;
+}
+
+//External call
+uint32_t Control3WayValvesWithCallback (Valves_t _ValveId, bool direction, callback_fptr callback) //direction: MidTank_Dispenser or Dispenser_Mixer
+{
+ uint8_t delay;
+ assert (callback);
+
+ Valve3WayModuleCallback[_ValveId] = callback;
+
+ EnableDisableDispenserValve(_ValveId, ENABLE);
+
+ for(delay=0;delay<100;delay++);//Need Small delay (0.1-1)ms
+
+ Valve_Set(_ValveId, direction);
+
+ Valve3WayControlId[_ValveId] = AddControlCallback( Valve3WayCallBackFunction, eTenMilliSecond, FPGA_GetDispenserValveBusyOCD,(IfTypeDisopenser*0x100+_ValveId), _ValveId, 0 );
+
+ EnableDisableDispenserValve(_ValveId, DISABLE);
+
+ return Valve3WayControlId[_ValveId];
+}
+
+
diff --git a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.h b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.h
index ff27b3d65..7af24aed7 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.h
+++ b/Software/Embedded_SW/Embedded/Drivers/Valves/Valve.h
@@ -11,6 +11,17 @@
typedef enum
{
+ //Dispenser Valves
+ // must be from ubdex 0-7 in order to use Valve3WayModuleCallback and Valve3WayControlId as array of 8 !
+ VALVE_DISPENSER_1,
+ VALVE_DISPENSER_2,
+ VALVE_DISPENSER_3,
+ VALVE_DISPENSER_4,
+ VALVE_DISPENSER_5,
+ VALVE_DISPENSER_6,
+ VALVE_DISPENSER_7,
+ VALVE_DISPENSER_8,
+
//Dry air Valves
VALVE_MIDTANK_To_MANIF_4_2,
VALVE_MIDTANK_To_MANIF_4_1,
@@ -35,20 +46,11 @@ typedef enum
VALVE_WASTE_TANK,
VALVE_MIXCHIP_WASTECH,
- //Dispenser Valves
- VALVE_DISPENSER_1,
- VALVE_DISPENSER_2,
- VALVE_DISPENSER_3,
- VALVE_DISPENSER_4,
- VALVE_DISPENSER_5,
- VALVE_DISPENSER_6,
- VALVE_DISPENSER_7,
- VALVE_DISPENSER_8,
-
NUM_OF_VALVES,
} Valves_t;
void Valve_Command(Valves_t Valve_Id);
+void Valve_Set(Valves_t Valve_Id, bool Direction);
void SetAllDispensersValves(bool Direction);
void FPGA_GetDispenserValveBusyOCD();// OCD - Over Current Detection
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
index 01470c3de..8ec2008a7 100644
--- a/Software/Embedded_SW/Embedded/Main.c
+++ b/Software/Embedded_SW/Embedded/Main.c
@@ -27,7 +27,6 @@
#include "drivers/twine_graphicslib/graphics_adapter.h"
#include <drivers/Flash_Memory/Flash_Memory.h>
#include <DataDef.h>
-
#include "Sys_PinOut_Config/MCU_MAIN_pinout.h"
/*
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
index 5ec7c6b16..e8779d265 100644
--- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
+++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c
@@ -23,6 +23,14 @@
#include "drivers/FPGA/FPGA.h"
#include "modules/thread/thread_ex.h"
+#include <PMR/Diagnostics/StartDiagnosticsRequest.pb-c.h>
+#include <PMR/Diagnostics/StartDiagnosticsResponse.pb-c.h>
+#include <PMR/Diagnostics/StopDiagnosticsRequest.pb-c.h>
+#include <PMR/Diagnostics/StopDiagnosticsResponse.pb-c.h>
+
+char DiagnosticsToken[36] = {0};
+bool DiagnosticsActive = false;
+
Task_Handle AlarmHandling_Task_Handle;
Mailbox_Handle AlarmHandlingMsgQ = NULL;
@@ -33,6 +41,7 @@ Mailbox_Handle AlarmHandlingMsgQ = NULL;
typedef enum
{
AlarmHandlingTrigger,
+ AlarmHandlingSendDiagnostics
}AlarmHandlingMessages;
typedef struct AlarmHandlingMessage{
@@ -44,6 +53,42 @@ typedef struct AlarmHandlingMessage{
/******************** CODE ********************************************/
//**********************************************************************
+uint32_t StartDiagnosticsRequestFunc(MessageContainer* requestContainer)
+{
+ uint32_t status = NOT_SUPPORTED;
+ //MessageContainer responseContainer;
+
+// ReportInitParams InitParams;
+
+ StartDiagnosticsRequest* request = start_diagnostics_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
+ strcpy (DiagnosticsToken, requestContainer->token);
+ DiagnosticsActive = true;
+
+ start_diagnostics_request__free_unpacked(request,NULL);
+ return status;
+}
+uint32_t StopDiagnosticsRequestFunc(MessageContainer* requestContainer)
+{
+
+ MessageContainer responseContainer;
+
+ StopDiagnosticsRequest* request = stop_diagnostics_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
+
+ StopDiagnosticsResponse response = STOP_DIAGNOSTICS_RESPONSE__INIT;
+
+ DiagnosticsActive = false;
+
+ responseContainer = createContainer(MESSAGE_TYPE__StopDiagnosticsResponse, requestContainer->token, false, &response, &stop_diagnostics_response__pack, &stop_diagnostics_response__get_packed_size);
+ responseContainer.continuous = false;
+ uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer));
+ size_t container_size = message_container__pack(&responseContainer, container_buffer);
+ free(responseContainer.data.data);
+ //USBCDCD_sendData(container_buffer, container_size,10);
+ SendChars(container_buffer, container_size);
+ //free (container_buffer);
+
+return OK;
+}
void AlarmHandlingInit(void)
{
@@ -72,11 +117,58 @@ void AlarmHandlingIterate(UArg arg0)
return ;
}
+void AlarmHandler_SendDiagnostics(void)
+{
+ AlarmHandlingMessageStruc Message;
+ //send message to the Millisec task
+ Message.messageId = AlarmHandlingSendDiagnostics;
+ Message.tick = UsersysTickGet();
+ Message.msglen = sizeof(AlarmHandlingMessageStruc);
+ if (AlarmHandlingMsgQ != NULL)
+ Mailbox_post(AlarmHandlingMsgQ , &Message, BIOS_NO_WAIT);
+
+
+ return ;
+}
uint32_t AlarmHandlingLoop(uint32_t tick)
{
return OK;
}
+void SendDiagnostics(void)
+{
+ MessageContainer responseContainer;
+
+ StartDiagnosticsResponse response = START_DIAGNOSTICS_RESPONSE__INIT;
+
+ if (DiagnosticsActive == false)
+ return;
+
+ /*DiagnosticsMonitors *monitors;
+ size_t n_digitalpins;
+ DigitalPin **digitalpins;
+ extern bool FPGA_Gpi_Buf[MAX_GPI];
+
+void Read_FPGA_GPI_Rgisters();
+bool FPGA_Read_limit_Switches(FPGA_GPI_ENUM Limit_Switch);
+
+ size_t n_componentsstates;
+ ValueComponentState **componentsstates;
+ size_t n_events;
+ Event **events;*/
+
+
+ responseContainer = createContainer(MESSAGE_TYPE__StartDiagnosticsResponse, DiagnosticsToken, false, &response, &start_diagnostics_response__pack, &start_diagnostics_response__get_packed_size);
+ responseContainer.continuous = true;
+
+ uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer));
+ size_t container_size = message_container__pack(&responseContainer, container_buffer);
+ free(responseContainer.data.data);
+ //USBCDCD_sendData(container_buffer, container_size,10);
+// SendChars(container_buffer, container_size);
+ //free (container_buffer);
+
+}
/******************************************************************************
* ======== messageTsk ========
* Task for this function is created statically. See the project's .cfg file.
@@ -99,6 +191,8 @@ void AlarmHandlingTask(UArg arg0, UArg arg1)
case AlarmHandlingTrigger:
AlarmHandlingLoop(Message.tick);
break;
+ case AlarmHandlingSendDiagnostics:
+ SendDiagnostics();
default:
break;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h
index c5eb88660..9e1be07e2 100644
--- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h
+++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.h
@@ -9,7 +9,7 @@
#define MODULES_ALARMHANDLING_ALARMHANDLING_H_
-
+void AlarmHandler_SendDiagnostics(void);
#endif /* MODULES_ALARMHANDLING_ALARMHANDLING_H_ */
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 312f970d6..67de0271f 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -16,6 +16,7 @@
///////////////////////////////////////////////////////////////////////////////////////////
#include "include.h"
#include "Modules/General/GeneralHardware.h"
+#include "Modules/AlarmHandling/AlarmHandling.h"
#include "MillisecTask.h"
#include <driverlib/timer.h>
@@ -342,6 +343,7 @@ uint32_t MillisecLoop(uint32_t tick)
{
for (Sensor_i = 0;Sensor_i < MAX_TEMPERATURE_SENSOR_ID;Sensor_i++)
MillisecReadFromTempSensor(Sensor_i, NULL);
+ AlarmHandler_SendDiagnostics();
}
if (O900Millisecond_Tick)
diff --git a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
index ff9b92ae0..b988e6238 100644
--- a/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/Heaters/Heaters_init.c
@@ -21,7 +21,6 @@
#include "include.h"
#include <driverlib/timer.h>
#include <DataDef.h>
-
#include "heaters_ex.h"
#include "heaters.h"
#include "Drivers/Heater/Heater.h"
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/StubRealTimeUsage.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/StubRealTimeUsage.c
index fbfb0ed85..ed4d44491 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/StubRealTimeUsage.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/StubRealTimeUsage.c
@@ -16,7 +16,6 @@
#include <Container.h>
#include <DataDef.h>
-
#include <PMR/Stubs/StubRealTimeUsageResponse.pb-c.h>
#include <PMR/Stubs/StubRealTimeUsageRequest.pb-c.h>
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c
index cef0e1270..ff545b516 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_Motor.c
@@ -200,7 +200,7 @@ void Stub_MotorRunRequest(MessageContainer* requestContainer)
StubMotorRunRequest* request = stub_motor_run_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
float temp = (float)request->speed;
- Run_Value = SpdCalc(temp);
+ Run_Value = /*SpdCalc*/(temp);
Direction = request->direction;
#ifdef EVALUATION_BOARD
//SPI_Control(SKIP_INIT);
@@ -214,7 +214,7 @@ void Stub_MotorRunRequest(MessageContainer* requestContainer)
#else
TimerMotors_t Motor_Id = (TimerMotors_t)request->motor_id; //to remove warning
- FPGA_GetBusy();
+ //FPGA_GetBusy();
MotorSetDirection(Motor_Id,Direction);
MotorSetSpeed(Motor_Id, Run_Value);
diff --git a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ReadEmbeddedVersion.c b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ReadEmbeddedVersion.c
index b357155ce..c10afb070 100644
--- a/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ReadEmbeddedVersion.c
+++ b/Software/Embedded_SW/Embedded/Modules/Stubs_Handler/Stub_ReadEmbeddedVersion.c
@@ -7,6 +7,7 @@
#include <Container.h>
#include <DataDef.h>
+#include <DataDef.h>
#include <PMR/Stubs/StubReadEmbeddedVersionResponse.pb-c.h>
#include <PMR/Stubs/StubReadEmbeddedVersionRequest.pb-c.h>
@@ -29,7 +30,6 @@
#include "Common/SW_Info/SW_Info.h"
-#include "DataDef.h"
void Stub_ReadEmbeddedVersionRequest(MessageContainer* requestContainer)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index e99d3df0b..3505ff3c6 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -111,7 +111,7 @@ uint32_t ScrewDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
if (BusyfirstCall)
{
BusyfirstCall = false;
- return;
+ return OK;
}
//ScrewCurrentDirection: false moves out, true moves home
if (BusyFlag == NOTBUSY)
@@ -182,7 +182,8 @@ uint32_t Winder_End(void)
{
//stop screw
ScrewNumberOfSteps = 0;
- RemoveControlCallback(ScrewControlId,ScrewDirectionChange);
+ if (ScrewControlId != 0xFF)
+ RemoveControlCallback(ScrewControlId,ScrewDirectionChange);
return MotorStop (HARDWARE_MOTOR_TYPE__MOTO_SCREW,Hard_Hiz);
}
void Winder_ScrewHomeLimitSwitchInterrupt(void)
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index 1e862128f..e3405689e 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -54,8 +54,9 @@ Mailbox_Handle JobmsgQ = NULL;
#define MAX_TICKET_SIZE 10000
-char CurrentJobBuffer[MAX_TICKET_SIZE];
-JobTicket *CurrentJob = (JobTicket *)CurrentJobBuffer;
+//char CurrentJobBuffer[MAX_TICKET_SIZE];
+JobTicket *CurrentJob = NULL;//(JobTicket *)CurrentJobBuffer;
+JobRequest *CurrentJobRequest = NULL;
//char PreviousJobBuffer[MAX_TICKET_SIZE];
//JobTicket *PreviousJob = (JobTicket *)PreviousJobBuffer;
@@ -275,6 +276,11 @@ void JobAbortFunc(MessageContainer* requestContainer)
free(responseContainer.data.data);
SendChars((char*)container_buffer, container_size);
abort_job_request__free_unpacked(request,NULL);
+ //We keep the job request until it is done
+ job_request__free_unpacked(CurrentJobRequest,NULL);
+ CurrentJob = NULL;
+ CurrentJobRequest = NULL;
+
}
@@ -286,6 +292,9 @@ void JobRequestFunc(MessageContainer* requestContainer)
uint8_t* container_buffer;
+ if (CurrentJobRequest!= NULL)
+ job_request__free_unpacked(CurrentJobRequest,NULL);
+
JobRequest* request = job_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data);
strcpy (JobToken, requestContainer->token);
@@ -298,7 +307,10 @@ void JobRequestFunc(MessageContainer* requestContainer)
}
else
{
- memcpy(CurrentJob, Ticket,TicketSize);
+ //memcpy(CurrentJob, Ticket,TicketSize);
+ CurrentJob = Ticket;
+ CurrentJobRequest = request;
+
status = PASSED;
HandleProcessParameters(Ticket->processparameters);
InternalWindingConfigMessage(Ticket->spool);
@@ -346,7 +358,8 @@ void JobRequestFunc(MessageContainer* requestContainer)
size_t container_size = message_container__pack(&responseContainer, container_buffer);
free(responseContainer.data.data);
SendChars((char*)container_buffer, container_size);
- job_request__free_unpacked(request,NULL);
+ //We keep the job request until it is done
+ // job_request__free_unpacked(request,NULL);
//free(container_buffer);
//free(requestContainer);