aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Intellisense/ClassCompletionItemPopup.cs
blob: d575ba9db5f6b3aed4d4e612d7dbe9baa21f09d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Tango.Scripting.Editors.Intellisense
{
    public class ClassCompletionItemPopup : CompletionItemPopupControl
    {
        static ClassCompletionItemPopup()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ClassCompletionItemPopup), new FrameworkPropertyMetadata(typeof(ClassCompletionItemPopup)));
        }
    }
}
ht .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Safety.c
 *
 *  Created on: Feb 26, 2019
 *      Author: shlomo
 *  This file includes the safety indication handling functions:
 *  Dispensers safety,Dryer door, Air suction, Air filter presence, Waste overflow
 */

#include "drivers/Motors/Motor.h"
#include "drivers/Heater/TemperatureSensor.h"
#include "drivers/FPGA/FPGA_SPI_Comm.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
#include "drivers/FPGA/FPGA.h"
#include "drivers/I2C_Communication/Dispenser_Card/IO_Ports/Dispenser_IO.h"

#include  <PMR/Diagnostics/EventType.pb-c.h>

#include "Modules/General/GeneralHardware.h"
#include "modules/control/control.h"
#include "modules/AlarmHandling/AlarmHandling.h"
#include "modules/thread/thread_ex.h"
#include "modules/heaters/heaters_ex.h"
#include "modules/ids/ids_ex.h"

uint32_t SafetyControlId;
bool DispenserOverPressure[MAX_SYSTEM_DISPENSERS] = {false,false,false,false,false,false,false,false};
EventType DispenserAlarm[MAX_SYSTEM_DISPENSERS] = {0,0,0,0,0,0,0,0};
uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag);
bool DrierDoorAlarmState = false;
bool AirFlowAlarmState = false;
bool AirFilterAlarmState = false;
bool WasteOverflowAlarmState = false;
void Safety_Init(void)
{
    SafetyControlId = AddControlCallback("Safety", Safety_Main_State, eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
    //return;
}
uint32_t Safety_Main_State(uint32_t IfIndex, uint32_t BusyFlag)
{
   int Disp_i;
   bool Indication = false;
   bool AllDispensersInSafety = true;
   bool AnyDispensersInSafety = false;
   //bool DispenserBypass = false;
   bool mDrierDoorAlarmState = false;
   bool mAirFlowAlarmState = false;
   bool mAirFilterAlarmState = false;
   //bool mWasteOverflowAlarmState = false;
#ifdef CONTROL_DEBUG
    uint32_t tempp,tempq,delta;
    uint32_t sys_ticks_start = msec_millisecondCounter,sys_ticks_end,max = 0,dev = 0;
    tempp = HibernateRTCSSGet();
#endif
   for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
   {
       //Check safety in the dispensers only for configured, available and supports dispensers (with EEPROM 128KB)
       if ((isMotorConfigured(Disp_i + HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)==true) && (Dispenser_struct[Disp_i].Type == DISP_TYPE_EEPROM128KB))
       {
           Indication = Check_Disp_Safety_Stop_Indication(Disp_i);
           AllDispensersInSafety &= Indication;
           AnyDispensersInSafety |= Indication;
       }
   }

   if (AllDispensersInSafety)
   {
       if (WHS_GPI_SW_FILTER_PRES())
       {
           //report and handle filter missing
           AlarmHandlingSetAlarm(EVENT_TYPE__AIR_FILTER_NOT_INSTALLED, true);
           mAirFilterAlarmState = true;
           AirFilterAlarmState = true;
       }
       else
       {
           if (WHS_GPI_WASTE_FLOW_SWITCH() == false)
           {
               //report and handle air flow failure
               //if blower if off handling is different
               AlarmHandlingSetAlarm(EVENT_TYPE__NO_AIR_PRESSURE, true);
               mAirFlowAlarmState = true;
               AirFlowAlarmState = true;
           }
           else
           {
               if (Get_COVER_1_State(DryerDoor))//"1" - Door open
               {
                   //report and handle dryer door open
                   AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_DOOR_OPEN, true);
                   mDrierDoorAlarmState = true;
                   DrierDoorAlarmState = true;
               }
               else
               {
                   //if (WHS_GPI_WASTE_OVERFULL()) - cannot read this switch
                   {
                       //report and handle waste overflow
                       AlarmHandlingSetAlarm(EVENT_TYPE__CHILLER_DRY_CONTACT, true);
                       //mWasteOverflowAlarmState = true;
                       WasteOverflowAlarmState = true;
                   }
               }
           }
       }

/*     if (Get_COVER_1_State(DryerDoor))
       {
           //report and handle dryer door open
           AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_DOOR_OPEN, true);
           mDrierDoorAlarmState = true;
           DrierDoorAlarmState = true;
       }
       else
       {
           if (WHS_GPI_WASTE_FLOW_SWITCH())
           {
               //report and handle air flow failure
               //if blower if off handling is different
               AlarmHandlingSetAlarm(EVENT_TYPE__NO_AIR_PRESSURE, true);
               mAirFlowAlarmState = true;
               AirFlowAlarmState = true;
           }
           else
           {
               if (WHS_GPI_SW_FILTER_PRES())
               {
                   //report and handle filter missing
                   AlarmHandlingSetAlarm(EVENT_TYPE__AIR_FILTER_NOT_INSTALLED, true);
                   mAirFilterAlarmState = true;
                   AirFilterAlarmState = true;
               }
               else
               {
                   //if (WHS_GPI_WASTE_OVERFULL()) - cannot read this switch
                   {
                       //report and handle waste overflow
                       AlarmHandlingSetAlarm(EVENT_TYPE__WASTE_CONTAINER_OVERFLOW, true);
                       mWasteOverflowAlarmState = true;
                       WasteOverflowAlarmState = true;
                   }
               }
           }
       }
       */
   }
   else if (AnyDispensersInSafety)
   {
       for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
       {
           if (isMotorConfigured(Disp_i + HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)==true)
           {
               if (Check_Disp_Safety_Stop_Indication(Disp_i) == true)
               {
                   Read_SingleDispenser_IO_Registers(Disp_i);
                   //DispenserBypass = Get_Notification_Bypass(Disp_i);
                   if(Get_Notification_Over_Press(Disp_i) == false)
                   {
                       //report dispenser over pressure
                       AlarmHandlingSetAlarm(EVENT_TYPE__DISPENSER_1_OVERPRESSURE+Disp_i, true);
                       DispenserAlarm[Disp_i] = EVENT_TYPE__DISPENSER_1_OVERPRESSURE+Disp_i;
                       if (DispenserAlarm[Disp_i] == false)
                       {
                           IDS_Dispenser_Alarm_On(Disp_i);
                       }
                       DispenserOverPressure[Disp_i] = true;
                       Report("Dispenser Safety - over pressure", __FILE__,__LINE__,Disp_i, RpFatalError, (int)(1000*GetDispenserPressure(Disp_i)), 0);
                   }
                   else if (Get_Notification_Disp_UP(Disp_i) == false)
                   {
                       AlarmHandlingSetAlarm(EVENT_TYPE__DISPENSER_1_UPPER_HARD_LIMIT+Disp_i, true);
                       DispenserAlarm[Disp_i] = EVENT_TYPE__DISPENSER_1_UPPER_HARD_LIMIT+Disp_i;
                       if (DispenserAlarm[Disp_i] == false)
                       {
                           IDS_Dispenser_Alarm_On(Disp_i);
                       }
                       DispenserOverPressure[Disp_i] = true;
                       Report("Dispenser upper hard limit", __FILE__,__LINE__,Disp_i, RpFatalError, Get_Notification_Disp_UP(Disp_i), 0);
                   }
                   else if (Get_Notification_Disp_Down(Disp_i) == false)
                   {
                       AlarmHandlingSetAlarm(EVENT_TYPE__DISPENSER_1_LOWER_HARD_LIMIT+Disp_i, true);
                       DispenserAlarm[Disp_i] = EVENT_TYPE__DISPENSER_1_LOWER_HARD_LIMIT+Disp_i;
                       if (DispenserAlarm[Disp_i] == false)
                       {
                           IDS_Dispenser_Alarm_On(Disp_i);
                       }
                       DispenserOverPressure[Disp_i] = true;
                       Report("Dispenser lower hard limit", __FILE__,__LINE__,Disp_i, RpFatalError, Get_Notification_Disp_Down(Disp_i), 0);
                   }
                   else
                   {
                       Report("Dispenser unknown safety alarm", __FILE__,__LINE__,Disp_i, RpFatalError,Get_Notification_Disp_Full(Disp_i), 0);
                   }

               }
           }
       }
   }
   for (Disp_i = 0;Disp_i < MAX_SYSTEM_DISPENSERS;Disp_i++)
   {
       if (DispenserOverPressure[Disp_i] == true)
       {
           if (isMotorConfigured(Disp_i + HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1)==true)
           {
               if (Check_Disp_Safety_Stop_Indication(Disp_i) == false)
               {
                   if (DispenserAlarm[Disp_i] == true)
                   {
                       IDS_Dispenser_Alarm_Off(Disp_i);
                       AlarmHandlingSetAlarm(DispenserAlarm[Disp_i], false);
                   }
                   DispenserAlarm[Disp_i] = 0;
                   DispenserOverPressure[Disp_i] = false;
               }
           }
       }
   }
   if  ((mDrierDoorAlarmState != DrierDoorAlarmState)|| (mDrierDoorAlarmState == false))
   {
      //alarm went off
       AlarmHandlingSetAlarm(EVENT_TYPE__DRYER_DOOR_OPEN, false);
       DrierDoorAlarmState = mDrierDoorAlarmState;
   }
   if  ((mAirFlowAlarmState != AirFlowAlarmState)|| (mAirFlowAlarmState == false))
   {
      //alarm went off
       AlarmHandlingSetAlarm(EVENT_TYPE__NO_AIR_PRESSURE, false);
       AirFlowAlarmState = mAirFlowAlarmState;
   }
   if  ((mAirFilterAlarmState != AirFilterAlarmState)|| (mAirFilterAlarmState == false))
   {
      //alarm went off
       AlarmHandlingSetAlarm(EVENT_TYPE__AIR_FILTER_NOT_INSTALLED, false);
       AirFilterAlarmState = mAirFilterAlarmState;
   }
   /*if  ((mWasteOverflowAlarmState != WasteOverflowAlarmState)|| (mWasteOverflowAlarmState == false))
   {
      //alarm went off
       AlarmHandlingSetAlarm(EVENT_TYPE__WASTE_CONTAINER_OVERFLOW, false);
       WasteOverflowAlarmState = mWasteOverflowAlarmState;
   }*/
#ifdef CONTROL_DEBUG
                tempq = HibernateRTCSSGet();
                if (tempq < tempp)
                {
                  delta = (32768 - tempp) + tempq + 1;
                }
                else
                  delta = tempq - tempp;
                if (delta>1000)
                {
                    ReportWithPackageFilter(GeneralFilter,"------ Safety Delta  ------------", __FILE__,delta,tempq, RpMessage,tempp, 0);
                }
#endif

    return OK;
}