diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-29 12:08:10 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-29 12:08:10 +0300 |
| commit | 6792c8f8769eec18cfee8ccf80a09887c48b8b6a (patch) | |
| tree | eb67c141d40ea34b4446bd6724ec77fc13385852 /Software/Embedded_SW/Embedded/Modules | |
| parent | 9ae8d0e95a199dbf6be4597b0e08717d4d0754f2 (diff) | |
| parent | 405096b3d489f4ea7b50b1d5db7d32241251b8d7 (diff) | |
| download | Tango-6792c8f8769eec18cfee8ccf80a09887c48b8b6a.tar.gz Tango-6792c8f8769eec18cfee8ccf80a09887c48b8b6a.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
6 files changed, 66 insertions, 21 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 931b6674f..73532a7d2 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -669,6 +669,8 @@ uint32_t AlarmHandling_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue) return OK; } +void AlarmHandlingInternalSetAlarm(uint32_t AlarmId, bool value); + void AlarmHandlingSetAlarm(uint32_t AlarmId, bool value) { AlarmHandlingInternalSetAlarm( AlarmId, value); @@ -1024,12 +1026,12 @@ void AlarmHandlingTask(UArg arg0, UArg arg1) } } //StartEventsNotificationResponse StartEventsNotification = START_EVENTS_NOTIFICATION_RESPONSE__INIT; -StartEventsNotificationResponse response = START_EVENTS_NOTIFICATION_RESPONSE__INIT; +StartEventsNotificationResponse EventsResponse = START_EVENTS_NOTIFICATION_RESPONSE__INIT; int LargeMessagesAH = 0; void SendEventNotifications(void) { MessageContainer responseContainer; - //StartEventsNotificationResponse response = START_EVENTS_NOTIFICATION_RESPONSE__INIT; + //StartEventsNotificationResponse EventsResponse = START_EVENTS_NOTIFICATION_RESPONSE__INIT; int i,e=0; if (AlarmHandlingActive == false) @@ -1042,20 +1044,20 @@ void SendEventNotifications(void) return; } - response.n_events = 0; + EventsResponse.n_events = 0; UInt Key = Task_disable(); for (i = 0;i<MAX_SYSTEM_ALARMS;i++) { if (AlarmState[i].Status == true) { - response.n_events++; + EventsResponse.n_events++; } } - if (response.n_events) + if (EventsResponse.n_events) { - response.events = (Event **)my_malloc(sizeof(Event*)*response.n_events); - if(response.events) + EventsResponse.events = (Event **)my_malloc(sizeof(Event*)*EventsResponse.n_events); + if(EventsResponse.events) { for (i = 0;i<MAX_SYSTEM_ALARMS;i++) { @@ -1063,7 +1065,7 @@ void SendEventNotifications(void) { if (AlarmState[i].EventPtr) { - response.events[e]=AlarmState[i].EventPtr; + EventsResponse.events[e]=AlarmState[i].EventPtr; e++; } } @@ -1071,17 +1073,17 @@ void SendEventNotifications(void) } else { - LOG_ERROR(response.n_events,"events malloc error"); + LOG_ERROR(EventsResponse.n_events,"events malloc error"); Task_restore(Key); return; } } else { - response.events = NULL; + EventsResponse.events = NULL; } Task_restore(Key); - responseContainer = createAllocatedContainer(MESSAGE_TYPE__StartEventsNotificationResponse, AlarmHandlingToken, false, &response, &start_events_notification_response__pack, &start_events_notification_response__get_packed_size,&alarm_response_buffer); + responseContainer = createAllocatedContainer(MESSAGE_TYPE__StartEventsNotificationResponse, AlarmHandlingToken, false, &EventsResponse, &start_events_notification_response__pack, &start_events_notification_response__get_packed_size,&alarm_response_buffer); responseContainer.continuous = true; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); @@ -1096,8 +1098,8 @@ void SendEventNotifications(void) my_free(container_buffer); } } - if (response.events) - my_free(response.events); + if (EventsResponse.events) + my_free(EventsResponse.events); if (responseContainer.data.data) my_free(responseContainer.data.data); } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index 184aa52be..b89fa43ed 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -22,6 +22,7 @@ #include "drivers/FPGA/FPGA.h" #include "drivers/I2C_Communication/ADC_MUX/ADC_MUX.h" #include "drivers/I2C_Communication/DAC/Blower.h" +#include "drivers/valves/valve.h" #include "modules/ids/ids_ex.h" #include "Modules/Control/MillisecTask.h" diff --git a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c index 6fc728934..9c7e84bc2 100644 --- a/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c +++ b/Software/Embedded_SW/Embedded/Modules/General/GeneralHardware.c @@ -416,6 +416,8 @@ uint32_t HWConfigurationFunc(MessageContainer* requestContainer) status = HWConfiguration(UploadRequest); + GeneralHwReady = true; + responseContainer = createContainer(MESSAGE_TYPE__UploadHardwareConfigurationResponse, requestContainer->token, true, &response, &upload_hardware_configuration_response__pack, &upload_hardware_configuration_response__get_packed_size); if (status!= OK) { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index d312dcb78..0907c4a67 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -205,6 +205,10 @@ uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) Disable_MidTank_Pressure_Reading(DispenserId); Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (START); + } MotorSetMicroStep(MotorId, MotorsCfg[MotorId].microstep); CurrentDispenserSpeed[DispenserId] = 0; @@ -227,6 +231,36 @@ uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id) else return FPGA_Read_limit_Switches(Dispenser_Id_to_Alarm_LS_Id[LS_Id]); } +uint32_t IDS_EmptyDispenserCallback(uint32_t motorId, uint32_t ReadValue) +{ + uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; + + Read_MidTank_Pressure_Sensor(DispenserId); + //close dry air valve in the dispenser + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Disable_MidTank_Pressure_Reading(DispenserId); + + MotorStop(motorId,Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; + MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); + HomingActive[DispenserId]= false; + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (STOP); + } + + Report("End Priming",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); + //MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); + if (HomingRequestCallback[DispenserId]) + { + HomingRequestCallback[DispenserId](DispenserId,0); + HomingRequestCallback[DispenserId] = NULL; + } + + +return OK; + +} uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr callback) { @@ -254,8 +288,13 @@ uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fpt IDS_Dispenser_RefillStarted(DispenserId); IDS_Dispenser_MovingDirection(DispenserId,UP); + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (START); + } + - MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_HomeDispenserCallback,0); + MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_EmptyDispenserCallback,0); CurrentDispenserSpeed[DispenserId] = speed; return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 1d395ec8c..aea16bb60 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -7,6 +7,7 @@ #include "ids.h" #include "ids_ex.h" #include "../control/control.h" +#include "../control/MillisecTask.h" #include "../general/process.h" #include "../control/pidalgo.h" #include "../thread/thread.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 9ebc32f57..a68995168 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -223,7 +223,7 @@ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; double Rotations = 6.0; -bool flipflop = false; +int flipflop = 0; uint32_t motspeed; float speedf; int WinderCalculation = 0; @@ -250,20 +250,20 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) WinderMotorSpeedRollOver=true; } // } - if (flipflop) + if (flipflop == 0) { - speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } - else + else if (flipflop == 1) { - MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } - flipflop = 1-flipflop; + flipflop ++; if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) return OK; //deley TODO - + flipflop = 0; ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; |
