aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/Thread
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-11 16:55:45 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-10-11 16:55:45 +0300
commitac3f1ee33017e1823cfff46073b1a617b438d612 (patch)
tree18d07142b043a777879f2a0e8946e42005019181 /Software/Embedded_SW/Embedded/Modules/Thread
parent810bbfab7a812a0d9f0e46ff60d45280594a6716 (diff)
parent6e01dab40eef661b1bb7066ba40272c76ab54f78 (diff)
downloadTango-ac3f1ee33017e1823cfff46073b1a617b438d612.tar.gz
Tango-ac3f1ee33017e1823cfff46073b1a617b438d612.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/Thread')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c6
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c18
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c8
3 files changed, 20 insertions, 12 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
index d5c186893..d0d2c1ef7 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c
@@ -16,7 +16,7 @@
#include "Modules/Control/control.h"
#include "Modules/General/process.h"
#include "Modules/control/pidalgo.h"
-
+#include "Modules/AlarmHandling/AlarmHandling.h"
#include "Modules/heaters/heaters_ex.h"
#include "Modules/General/buttons.h"
#include "StateMachines/Initialization/InitSequence.h"
@@ -1109,6 +1109,8 @@ uint32_t ThreadLoadButton(THREAD_LOAD_STAGES_ENUM ReadValue)
}
Report("ThreadLoadButton",__FILE__,__LINE__,LoadStages,RpMessage,ReadValue,0);
Report("ThreadLoadButton params",__FILE__,LoadStatus,TryAgain,RpMessage,SecondTry,0);
+ if (LoadStages == THREAD_LOAD_INITIAL_TENSION) //on this satge we should wait for user call
+ MessageState = 2;
ThreadLoadingReport();
if (LoadStatus == ERROR)
{
@@ -1407,8 +1409,6 @@ uint32_t ThreadLoadingReport(void)
if (ThreadLoadingToken[0] == 0)
return OK;
- if (LoadStages == THREAD_LOAD_INIT)
- return OK;
if (MessageState == 0)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
index 2b6492dab..c37617037 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c
@@ -17,7 +17,7 @@
#include "Common/report/report.h"
#include "drivers/FPGA/FPGA.h"
-
+#include "drivers/Flash_ram/MCU_E2Prom.h"
#include "drivers/FPGA/FPGA_SPI_Comm.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
@@ -102,15 +102,22 @@ char ScrewStr[150];
uint32_t InternalWindingConfigMessage(JobSpool* request)
{
uint32_t status = PASSED;
+ int limitswitchstartpointoffset = 0;
InternalWinderCfg.segmentoffsetpulses = request->segmentoffsetpulses;
InternalWinderCfg.spoolbackingrate = request->backingrate;
InternalWinderCfg.startoffsetpulses = request->startoffsetpulses;
if (request->has_limitswitchstartpointoffset)
{
- InternalWinderCfg.startoffsetpulses += request->limitswitchstartpointoffset;
+ //InternalWinderCfg.startoffsetpulses += request->limitswitchstartpointoffset;
Report("limit switch start point offset",__FILE__,__LINE__,(int)(request->startoffsetpulses),RpWarning,(int)(request->limitswitchstartpointoffset), 0);
}
+ status |= MCU_E2PromRead(EEPROM_STORAGE_WINDER_CALIBRATION,&limitswitchstartpointoffset);
+ if ((status!= OK )||(limitswitchstartpointoffset == 0xFFFF))
+ limitswitchstartpointoffset = 0;
+ Report("limit switch start point offset",__FILE__,(int)(request->startoffsetpulses),(int)(limitswitchstartpointoffset),RpWarning,status, 0);
+ InternalWinderCfg.startoffsetpulses += limitswitchstartpointoffset;
+
InternalWinderCfg.SpoolBottomBackingRate = request->bottombackingrate;
InternalWinderCfg.NumberOfRotationPerPassage = 3.1415926*3;//request->rotationsperpassage;
if (request->rotationsperpassage > 6.1)
@@ -273,7 +280,8 @@ uint32_t Winder_PrepareStage2(uint32_t deviceID, uint32_t ReadValue)
uint32_t Winder_ScrewAtOffsetCallback(uint32_t MotorId, uint32_t BusyFlag)
{
//MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_SCREW,temp_MaxFrequency);
- Screw_wait_counter--;
+ if (Screw_wait_counter)
+ Screw_wait_counter--;
MotorStop (MotorId,Soft_Hiz); //per L6470 errata between mov and run commands
/*#ifdef FOUR_WINDERS
@@ -355,7 +363,9 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag)
{
//uint32_t Steps;
double temp,tempScrewSpeed;
- int i,tempmot;
+#ifdef FOUR_WINDERS
+ int tempmot;
+#endif
//double screw_horizontal_speed = 0;
//double RotationsPerSecond;
if (WinderMotorSpeedCounter++>=MAX_WINDER_SPEED_CALCULATION)
diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
index 4f77104d4..f13f76cfb 100644
--- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
+++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c
@@ -560,7 +560,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
//extern int MotorSamplePointer[MAX_THREAD_MOTORS_NUM];
//read value is the dancer angle
int i,index=MAX_THREAD_MOTORS_NUM;
- int len;
int DancerId;
int32_t TranslatedReadValue, avreageSampleValue = 0;//,avreageMotorSampleValue = 0;
//double tempcalcspeed = 0;
@@ -747,7 +746,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
if (index >= WINDER_MOTOR)
{
// FirstCalcInJob = false;
- len = usnprintf(ATMessage[index], 150, "index %d read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d %d",index-WINDER_MOTOR+1,
+ usnprintf(ATMessage[index], 150, "index %d read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d %d",index-WINDER_MOTOR+1,
TranslatedReadValue,avreageSampleValue,(int)(MotorControlConfig[index].m_mesuredParam*1000000),
(int)(MotorControlConfig[index].m_integral*1000000000),(int)((MotorControlConfig[index].m_mesuredParam*MotorControlConfig[index].m_params.dt)*1000000000),
(int)(MotorControlConfig[index].m_calculatedError*1000),(int)calculated_speed, (int)(InitialDryerSpeed*100/OriginalMotorSpd_2PPS[DRYER_MOTOR]));
@@ -784,7 +783,6 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
ReportWithPackageFilter(ThreadFilter,"MotorSpeedUpdated",__FILE__,index,(int)OriginalMotorSpd_2PPS[index],RpWarning,(int)CurrentControlledSpeed[index],0);
}*/
#ifdef TEST_PID_THREAD
- int len;
if ((JobCounter % 2000) == index*100)
//if (keepdata == true)
{
@@ -796,7 +794,7 @@ uint32_t ThreadControlCBFunction(uint32_t IfIndex, uint32_t ReadValue)
NormError[controlIndex] = MotorControlConfig[index].m_mesuredParam;
mIntegral[controlIndex] = MotorControlConfig[index].m_integral;
timestamp[controlIndex] = msec_millisecondCounter;*/
- len = usnprintf(TMessage, 150, "read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d",
+ usnprintf(TMessage, 150, "read %d avg %d error(6) %d integral(9) %d,delta(9) %d, calc(3) %d speed %d",
ReadValue,avreageSampleValue,(int)(MotorControlConfig[index].m_mesuredParam*1000000),
(int)(MotorControlConfig[index].m_integral*1000000000),(int)((MotorControlConfig[index].m_mesuredParam*MotorControlConfig[index].m_params.dt)*1000000000),
(int)(MotorControlConfig[index].m_calculatedError*1000),(int)calculated_speed);
@@ -1256,7 +1254,6 @@ uint32_t ThreadPrepareState(void *JobDetails)
//AddControlCallback(NULL,ThreadControlSpeedReadFunction, eHundredMillisecond,MotorGetSpeedFromFPGA,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToMotorId[Motor_i],Motor_i);
#endif
}
-#endif
if (Motor_i == POOLER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled
{
if (ControlIdtoMotorId[Motor_i] != 0xFF)
@@ -1270,6 +1267,7 @@ uint32_t ThreadPrepareState(void *JobDetails)
ControlIdtoMotorId[Motor_i] = AddControlCallback(NULL,ThreadControlCBFunction, eOneMillisecond,Control_Read_Dancer_Position,(IfTypeThread*0x100+Motor_i),ThreadMotorIdToDancerId[Motor_i],Motor_i);
#endif
}
+#endif
if (Motor_i == WINDER_MOTOR) // dryer motor is speed controlled. later a speed sensor will be utilized, but for now it will n//ot be controlled
{
ReportWithPackageFilter(ThreadFilter,"Winder Control",__FILE__,Motor_i,MotorControlConfig[Motor_i].m_params.Kp,RpWarning,MotorControlConfig[Motor_i].m_params.Ki,0);