aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-02-07 22:32:07 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-02-07 22:32:07 +0200
commiteb7e0a5b66657d58ed7b6ea24c6ad7d1b4239c8f (patch)
treeb9346f7a4953ae949f37f397936aa27a593f6452 /Software/Embedded_SW/Embedded/Modules
parent1cbfa754eea84d46fca7a9b0d27a0a1a212b9944 (diff)
parent72165197a9c2787f9441a5576c9a182eb839f904 (diff)
downloadTango-eb7e0a5b66657d58ed7b6ea24c6ad7d1b4239c8f.tar.gz
Tango-eb7e0a5b66657d58ed7b6ea24c6ad7d1b4239c8f.zip
merge
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c5
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Control/control.c25
-rw-r--r--Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c2
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/buttons.c69
-rw-r--r--Software/Embedded_SW/Embedded/Modules/General/buttons.h45
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c2
6 files changed, 105 insertions, 43 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
index 10286853e..4f78d2134 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/MillisecTask.c
@@ -83,6 +83,8 @@ bool watchdogCriticalAlarm = false;
uint32_t msec_millisecondCounter = 0;
+extern bool Machine_Idle_Mode;
+
MillisecMotorDataStruc ScrewSetMaxSpeedPending = {0};
MillisecMotorDataStruc ScrewMovePending = {0};
MillisecMotorDataStruc MotorData[NUM_OF_MOTORS] = {0};
@@ -446,7 +448,8 @@ uint32_t MillisecLowLoop(uint32_t tick)
//Speed_Data = Calculate_Speed_Sensor_Velocity();
//MillisecReadFromTempSensor(Sensor_Read, NULL);
//if (Sensor_Read++ >= MAX_TEMPERATURE_SENSOR_ID) Sensor_Read = 0;
- //Control_LED1_PWM();
+ if(Machine_Idle_Mode == true)
+ Machine_Idle_Breathing_Led();
}
if (Hundred_msTick)
{
diff --git a/Software/Embedded_SW/Embedded/Modules/Control/control.c b/Software/Embedded_SW/Embedded/Modules/Control/control.c
index 898f7ec67..69820e306 100644
--- a/Software/Embedded_SW/Embedded/Modules/Control/control.c
+++ b/Software/Embedded_SW/Embedded/Modules/Control/control.c
@@ -51,6 +51,7 @@
#include <inc/hw_ints.h>
#include "drivers/adc_sampling/adc.h"
+#include "Modules/General/buttons.h"
#include "control.h"
#include "MillisecTask.h"
@@ -157,10 +158,20 @@ void ControlStop(void)
uint32_t ControlActivityLed( uint32_t Parameter1)
{
static bool flag = false;
+ static uint8_t counter;
+ const uint8_t Blink_Freq = 15;//odd number
+
if (flag==true)
{
COMM_RED_LED_ON;
ACTIVITY_RED_LED_OFF; // Heaters indication - all the Heaters OFF
+ if(power.color == fastBILNK)
+ Pannel_Leds(POWER_ON_OFF,MODE_OFF);
+
+ if((power.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(POWER_ON_OFF,MODE_OFF);
+ }
flag = false;
}
else
@@ -168,8 +179,22 @@ uint32_t ControlActivityLed( uint32_t Parameter1)
COMM_RED_LED_OFF;
if (HeaterActive > 0)// Blink the led on heating
ACTIVITY_RED_LED_ON;// Heaters indication - at least one of the Heaters is ON
+
+ if(power.color == fastBILNK)
+ Pannel_Leds(POWER_ON_OFF,MODE_ON);
+
+ if((power.color == BLINK) && (counter % Blink_Freq == 0) )
+ {
+ Pannel_Leds(POWER_ON_OFF,MODE_ON);
+ }
+
flag = true;
}
+
+ if (counter < 0xFF)
+ counter++;
+ else
+ counter = Blink_Freq + 1;
return OK;
}
uint32_t ControlEmptyCBFunction(uint32_t IfIndex, uint32_t ReadValue)
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c
index 42f02556e..48f2e1e20 100644
--- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c
+++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/DiagnosticsJogging.c
@@ -145,10 +145,12 @@ uint32_t DispenserJoggingRequestFunc(MessageContainer* requestContainer)
{
case MOTOR_DIRECTION__Forward:
Control3WayValvesWithCallback ((Valves_t) request->index, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
+ SysCtlDelay(180000);
direction = MotorsCfg[MotorId].directionthreadwize;
break;
case MOTOR_DIRECTION__Backward:
Control3WayValvesWithCallback ((Valves_t) request->index, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
+ SysCtlDelay(180000);
direction = 1-MotorsCfg[MotorId].directionthreadwize;
break;
}
diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.c b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
index 68199d19f..f80727dfc 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/buttons.c
+++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.c
@@ -10,8 +10,9 @@
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"//#include "FPGA_GPIO.h" // use for FPGA IO
#include "DataDef.h" // use for FPGA IO
#include "Modules/Control/control.h" // use for FPGA IO
-
+#include "Modules/General/buttons.h"
#include "StateMachines/Printing/PrintingSTM.h"
+#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
#include <stdlib.h>
#include <stdint.h>
@@ -26,15 +27,8 @@ int ch_to_power_down();
int ch_to_power_up();
int thredJog();
-typedef enum
-{
- colorOFF = 0,
- BLUE,
- BLINK,
- fastBILNK,
- BREATHING
-} PBcolor;
+/*
typedef enum
{
OFFPB = 0,
@@ -43,7 +37,7 @@ typedef enum
LONGPB ,
REPLONGPB //repeat long PB
}PBstat;
-
+*/
typedef enum
{
MSEC = 0,
@@ -53,47 +47,26 @@ typedef enum
MORE5000
}timems;
-typedef enum
-{
- sttOFF = 0,
- sttON,
- sttDISABLE,
- sttENABLE,
- sttIDLE,
- sttJOGGING,
- sttRDY,
- sttPRELOAD,
- sttLOADING,
- sttLOADSUCSESS,
- sttLOADFAIL
-} PBmachinState;
+
//enum PBstat OnOffPBstate = OFFPB;
//enum PBstat ret
//enum PBstat threadPB = OFFPB;
-struct button
-{
- char bttn_name[10]; //option
- int bttn_status; // 0=release 1=press
- /* enum */ PBstat Action; //offPB,shortPB,longPB,countPB,replongPB
- /* enum */ PBcolor color; //off, blue, blink, bithing
- /* enum */ PBmachinState state; //sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING
- uint32_t count;
-};
-struct button power , jog, load;
+
+button power , jog, load;
uint32_t ButtonsCallBackFunction(uint32_t IfIndex, uint32_t ReadValue);
uint32_t ButtonsCBFunction(uint32_t IfIndex, uint32_t ReadValue);
-uint32_t ShortLongOffPB(uint8_t OnOffPB, struct button *pBtn);
-uint32_t StateMachine(struct button *pBtn);
+uint32_t ShortLongOffPB(uint8_t OnOffPB, button *pBtn);
+uint32_t StateMachine( button *pBtn);
uint32_t ButtonJogCallBackFunction(uint32_t IfIndex, uint32_t ReadValue);
uint32_t ButtonJogCBFunction(uint32_t IfIndex, uint32_t ReadValue);
uint8_t thraedJogging(uint8_t off);
-uint32_t setJoggingEnableCondition(struct button *pBtn);
-uint32_t joggingMachine(uint8_t OnOffPB, struct button *pBtn);
+uint32_t setJoggingEnableCondition( button *pBtn);
+uint32_t joggingMachine(uint8_t OnOffPB, button *pBtn);
uint32_t ButtonLoadCallBackFunction(uint32_t IfIndex, uint32_t ReadValue);
@@ -251,7 +224,7 @@ int StopTimer()
//ShortLongOffPB( OnOffPB, &ret)
-uint32_t ShortLongOffPB(uint8_t OnOffPB, struct button *pBtn)
+uint32_t ShortLongOffPB(uint8_t OnOffPB, button *pBtn)
{
uint8_t parameter = 0 ; // why we need it!!!!
@@ -333,7 +306,7 @@ uint32_t ShortLongOffPB(uint8_t OnOffPB, struct button *pBtn)
-uint32_t StateMachine(struct button *pBtn) //short press(=0)/long press(=1)
+uint32_t StateMachine( button *pBtn) //short press(=0)/long press(=1)
{
uint8_t parameter = 1;
@@ -373,10 +346,12 @@ uint32_t StateMachine(struct button *pBtn) //short press(=0)/long press(=1)
{
case LONGPB: //Power off from idle
pBtn->state = sttOFF; // todo
+ Pannel_Leds(POWER_ON_OFF,MODE_OFF); //AVI+ - TODO option MODE_ON to stop Breathing and the led will turn off in power down
REPORT_MSG(parameter,"Power state is OFF ");
break;
case SHORTPB: //Wake up from idle
pBtn->state = sttON;// to do ?
+ Pannel_Leds(POWER_ON_OFF,MODE_ON); //AVI+
REPORT_MSG(parameter,"Power state is ON ");
break;
default:
@@ -406,7 +381,7 @@ return 0;
-uint32_t setJoggingEnableCondition(struct button *pBtn)
+uint32_t setJoggingEnableCondition( button *pBtn)
{
if (0
// 1.
@@ -443,12 +418,13 @@ return 0;
*/
-uint32_t joggingMachine(uint8_t OnOffPB, struct button *pBtn)
+uint32_t joggingMachine(uint8_t OnOffPB, button *pBtn)
{
if (sttDISABLE == pBtn->state)
{
// jogging is disable
pBtn->color = colorOFF;
+ Pannel_Leds(THREAD_JOGGING,MODE_OFF);//AVI+
}
else
{
@@ -456,6 +432,7 @@ uint32_t joggingMachine(uint8_t OnOffPB, struct button *pBtn)
{
ThreadAbortJoggingFunc(); // to do!!!!
pBtn->color = BLUE;
+ Pannel_Leds(THREAD_JOGGING,MODE_ON);//AVI+
}
else
{
@@ -534,5 +511,13 @@ ShortLongOffPB( threadPB, ret,struct button *pBtn);
}
*/
+void test_avi()
+{
+
+ power.color = BLINK;
+ //power.color = fastBILNK
+ //Machine_Idle_Mode = true;
+
+}
diff --git a/Software/Embedded_SW/Embedded/Modules/General/buttons.h b/Software/Embedded_SW/Embedded/Modules/General/buttons.h
index 897fb6031..e7a611e9b 100644
--- a/Software/Embedded_SW/Embedded/Modules/General/buttons.h
+++ b/Software/Embedded_SW/Embedded/Modules/General/buttons.h
@@ -1,6 +1,51 @@
#ifndef BUTTONS_H
#define BUTTONS_H
+typedef enum
+{
+ colorOFF = 0,
+ BLUE,
+ BLINK,
+ fastBILNK,
+ BREATHING
+} PBcolor;
+
+typedef enum
+{
+ OFFPB = 0,
+ COUNTPB ,
+ SHORTPB ,
+ LONGPB ,
+ REPLONGPB //repeat long PB
+}PBstat;
+
+typedef enum
+{
+ sttOFF = 0,
+ sttON,
+ sttDISABLE,
+ sttENABLE,
+ sttIDLE,
+ sttJOGGING,
+ sttRDY,
+ sttPRELOAD,
+ sttLOADING,
+ sttLOADSUCSESS,
+ sttLOADFAIL
+} PBmachinState;
+
+typedef struct
+{
+ char bttn_name[10]; //option
+ int bttn_status; // 0=release 1=press
+ /* enum */ PBstat Action; //offPB,shortPB,longPB,countPB,replongPB
+ /* enum */ PBcolor color; //off, blue, blink, bithing
+ /* enum */ PBmachinState state; //sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING
+ uint32_t count;
+}button;
+
+extern button power , jog, load;
+
uint32_t Buttons_Init(void);
uint32_t Button_load_Init(void);
uint32_t Button_JOG_Init(void);
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
index f701d0878..f71cdc71f 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c
@@ -153,6 +153,7 @@ uint32_t IDS_HomeDispenser (uint32_t deviceID, uint32_t speed , callback_fptr ca
Control3WayValvesWithCallback ((Valves_t)deviceID, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
//Valve_Set((Valves_t) request->index, MidTank_Dispenser);
MotorSetMicroStep(deviceID, 1);
+ SysCtlDelay(180000);
//open dry air valve in the dispenser
Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_ON);
@@ -234,6 +235,7 @@ uint32_t IDS_EmptyDispenser (uint32_t deviceID, uint32_t speed , callback_fptr c
Control3WayValvesWithCallback ((Valves_t)deviceID, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer
//Valve_Set((Valves_t) request->index, Dispenser_Mixer);
MotorSetMicroStep(deviceID, 1);
+ SysCtlDelay(180000);
//open dry air valve in the dispenser
//Valve_Set(IDS_Id_to_AirValve[deviceID], Atm_MidTank_ON);
IDS_Dispenser_RefillStarted(deviceID);