aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-12-23 15:24:48 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-12-23 15:24:48 +0200
commitbd9bea9c2555a86fe092d5edb725867aadc64671 (patch)
tree0326a5701a49877db5c831fe371c03766c4fde72 /Software/Embedded_SW/Embedded
parente57103400158c3cdff4983e6cdb41b194c9eee5e (diff)
parent71ea5fcc1e5bb9f671b6cd5d7507e6689cdd535c (diff)
downloadTango-bd9bea9c2555a86fe092d5edb725867aadc64671.tar.gz
Tango-bd9bea9c2555a86fe092d5edb725867aadc64671.zip
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded')
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/Utils.c12
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/Utils.h1
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/filter.c6
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/report.h2
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/reportInit.c16
-rw-r--r--Software/Embedded_SW/Embedded/Communication/Connection.c5
-rw-r--r--Software/Embedded_SW/Embedded/DataDef.h3
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c4
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c34
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.c398
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.h3
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h2
-rw-r--r--Software/Embedded_SW/Embedded/Main.c15
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c15
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IFS/ifs.c4
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IFS/ifs.h2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread.h10
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h14
-rw-r--r--Software/Embedded_SW/Embedded/Software Release Notes.txt5
-rw-r--r--Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c51
20 files changed, 527 insertions, 75 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
index d1143ada2..822294092 100644
--- a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
@@ -13,6 +13,7 @@
#include "driverlib/hibernate.h"
#include <driverlib/Watchdog.h>
#include <ti/sysbios/hal/Seconds.h>
+#include "drivers/Flash_ram/MCU_E2Prom.h"
//*****************************************************************************
@@ -137,16 +138,21 @@ void utilsInit(uint32_t ui32SysClock)
//
// HibernateCounterMode(HIBERNATE_COUNTER_24HR);
// Configure the hibernate module counter to RTC counter mode.
- HibernateCounterMode(HIBERNATE_COUNTER_RTC);
+ HibernateCounterMode(HIBERNATE_COUNTER_24HR);
-#define STARTTIME 1564403262
- Seconds_set(STARTTIME);
+//#define STARTTIME 1564403262
+// Seconds_set(STARTTIME);
}
void utilsUpdateDateTime(uint32_t StartTime)
{
Seconds_set(StartTime);
}
+void utilsStoreLocalTime()
+{
+ time_t time_store = umktime(&LocalTime);
+ MCU_E2PromProgram(EEPROM_LOCAL_TIME,time_store);
+}
uint32_t UsersysTickGet (void) {
uint32_t tick = 0;
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.h b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.h
index b54453e2c..779534182 100644
--- a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.h
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.h
@@ -23,6 +23,7 @@ typedef enum
void utilsInit(uint32_t ui32SysClock);
void utilsUpdateDateTime(uint32_t StartTime);
+void utilsStoreLocalTime(void);
uint32_t UsersysTickGet (void);
bool DanserCheckPosition(uint16_t position , Danser_t danser, bool test);
void InitWatchdog(uint32_t clock);
diff --git a/Software/Embedded_SW/Embedded/Common/report/filter.c b/Software/Embedded_SW/Embedded/Common/report/filter.c
index 753123ee7..78e0ef7eb 100644
--- a/Software/Embedded_SW/Embedded/Common/report/filter.c
+++ b/Software/Embedded_SW/Embedded/Common/report/filter.c
@@ -333,7 +333,13 @@ void ReportSeveritySet(ErrorSeverity level)
SeverityLevel = level;
}
+uint32_t safeReport(char *message, char *FileName, int LineNumber,int errorCode,int Severity,int parameter1,int parameter2)
+{
+ if (isReportActive() == false)
+ return OK;
+ return (Report(message, FileName, LineNumber, errorCode, Severity, parameter1, parameter2));
+}
/***************************************************************************
*
* Name : Report
diff --git a/Software/Embedded_SW/Embedded/Common/report/report.h b/Software/Embedded_SW/Embedded/Common/report/report.h
index 84063fb0f..94017ff20 100644
--- a/Software/Embedded_SW/Embedded/Common/report/report.h
+++ b/Software/Embedded_SW/Embedded/Common/report/report.h
@@ -131,6 +131,8 @@ uint32_t OpenLogFile(void);
uint32_t CloseLogFile(void);
bool isReportActive(void);
uint32_t LogToFile(char *message, char *FileName, int LineNumber,int errorCode,int Severity,int parameter);
+uint32_t safeReport(char *message, char *FileName, int LineNumber,int errorCode,int Severity,int parameter1,int parameter2);
+
/***************************************************************************
diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c
index 8292cdeda..4b056b0d8 100644
--- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c
+++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c
@@ -101,7 +101,7 @@ uint32_t OpenLogFile(void)
f_lseek(LogFileHandle, 0);
f_truncate (LogFileHandle);
}
- len = usnprintf(RepMessage, 80, "\r\n*******\r\nLog File start %s %s",__DATE__, __TIME__);
+ len = usnprintf(RepMessage, 80, "\r\n*******\r\nLog File start %d/%d/%d %d:%d:%d",LocalTime.tm_mday,LocalTime.tm_mon+1,LocalTime.tm_year,LocalTime.tm_hour,LocalTime.tm_min,LocalTime.tm_sec);
LogFresult = f_write(LogFileHandle,RepMessage,len,&Bytes );
ReportResetReason();
}
@@ -110,8 +110,9 @@ uint32_t OpenLogFile(void)
LogFresult = FR_INT_ERR;
return LogFresult;
-#endif
+#else
return OK;
+#endif
}
uint32_t CloseLogFile(void)
{
@@ -119,13 +120,14 @@ uint32_t CloseLogFile(void)
#ifdef STORE_DEBUG_LOGS
int len;
uint32_t Bytes = 0;
- len = usnprintf(RepMessage, 80, "Closing Log File %s %s",__DATE__, __TIME__);
+ len = usnprintf(RepMessage, 80, "\r\n*******\r\nClosing Log File %d/%d/%d %d:%d:%d",LocalTime.tm_mday,LocalTime.tm_mon+1,LocalTime.tm_year,LocalTime.tm_hour,LocalTime.tm_min,LocalTime.tm_sec);
LogFresult = f_write(LogFileHandle,RepMessage,len,&Bytes );
LogFresult = f_close(LogFileHandle);
LogFileHandle = NULL;
return LogFresult;
-#endif
+#else
return OK;
+#endif
}
uint32_t LogToFile(char *message, /* The formatted message */
@@ -143,13 +145,13 @@ uint32_t LogToFile(char *message, /* The formatted message
if (LogFileHandle == NULL)
return OK;
- len = usnprintf(RepMessage, 300, "\r\nfile %s\t line %d\t code %d\t sev %d,\tparam %d,\t %s",FileName, LineNumber,errorCode, Severity, parameter,message);
+ len = usnprintf(RepMessage, 300, "\r\n %d:%d:%d %s ,file %s\t line %d\t code %d\t sev %d,\tparam %d",LocalTime.tm_hour,LocalTime.tm_min,LocalTime.tm_sec,message,FileName, LineNumber,errorCode, Severity, parameter);
LogFresult = f_write(LogFileHandle,RepMessage,len,&Bytes );
return LogFresult;
-#endif
+#else
return OK;
-
+#endif
}
int ReportResponseFunc(char *message, /* The formatted message */
char *FileName,
diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c
index 5396938fd..ec15c1596 100644
--- a/Software/Embedded_SW/Embedded/Communication/Connection.c
+++ b/Software/Embedded_SW/Embedded/Communication/Connection.c
@@ -24,6 +24,7 @@
#include <utils/ustdlib.h>
#include "drivers/FPGA/FPGA.h"
#include "Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
+#include "driverlib/hibernate.h"
#include "StateMachines/Printing/PrintingSTM.h"
#include "StateMachines/Initialization/InitSequence.h"
@@ -100,8 +101,8 @@ void ConnectionRequest(MessageContainer* requestContainer)
if (request->has_unixtime)
utilsUpdateDateTime(request->unixtime);//(request->seconds);
ulocaltime(request->unixtime, &LocalTime);
- LocalTime.tm_mon +=1;//since we get from ulocaltime Months since January - [0,11]
-
+ HibernateCalendarSet(&LocalTime);
+ ReportWithPackageFilter(ThreadFilter,"Set Time: ",__FILE__,LocalTime.tm_hour,LocalTime.tm_min,RpWarning,(int) LocalTime.tm_sec,0);
LocalTimeToAScii();
StopRecurringReports();
/*
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h
index 001303c88..3115f6828 100644
--- a/Software/Embedded_SW/Embedded/DataDef.h
+++ b/Software/Embedded_SW/Embedded/DataDef.h
@@ -169,6 +169,7 @@ typedef enum
#define LOW 0x0
#define HIGH 0x1
#define LOW_AND_HIGH 0x2
+#define HIGHEST 0x3
#define WR 0
#define RD 1
@@ -330,6 +331,8 @@ typedef enum
#define BIT30 0x40000000 //0x01 << 30
#define BIT31 0x80000000 //0x01 << 31
+extern struct tm LocalTime;//Months since January - [0,11]
+
//LocalTimeInAScii
typedef union
{
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 c37bbc437..741f0bab3 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
@@ -18,6 +18,7 @@
#include "Drivers/I2C_Communication/Head_Card/IO_Ports/Head_IO.h"
#include <Drivers/I2C_Communication/I2C_Task.h>
+#include <Utilities/utils.h>
#include <Utilities/delay.h>
FPGA_GPI FPGA_Gpi;
@@ -487,9 +488,9 @@ uint32_t DeActivateCleanerPump()
return OK;
}
//----------------------------------
-
void Power_Off()//Power Down
{
+ utilsStoreLocalTime();
#ifdef WATCHDOG
ROM_WatchdogResetDisable(WATCHDOG0_BASE);
#endif
@@ -499,6 +500,7 @@ void Power_Off()//Power Down
void Power_Reset()// Resets the MCU
{
+ utilsStoreLocalTime();
F3_SW_RESET_reg &= ~BIT0;
SysCtlDelay(1000);
F3_SW_RESET_reg |= BIT0;
diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c
index 632dfb0d5..5140b8202 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/FATFS/ff.c
@@ -898,7 +898,7 @@ FRESULT put_fat (
if (clst < 2 || clst >= fs->n_fatent) { /* Check range */
{
res = FR_INT_ERR;
- Report("put_fat FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->n_fatent,0);
+ safeReport("put_fat FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->n_fatent,0);
}
} else {
@@ -934,7 +934,7 @@ FRESULT put_fat (
default :
res = FR_INT_ERR;
- Report("put_fat FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->fs_type,0);
+ safeReport("put_fat FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->fs_type,0);
}
fs->wflag = 1;
@@ -965,7 +965,7 @@ FRESULT remove_chain (
if (clst < 2 || clst >= fs->n_fatent) { /* Check range */
res = FR_INT_ERR;
- Report("remove_chain FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->n_fatent,0);
+ safeReport("remove_chain FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fs->n_fatent,0);
} else {
res = FR_OK;
while (clst < fs->n_fatent) { /* Not a last link? */
@@ -973,7 +973,7 @@ FRESULT remove_chain (
if (nxt == 0) break; /* Empty cluster? */
if (nxt == 1) {
res = FR_INT_ERR;
- Report("remove_chain FR_INT_ERR",__FILE__,__LINE__,(int)res,RpWarning,(int)fs->n_fatent,0);
+ safeReport("remove_chain FR_INT_ERR",__FILE__,__LINE__,(int)res,RpWarning,(int)fs->n_fatent,0);
break; } /* Internal error? */
if (nxt == 0xFFFFFFFF) { res = FR_DISK_ERR; break; } /* Disk error? */
res = put_fat(fs, clst, 0); /* Mark the cluster "empty" */
@@ -1108,7 +1108,7 @@ FRESULT dir_sdi (
clst = dj->sclust;
if (clst == 1 || clst >= dj->fs->n_fatent) /* Check start cluster range */
{
- Report("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)dj->fs->n_fatent,0);
+ safeReport("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)dj->fs->n_fatent,0);
return FR_INT_ERR;
}
if (!clst && dj->fs->fs_type == FS_FAT32) /* Replace cluster# 0 with root cluster# if in FAT32 */
@@ -1118,7 +1118,7 @@ FRESULT dir_sdi (
dj->clust = clst;
if (idx >= dj->fs->n_rootdir) /* Index is out of range */
{
- Report("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)idx,RpWarning,(int)dj->fs->n_rootdir,0);
+ safeReport("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)idx,RpWarning,(int)dj->fs->n_rootdir,0);
return FR_INT_ERR;
}
dj->sect = dj->fs->dirbase + idx / (SS(dj->fs) / SZ_DIR); /* Sector# */
@@ -1130,7 +1130,7 @@ FRESULT dir_sdi (
if (clst == 0xFFFFFFFF) return FR_DISK_ERR; /* Disk error */
if (clst < 2 || clst >= dj->fs->n_fatent) /* Reached to end of table or int error */
{
- Report("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)dj->fs->n_fatent,0);
+ safeReport("dir_sdi FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)dj->fs->n_fatent,0);
return FR_INT_ERR;
}
idx -= ic;
@@ -2578,7 +2578,7 @@ FRESULT f_write (
if (res != FR_OK) LEAVE_FF(fp->fs, res);
if (fp->flag & FA__ERROR) /* Aborted file? */
{
- Report("f_write FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)btw,0);
+ safeReport("f_write FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)btw,0);
LEAVE_FF(fp->fs, FR_INT_ERR);
}
if (!(fp->flag & FA_WRITE)) /* Check access mode */
@@ -2620,7 +2620,7 @@ FRESULT f_write (
sect = clust2sect(fp->fs, fp->clust); /* Get current sector */
if (!sect)
{
- Report("f_write FR_INT_ERR",__FILE__,__LINE__,(int)sect,RpWarning,(int)btw,0);
+ safeReport("f_write FR_INT_ERR",__FILE__,__LINE__,(int)sect,RpWarning,(int)btw,0);
ABORT(fp->fs, FR_INT_ERR);
}
sect += csect;
@@ -2913,7 +2913,7 @@ FRESULT f_lseek (
if (res != FR_OK) LEAVE_FF(fp->fs, res);
if (fp->flag & FA__ERROR) /* Check abort flag */
{
- Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)FA__ERROR,0);
+ safeReport("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)FA__ERROR,0);
LEAVE_FF(fp->fs, FR_INT_ERR);
}
@@ -3000,7 +3000,7 @@ FRESULT f_lseek (
clst = create_chain(fp->fs, 0);
if (clst == 1)
{
- Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)FA__ERROR,0);
+ safeReport("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)FA__ERROR,0);
ABORT(fp->fs, FR_INT_ERR);
}
if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
@@ -3023,7 +3023,7 @@ FRESULT f_lseek (
if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
if (clst <= 1 || clst >= fp->fs->n_fatent)
{
- Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fp->fs->n_fatent,0);
+ safeReport("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)clst,RpWarning,(int)fp->fs->n_fatent,0);
ABORT(fp->fs, FR_INT_ERR);
}
fp->clust = clst;
@@ -3035,7 +3035,7 @@ FRESULT f_lseek (
nsect = clust2sect(fp->fs, clst); /* Current sector */
if (!nsect)
{
- Report("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)nsect,RpWarning,(int)0,0);
+ safeReport("f_lseek FR_INT_ERR",__FILE__,__LINE__,(int)nsect,RpWarning,(int)0,0);
ABORT(fp->fs, FR_INT_ERR);
}
nsect += ofs / SS(fp->fs);
@@ -3227,7 +3227,7 @@ FRESULT f_getfree (
if (stat == 0xFFFFFFFF) { res = FR_DISK_ERR; break; }
if (stat == 1)
{
- Report("f_getfree FR_INT_ERR",__FILE__,__LINE__,(int)stat,RpWarning,(int)0,0);
+ safeReport("f_getfree FR_INT_ERR",__FILE__,__LINE__,(int)stat,RpWarning,(int)0,0);
res = FR_INT_ERR; break; }
if (stat == 0) n++;
} while (++clst < fs->n_fatent);
@@ -3277,7 +3277,7 @@ FRESULT f_truncate (
res = validate(fp); /* Check validity of the object */
if (res == FR_OK) {
if (fp->flag & FA__ERROR) { /* Check abort flag */
- Report("f_truncate FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)0,0);
+ safeReport("f_truncate FR_INT_ERR",__FILE__,__LINE__,(int)fp->flag,RpWarning,(int)0,0);
res = FR_INT_ERR;
} else {
if (!(fp->flag & FA_WRITE)) /* Check access mode */
@@ -3297,7 +3297,7 @@ FRESULT f_truncate (
if (ncl == 0xFFFFFFFF) res = FR_DISK_ERR;
if (ncl == 1)
{
- Report("f_truncate FR_INT_ERR",__FILE__,__LINE__,(int)ncl,RpWarning,(int)0,0);
+ safeReport("f_truncate FR_INT_ERR",__FILE__,__LINE__,(int)ncl,RpWarning,(int)0,0);
res = FR_INT_ERR;
}
if (res == FR_OK && ncl < fp->fs->n_fatent) {
@@ -3350,7 +3350,7 @@ FRESULT f_unlink (
dclst = ld_clust(dj.fs, dir);
if (res == FR_OK && (dir[DIR_Attr] & AM_DIR)) { /* Is it a sub-dir? */
if (dclst < 2) {
- Report("f_unlink FR_INT_ERR",__FILE__,__LINE__,(int)dclst,RpWarning,(int)0,0);
+ safeReport("f_unlink FR_INT_ERR",__FILE__,__LINE__,(int)dclst,RpWarning,(int)0,0);
res = FR_INT_ERR;
} else {
mem_cpy(&sdj, &dj, sizeof (DIR)); /* Check if the sub-dir is empty or not */
diff --git a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.c b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.c
index 92337080d..118891a39 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.c
+++ b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.c
@@ -40,6 +40,9 @@ static uint32_t GlobalClk;
uint8_t BTSR_RX_Buff[Max_BTSR_RX_Bytes];
uint16_t TX_Timeout = 0xFFFF;//6250
uint16_t RX_Timeout = 0xFFFF;//1
+float BTSR_Length = 0;
+
+#define BTSR_RADIUS 3 //TBD ?
typedef enum
{
@@ -366,6 +369,7 @@ uint8_t Check_Received_CheckSum(uint8_t CODE_STRING, uint8_t Function_Code, uint
(Buf[size_include_Checksum - 1] != (Sum >> 8)) )
{
Status = ERROR;
+ ReportWithPackageFilter(ThreadFilter,"BTSR Get Wrong Checksum",__FILE__,__LINE__,(int)CODE_STRING,RpError,(int)Function_Code,0);
}
}
return Status;
@@ -646,11 +650,94 @@ typedef struct
typedef union
{
- BITS Bit[4];
- uint8_t Byte[4];
+ BITS Bit[6];
+ uint8_t Byte[6];
}BTSR_ALARM_AND_ENABLING_STATUS_READ;
+
+typedef union
+{
+ struct
+ {
+ uint8_t SW_VERSION;//0XDE
+ uint8_t SW_UNDER_VERSION;//0X01
+ uint8_t BYTE_U0X55;//0X55
+ uint8_t BYTE_F0X46;//0X46
+ uint8_t PRODUCT_CODE;//0X13
+ uint8_t TENSION_SENSOR_END_SCALE;//0X65
+ uint8_t BOARD_HW_VERSION;//0X02
+ uint8_t BOOTLOADER_SW_VERSION;//0X0A
+ uint8_t BYTE_0X32;//0X32
+ uint8_t SPARE;//0X00
+ uint8_t CHECKSUM_LSB;//0X60
+ uint8_t CHECKSUM_MSB;//0X01
+ }Byte;
+uint8_t Buf[12];
+}BTSR_DEVICE_INFORMATION_READ;
+
+
BTSR_ALARM_AND_ENABLING_STATUS_READ BTSR_Status;
+BTSR_DEVICE_INFORMATION_READ BTSR_Info;
+
+typedef union
+{
+ struct
+ {
+ uint8_t CODE_STRING ;
+ uint8_t FUNCTION_STRING;
+
+ //DATA_STRING
+ uint16_t WORK_TENSION ;//1° - 2°
+ uint16_t OUTPUT_TENSION;//3° - 4°
+ uint16_t RELAX_YARN ;//5° - 6°
+ uint8_t INC_DEC_TENSION;//7°
+ uint8_t INC_DEC_STRETCH;//8°
+ uint16_t TENSION_ERROR ;//9° - 10°
+ uint16_t TIME_ALARM ;//11° - 12°
+ uint8_t RELAX_SPEED ;//13°
+ uint8_t APPLICATION ;//14°
+ uint8_t YARN_TYPE ;//15°
+ uint8_t SPARE[4] ;//16°
+ uint8_t ALARM_ENABLING ;//20°
+ uint8_t ABILITAZIONE ;//21°
+
+ uint16_t CHECKSUM ;
+ }Byte;
+uint8_t Buf[25];
+}BTSR_ADVANCED_STYLE_LOAD;
+
+BTSR_ADVANCED_STYLE_LOAD BTSR_AdvStyle_Load;
+
+typedef union
+{
+ struct
+ {
+ uint8_t CODE_STRING ;
+ uint8_t FUNCTION_STRING ;
+
+ //DATA_STRING
+ uint16_t OUTPUT_TENSION ;
+ uint16_t WORK_TENSION ;
+ uint16_t RELAX_YARN ;
+ uint8_t INC_DEC_TENSION ;
+ uint8_t INC_DEC_STRETCH ;
+ uint32_t METER_START ;
+ uint32_t INC_DEC_METER ;
+ uint32_t TARGET ;
+ uint16_t TENSION_ERROR ;
+ uint16_t ALARM_TIME ;
+ uint8_t SPARE1[2] ;
+ uint8_t ALARM_ENABLING ;
+ uint8_t TARGET_ENABLING ;
+ uint8_t RELAX_YARN_SPEED;
+ uint8_t SPARE2[6] ;
+
+ uint16_t CHECKSUM ;
+ }Byte;
+uint8_t Buf[39];
+}BTSR_ADVANCED_TENSION_PROGRAMMING;
+
+BTSR_ADVANCED_TENSION_PROGRAMMING BTSR_Adv_Tension_Prog;
void BTSR_Configuration_Set(uint8_t UFeeder_ID)
{
@@ -664,11 +751,178 @@ void BTSR_Configuration_Set(uint8_t UFeeder_ID)
BTSR_Calculate_CheckSum(BTSR_TX_Buff,18);
- BTSR_Send_Buf(Typology_Set.Buf, 20);
+ BTSR_Send_Buf(BTSR_TX_Buff, 20);
}
-void BTSR_Alarm_and_Enabling_Status_Read(uint8_t UFeeder_ID)
+void BTSR_Advanced_Style_Load(uint8_t UFeeder_ID, uint16_t Tension, uint16_t Tension_Error, uint16_t Time_Alarm, BTSR_APPLICATION Application, BTSR_YARN_TYPE YarnType )
+{
+ //memset(BTSR_AdvStyle_Load.Buf, 0, Size);
+ /*
+ uint8_t Size = sizeof(BTSR_AdvStyle_Load.Buf);
+
+ memset(BTSR_AdvStyle_Load.Buf, 0, Size);
+/
+ BTSR_AdvStyle_Load.Byte.CODE_STRING = UFeeder_ID;
+ BTSR_AdvStyle_Load.Byte.FUNCTION_STRING = 0x4B;
+
+ BTSR_AdvStyle_Load.Byte.WORK_TENSION = Tension;
+ BTSR_AdvStyle_Load.Byte.TENSION_ERROR = Tension_Error;
+ BTSR_AdvStyle_Load.Byte.TIME_ALARM = Time_Alarm;
+ BTSR_AdvStyle_Load.Byte.APPLICATION = Application;
+ BTSR_AdvStyle_Load.Byte.YARN_TYPE = YarnType;
+ BTSR_AdvStyle_Load.Byte.ALARM_ENABLING = 0x03; // OUTPUT TENSION ENABLED + TENSION ERROR ENABLED
+*/
+ //BTSR_Calculate_CheckSum(BTSR_AdvStyle_Load.Buf,Size - 2);
+
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+ BTSR_TX_Buff[1] = 0x4B;
+
+ BTSR_TX_Buff[2] = 0xCD;//1
+ BTSR_TX_Buff[3] = 0x00;//2
+
+ BTSR_TX_Buff[10] = 0x02;//9
+ BTSR_TX_Buff[11] = 0x00;//10
+ BTSR_TX_Buff[12] = 0x04;//11
+ BTSR_TX_Buff[13] = 0x00;//12
+
+
+ BTSR_TX_Buff[15] = FLAT_KNIT;//14
+ BTSR_TX_Buff[16] = ALL_YARNS2;//15
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,23);
+
+ BTSR_Send_Buf(BTSR_TX_Buff,25);
+
+}
+
+void BTSR_Advanced_Tension_Prog(uint8_t UFeeder_ID, uint16_t Tension, uint16_t Tension_Error, uint16_t Time_Alarm )
+{
+
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+ BTSR_TX_Buff[1] = 0x39;
+
+ BTSR_TX_Buff[4] = Tension & 0XFF;//3
+ BTSR_TX_Buff[5] = Tension >> 8;//4
+
+ BTSR_TX_Buff[22] = Tension_Error & 0XFF;//21
+ BTSR_TX_Buff[23] = Tension_Error >> 8;//22
+
+ BTSR_TX_Buff[24] = Time_Alarm & 0XFF;//23
+ BTSR_TX_Buff[25] = Time_Alarm >> 8;//24
+
+ BTSR_TX_Buff[28] = 0x01;//27 ‘1’ TENSION ERROR ENABLED
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,37);
+
+ BTSR_Send_Buf(BTSR_TX_Buff,39);
+}
+
+void BTSR_Application_Yarn_Type_Set(uint8_t BTSR_Id, BTSR_APPLICATION Application, BTSR_YARN_TYPE Yarn_Type )
+{
+ //APPLICATION_AND_YARN_TYPOLOGY_SET_27
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = BTSR_Id;
+ BTSR_TX_Buff[1] = 0x3F;
+ BTSR_TX_Buff[2] = Application;
+ BTSR_TX_Buff[3] = Yarn_Type;
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,4);
+
+ BTSR_Send_Buf(BTSR_TX_Buff, 6);
+}
+
+
+void BTSR_Status_Reset(uint8_t UFeeder_ID)//35
+{
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+ BTSR_TX_Buff[1] = 0x27;
+ BTSR_TX_Buff[2] = 0x07;//RESET_0
+ BTSR_TX_Buff[3] = 0x00;//RESET_1
+ BTSR_TX_Buff[4] = 0x00;//SPARE
+ BTSR_TX_Buff[4] = 0x00;//SPARE
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,6);
+
+ BTSR_Send_Buf(BTSR_TX_Buff, 8);
+
+}
+
+void BTSR_Errors_Counter_Reset(uint8_t UFeeder_ID)//36
+{
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+ BTSR_TX_Buff[1] = 0x29;
+ BTSR_TX_Buff[2] = 0x00;//00 - RESETS ALL THE COUNTERS
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,3);
+
+ BTSR_Send_Buf(BTSR_TX_Buff, 5);
+
+}
+
+void BTSR_Meters_Total_Counter_Reset(uint8_t UFeeder_ID , uint8_t Resolution)//37/39/41
+{
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+
+ if(Resolution == LOW)
+ BTSR_TX_Buff[1] = 0x06;
+ else
+ if(Resolution == HIGH)
+ BTSR_TX_Buff[1] = 0x1E;
+ else
+ if(Resolution == HIGHEST)
+ BTSR_TX_Buff[1] = 0x48;
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,2);
+
+ BTSR_Send_Buf(BTSR_TX_Buff, 4);
+}
+
+void BTSR_Info_Read(uint8_t UFeeder_ID)
+{
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+ BTSR_TX_Buff[1] = 0x3E;
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,2);
+
+ BTSR_Send_Buf(BTSR_TX_Buff, 4);
+
+}
+
+void BTSR_Meters_Total_Counter_Read(uint8_t UFeeder_ID , uint8_t Resolution)//37/39/41
+{
+ memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
+
+ BTSR_TX_Buff[0] = UFeeder_ID;
+
+ if(Resolution == LOW)
+ BTSR_TX_Buff[1] = 0x16;
+ else
+ if(Resolution == HIGH)
+ BTSR_TX_Buff[1] = 0x1D;
+ else
+ if(Resolution == HIGHEST)
+ BTSR_TX_Buff[1] = 0x47;
+
+ BTSR_Calculate_CheckSum(BTSR_TX_Buff,2);
+
+ BTSR_Send_Buf(BTSR_TX_Buff, 4);
+}
+
+void BTSR_Alarm_and_Enabling_Status_Read(uint8_t UFeeder_ID)//30
{
memset(BTSR_TX_Buff, 0, Max_BTSR_TX_Bytes);
@@ -677,7 +931,7 @@ void BTSR_Alarm_and_Enabling_Status_Read(uint8_t UFeeder_ID)
BTSR_Calculate_CheckSum(BTSR_TX_Buff,2);
- BTSR_Send_Buf(Typology_Set.Buf, 4);
+ BTSR_Send_Buf(BTSR_TX_Buff, 4);
}
typedef enum
@@ -715,24 +969,39 @@ typedef enum
MAX_BTSR_SET
}BTSR_CMD;
+typedef union
+{
+ struct
+ {
+ uint32_t Uint32;
+ uint16_t CheckSum;
+ }Data;
+ uint8_t Buf[6];
+}BTSR_METERS;
+
+BTSR_METERS BTSR_Meters;
+
+
#define Get_Set_resp 5
#define Set_Command 6
#define Get_Read_resp 7
#define Read_Command 8
-BTSR_CMD BTSR_command_Stage[MAX_BTSR_SET];
+uint8_t BTSR_command_Stage[MAX_BTSR_SET];
uint8_t BTSR_State_Machine(uint8_t UFeeder_ID)
{
uint8_t status = OK;
- uint8_t i;
+ uint8_t i,j;
+
+ //BTSR_Init();
for(i = DEVICE_CALIBRATION_11; i < MAX_BTSR_SET; i++)
{
if(BTSR_command_Stage[i] == Get_Set_resp)
{
- if((i >= DEVICE_CALIBRATION_11) && (i <= RESETS_ALL_THE_COUNTERS_36) /*&& (BTSR_RX_Buff[0] != BTSR_RISP_OK)*/)
+ if((i >= DEVICE_CALIBRATION_11) && (i <= RESETS_ALL_THE_COUNTERS_36) && (BTSR_RX_Buff[0] != BTSR_RISP_OK))
{
status = ERROR;
BTSR_command_Stage[i] = BTSR_RX_Buff[0];
@@ -746,17 +1015,39 @@ uint8_t BTSR_State_Machine(uint8_t UFeeder_ID)
BTSR_command_Stage[i] = BTSR_RX_Buff[1];
//print response + command ID
}
- //print response + command ID
- BTSR_command_Stage[i] = OK;
+ else//print response + command ID
+ BTSR_command_Stage[i] = BTSR_RX_Buff[0];//OK;
}
if(BTSR_command_Stage[i] == Set_Command)
{
- if(i == CONFIGURATION_SET_15)
+ switch(i)
{
- BTSR_Configuration_Set(UFeeder_ID);
+ case CONFIGURATION_SET_15:
+ BTSR_Configuration_Set(UFeeder_ID);
+ break;
+ case ADVANCED_TENSION_PROGRAMMING_21:
+ BTSR_Advanced_Tension_Prog(0x01, 0x0101, 0x0101, 0x0101 );
+ break;
+ case APPLICATION_AND_YARN_TYPOLOGY_SET_27:
+ BTSR_Application_Yarn_Type_Set(0x01, SHOES, ELASTIC2 );
+ break;
+ case ALARM_STATUS_RESET_35:
+ BTSR_Status_Reset(0x01);
+ break;
+ case RESETS_ALL_THE_COUNTERS_36:
+ BTSR_Errors_Counter_Reset(0x01);
+ break;
+ case METERS_TOTAL_COUNTER_RESET_LOW_38:
+ BTSR_Meters_Total_Counter_Reset(UFeeder_ID, LOW);
+ break;
+ case METERS_TOTAL_COUNTER_RESET_HIGH_40:
+ BTSR_Meters_Total_Counter_Reset(UFeeder_ID, HIGH);
+ break;
+ case METERS_TOTAL_COUNTER_RESET_HIGHEST_42:
+ BTSR_Meters_Total_Counter_Reset(UFeeder_ID, HIGHEST);
+ break;
}
-
BTSR_command_Stage[i] = Get_Set_resp;
return status;//Only one command in cycle
}
@@ -770,19 +1061,56 @@ uint8_t BTSR_State_Machine(uint8_t UFeeder_ID)
// Add CRC check
if(i == ALARM_AND_ENABLING_STATUS_READ_30)
{
- for(i = 0; i < 4; i++)
- BTSR_Status.Byte[i] = BTSR_RX_Buff[i];
+ for(j = 0; j < 6; j++)
+ BTSR_Status.Byte[j] = BTSR_RX_Buff[j];
}
+ else
+ if(i == DEVICE_INFORMATION_READ_10)
+ {
+ for(j = 0; j < 20; j++)
+ BTSR_Info.Buf[j] = BTSR_RX_Buff[j];
+ status |= Check_Received_CheckSum(UFeeder_ID, 0x3E, BTSR_Info.Buf, 20);
+ ReportWithPackageFilter(ThreadFilter,"BTSR VERSION",__FILE__,UFeeder_ID,(BTSR_Info.Byte.BOARD_HW_VERSION << 8) | BTSR_Info.Byte.BOOTLOADER_SW_VERSION,RpMessage,(BTSR_Info.Byte.SW_VERSION << 8) | BTSR_Info.Byte.SW_UNDER_VERSION,0);
+ }
+ if((i == METERS_TOTAL_COUNTER_READ_LOW_37) || (i == METERS_TOTAL_COUNTER_READ_HIGH_39) || (i == METER_TOTAL_COUNTER_READ_HIGHEST_41))
+ {
+ for(j = 0; j < 6; j++)
+ BTSR_Meters.Buf[j] = BTSR_RX_Buff[j];
+ status |= Check_Received_CheckSum(UFeeder_ID, 0x16, BTSR_Meters.Buf, 6);
+
+ BTSR_Length = (float)(BTSR_Meters.Data.Uint32) * PI * BTSR_RADIUS;
+ if(i == METERS_TOTAL_COUNTER_READ_HIGH_39)
+ BTSR_Length/=12.0;
+ else
+ if(i == METER_TOTAL_COUNTER_READ_HIGHEST_41)
+ BTSR_Length/=750.0;
+ }
+
+ memset(BTSR_RX_Buff, 0, Max_BTSR_RX_Bytes);
BTSR_command_Stage[i] = 0;
}
if(BTSR_command_Stage[i] == Read_Command)
{
-
- if(i == ALARM_AND_ENABLING_STATUS_READ_30)
+ switch(i)
{
- BTSR_Alarm_and_Enabling_Status_Read(UFeeder_ID);
+ case ALARM_AND_ENABLING_STATUS_READ_30:
+ BTSR_Alarm_and_Enabling_Status_Read(UFeeder_ID);
+ break;
+ case DEVICE_INFORMATION_READ_10:
+ BTSR_Info_Read(UFeeder_ID);
+ break;
+ case METERS_TOTAL_COUNTER_READ_LOW_37:
+ BTSR_Meters_Total_Counter_Read(UFeeder_ID, LOW);
+ break;
+ case METERS_TOTAL_COUNTER_READ_HIGH_39:
+ BTSR_Meters_Total_Counter_Read(UFeeder_ID, HIGH);
+ break;
+ case METER_TOTAL_COUNTER_READ_HIGHEST_41:
+ BTSR_Meters_Total_Counter_Read(UFeeder_ID, HIGHEST);
+ break;
}
+
BTSR_command_Stage[i] = Get_Read_resp;
return status;//Only one command in cycle
}
@@ -791,3 +1119,37 @@ uint8_t BTSR_State_Machine(uint8_t UFeeder_ID)
return status;
}
+
+void BTSR_Init()
+{
+ //if( BTSR_command_Stage[CONFIGURATION_SET_15] == 0)
+ BTSR_command_Stage[CONFIGURATION_SET_15] = Set_Command;
+ BTSR_command_Stage[DEVICE_INFORMATION_READ_10] = Read_Command;
+
+ /////////////////////////////////////// test ////////////////////////
+
+ BTSR_command_Stage[ADVANCED_TENSION_PROGRAMMING_21] = Set_Command;//test
+
+ BTSR_command_Stage[APPLICATION_AND_YARN_TYPOLOGY_SET_27] = Set_Command;//test
+
+ //if( BTSR_command_Stage[ALARM_AND_ENABLING_STATUS_READ_30] == 0)
+ BTSR_command_Stage[ALARM_AND_ENABLING_STATUS_READ_30] = Read_Command;
+
+ BTSR_command_Stage[ALARM_STATUS_RESET_35] = Set_Command;//test
+
+ BTSR_command_Stage[RESETS_ALL_THE_COUNTERS_36] = Set_Command;//test
+
+ BTSR_command_Stage[METER_TOTAL_COUNTER_READ_HIGHEST_41] = Set_Command;//test
+
+ BTSR_command_Stage[METERS_TOTAL_COUNTER_RESET_HIGHEST_42] = Set_Command;//test
+}
+
+
+
+//void BTSR_Test()
+//{
+// BTSR_Advanced_Style_Load(0x01, 0xABCD, 0x0102, 0x0304, FLAT_KNIT, ALL_YARNS2 );
+//}
+
+
+
diff --git a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.h b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.h
index 14fda8f19..398c3cf25 100644
--- a/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.h
+++ b/Software/Embedded_SW/Embedded/Drivers/Uart_Comm/BTSR/BTSR.h
@@ -62,4 +62,7 @@ uint8_t Check_Received_CheckSum(uint8_t CODE_STRING, uint8_t Function_Code, uint
uint8_t BTSR_Send_Buf_3xADD1(uint8_t *Buf, uint8_t size);//Only for commands with 3 bytes with Address 1 (0x06/0xFD)
void InitConsole_BTSR_UART4(int32_t ui32SysClock);
+uint8_t BTSR_State_Machine(uint8_t UFeeder_ID);
+void BTSR_Init();
+
#endif /* DRIVERS_UART_COMM_BTSR_BTSR_H_ */
diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h
index 2102d1716..aee812973 100644
--- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h
+++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/MCU_E2Prom.h
@@ -38,7 +38,7 @@ typedef enum {
EEPROM_ALARM_SUPPORT,
EEPROM_ORIFICE1_ZERO_VALUE,
EEPROM_ORIFICE3_ZERO_VALUE,
- EEPROM_WASTE_TANK_ZERO_VALUE,
+ EEPROM_LOCAL_TIME,
EEPROM_PULLER_TENSION_POSITION,
EEPROM_WINDER_TENSION_POSITION,
EEPROM_INIT_FAILURE_COUNTER,
diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c
index 541fff0a7..6b2878677 100644
--- a/Software/Embedded_SW/Embedded/Main.c
+++ b/Software/Embedded_SW/Embedded/Main.c
@@ -168,6 +168,8 @@ Void errHook(Error_Block *eb)
{
FirstErrorFlag = false;
MCU_E2PromProgram(EEPROM_INIT_FAILURE_COUNTER,InitFailures+1);
+ utilsStoreLocalTime();
+
len = usnprintf(message, 300, "\r\nerror task 0x%x %s context prev task 0x%x,%s", PrevTask,Task_Handle_name(PrevTask),NextTask,Task_Handle_name(NextTask));
f_write(LogFileHandle,message,len,&Bytes );
site = Error_getSite(eb);
@@ -234,6 +236,7 @@ void Init_EVB()
int main(void)
{
FRESULT Fresult = FR_OK;
+ time_t time_store = 0;
// Enable interrupts to the processor.
//
ROM_IntMasterDisable();
@@ -301,6 +304,13 @@ int main(void)
#endif
}
+ utilsInit(ui32SysClock);
+ MCU_E2PromRead(EEPROM_LOCAL_TIME,&time_store);
+ if (time_store)
+ {
+ ulocaltime(time_store+5,&LocalTime);
+ HibernateCalendarSet(&LocalTime);
+ }
OpenLogFile();
Data = MCU_E2PromEmbeddedVersionRead();
memcpy (&Version,&Data,4);
@@ -344,6 +354,10 @@ int main(void)
I2C_DispRFIDTask_Init();//I2C Task for dispensers & RFID
+#ifdef USE_UART4_FOR_BTSR
+ BTSR_Init();
+#endif
+
#if defined(USE_RFID_LOGIC) || defined(USE_RFID_STUB)
//Trigger_RFID_Init(); //Init_IFS();//must be done after FPGA_Init
Init_IFS();
@@ -367,7 +381,6 @@ int main(void)
#endif
CommunicationTaskInit();
- utilsInit(ui32SysClock);
#ifndef EVALUATION_BOARD
//Turn_the_Blower_On();//Turn on with the Default_Voltage
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 5c0ff852c..fd13e37e5 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -22,6 +22,10 @@
#include "MillisecTask.h"
#include <driverlib/timer.h>
+#include <time.h>
+#include "Common/Utilities/Utils.h"
+#include "driverlib/hibernate.h"
+
#include <Drivers/SSI_Comm/SSI_Comm.h>
#include <Drivers/SSI_Comm/Speed_Sensor/Speed_Sensor.h>
#include <Drivers/SSI_Comm/Dancer/Dancer.h>
@@ -72,6 +76,7 @@
#include <Drivers/I2C_Communication/RFID_NFC/RFIDTagInfo.h>
#include <Drivers/I2C_Communication/RFID_NFC/I2C_IFS_Mux.h>
#include <Drivers/I2C_Communication/RFID_NFC/NFC.h>
+#include "Drivers/Uart_Comm/BTSR/BTSR.h"
Task_Handle Millisecond_Task_Handle;
/******************** Definitions ********************************************/
@@ -730,11 +735,21 @@ uint32_t MillisecLowLoop(uint32_t tick)
}
}
#endif
+
+ #ifdef USE_UART4_FOR_BTSR
+ //call every 100mSec
+ BTSR_State_Machine(0x01);
+ #endif
}
if (Gradient_Tick)
DispensersCollectionCall();
if (O200Millisecond_Tick)
{
+
+ ulocaltime(umktime(&LocalTime)+1,&LocalTime);
+ HibernateCalendarSet(&LocalTime);
+ ReportWithPackageFilter(ThreadFilter,"Time: ",__FILE__,LocalTime.tm_hour,LocalTime.tm_min,RpWarning,(int) LocalTime.tm_sec,0);
+
Trigger_WHS_MAX11614_Read_allADC();
FPGA_GetAllDispensersValveBusyOCD();
Read_Dryer_Fan_Tacho();
diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c
index 469e82aa8..2c67a623b 100644
--- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c
+++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.c
@@ -157,6 +157,7 @@ bool CartridgeInkFull()
int GetCartridgeFillPercent()
{
double MidTank_Pressure = 0;
+ double percent;
#ifdef IFS_DEBUG
static int percent = 0;
if (midTankState == MidTankStateFilling) {
@@ -169,7 +170,8 @@ int GetCartridgeFillPercent()
return percent;
#else
MidTank_Pressure = Read_MidTank_Pressure_Sensor(midTankCartColor);
- return (((MidTank_Pressure - midTankCapacity)* 100) / CARTRIDGE_CAPATICY);
+ percent = (((MidTank_Pressure - midTankCapacity)* 100) / CARTRIDGE_CAPATICY);
+ return percent;
#endif
}
diff --git a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h
index 0f95fb2e2..7d68621e9 100644
--- a/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h
+++ b/Software/Embedded_SW/Embedded/Modules/IFS/ifs.h
@@ -13,7 +13,7 @@
#define CARTRIDGE_INK_TIMEOUT 420
#define MidTank_Pressure_EMPTY 0.3
-#define CARTRIDGE_CAPATICY 1500
+#define CARTRIDGE_CAPATICY 1.5
typedef enum{
MidTankStateIdle,
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
index 13032f49d..aedb49a62 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread.h
@@ -22,16 +22,6 @@
#define NORMAL_COEF_DIVIDER 100
typedef struct
{
- uint32_t startoffsetpulses;
- uint32_t spoolbackingrate;
- uint32_t segmentoffsetpulses;// the spool winding initial length in mm
- uint32_t milimetersperrotation;
- uint32_t SpoolBottomBackingRate;// the angle of the bottom of the spool
- double NumberOfRotationPerPassage; // how many rotations per spool passage
- double diameter;
-}InternalWinderConfigStruc;
-typedef struct
-{
bool m_isEnabled;
int32_t m_SetParam;
float m_mesuredParam;
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
index 4ce48a639..05cacd20e 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_ex.h
@@ -14,7 +14,18 @@
#define WINDER_4_DANCER HARDWARE_DANCER_TYPE__RightDancer
#define NUM_OF_DANCERS NUM_OF_ROTENC
-//} DANCER_ENUM;
+
+typedef struct
+{
+ uint32_t startoffsetpulses;
+ uint32_t spoolbackingrate;
+ uint32_t segmentoffsetpulses;// the spool winding initial length in mm
+ uint32_t milimetersperrotation;
+ uint32_t SpoolBottomBackingRate;// the angle of the bottom of the spool
+ double NumberOfRotationPerPassage; // how many rotations per spool passage
+ double diameter;
+}InternalWinderConfigStruc;
+
typedef enum threadMotorsEnum
{
FEEDER_MOTOR,
@@ -55,6 +66,7 @@ uint32_t LoadDancerConfigMessage(void);
//uint32_t MotorPidRequestMessage(HardwarePidControl* request);
extern float NumberOfRotationPerPassage; //debug for rotation per passage trials
+extern InternalWinderConfigStruc InternalWinderCfg;
uint32_t Winder_Init(void);
uint32_t Winder_Check_Cone(void);
diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt
index 9f7e375b1..55bb213d2 100644
--- a/Software/Embedded_SW/Embedded/Software Release Notes.txt
+++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt
@@ -5,8 +5,9 @@ hw configuration stored only in flash file system (uploaded from PPC/MS on ever
dispensers data and process parameters stored in internal EEPROM - Addresses 0x200, 0x400.
homing tokens - dynamic allocation
Dispensers filling timeout alarm (after one hour)
-
-
+IDS - gradient brushstop offset size from the file
+store real time and use in error log
+BTSR Support
Embedded SW Release note - Version 1.5.3(4) - Pack 3
=============================================================
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
index dedf8ba98..c5ac305e2 100644
--- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
+++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c
@@ -456,11 +456,26 @@ uint32_t ThreadJoggingFunc(int speed)
TSegment->length = 200.0;
TSegment->n_brushstops = 0;
Ticket.segments[0] = TSegment;
- Tspool->backingrate = 32;
- Tspool->bottombackingrate = 32;
- Tspool->segmentoffsetpulses = 1000;
- Tspool->startoffsetpulses = 220;
- Tspool->rotationsperpassage = 3.1415926*2;
+ if (InternalWinderCfg.spoolbackingrate)
+ Tspool->backingrate = InternalWinderCfg.spoolbackingrate;
+ else
+ Tspool->backingrate = 32;
+ if (InternalWinderCfg.SpoolBottomBackingRate)
+ Tspool->bottombackingrate = InternalWinderCfg.SpoolBottomBackingRate;
+ else
+ Tspool->bottombackingrate = 32;
+ if (InternalWinderCfg.segmentoffsetpulses)
+ Tspool->segmentoffsetpulses = InternalWinderCfg.segmentoffsetpulses;
+ else
+ Tspool->segmentoffsetpulses = 1000;
+ if (InternalWinderCfg.startoffsetpulses)
+ Tspool->startoffsetpulses = InternalWinderCfg.startoffsetpulses;
+ else
+ Tspool->startoffsetpulses = 220;
+ if (InternalWinderCfg.NumberOfRotationPerPassage)
+ Tspool->rotationsperpassage = InternalWinderCfg.NumberOfRotationPerPassage;
+ else
+ Tspool->rotationsperpassage = 3.1415926*3;
Tspool->has_limitswitchstartpointoffset = false;
Ticket.spool = Tspool;
Ticket.threadparameters = &SavedThreadParameters;
@@ -638,11 +653,27 @@ uint32_t ThreadCleaningJob(int speed)
Tdispenser->index = 4; //TI dispenser
Ticket.segments[0] = TSegment;
Ticket.segments[1] = TSegment;
- Tspool->backingrate = 32;
- Tspool->bottombackingrate = 32;
- Tspool->segmentoffsetpulses = 1000;
- Tspool->startoffsetpulses = 220;
- Tspool->rotationsperpassage = 3.1415926*2;
+ if (InternalWinderCfg.spoolbackingrate)
+ Tspool->backingrate = InternalWinderCfg.spoolbackingrate;
+ else
+ Tspool->backingrate = 32;
+ if (InternalWinderCfg.SpoolBottomBackingRate)
+ Tspool->bottombackingrate = InternalWinderCfg.SpoolBottomBackingRate;
+ else
+ Tspool->bottombackingrate = 32;
+ if (InternalWinderCfg.segmentoffsetpulses)
+ Tspool->segmentoffsetpulses = InternalWinderCfg.segmentoffsetpulses;
+ else
+ Tspool->segmentoffsetpulses = 1000;
+ if (InternalWinderCfg.startoffsetpulses)
+ Tspool->startoffsetpulses = InternalWinderCfg.startoffsetpulses;
+ else
+ Tspool->startoffsetpulses = 220;
+ if (InternalWinderCfg.NumberOfRotationPerPassage)
+ Tspool->rotationsperpassage = InternalWinderCfg.NumberOfRotationPerPassage;
+ else
+ Tspool->rotationsperpassage = 3.1415926*3;
+ Tspool->has_limitswitchstartpointoffset = false;
Tspool->has_limitswitchstartpointoffset = false;
Ticket.spool = Tspool;
Ticket.threadparameters = &SavedThreadParameters;