aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/General/BuiltInTest.c
blob: 646f189e7234621a85f465c8ea0e6599ca411bad (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * BuiltInTest.c
 *
 *  Created on: jAN 5 2021
 *      Author: shlomo
 *  This file includes the BuiltInTest indication handling functions:
 *  Motors, heaters, temperature sensors,pressure sensors,dancers
 */

#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 BuiltInTestControlId;
uint32_t BuiltInTest_VoltageMeter(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_I2C_Comm(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_UART_Comm(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Blower(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Fan(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Encoders(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Heater(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Dispenser(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_PressureSensor(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_PT_Sensor(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Motor(uint32_t IfIndex)
{
    return OK;
}
uint32_t BuiltInTest_Main_State(uint32_t IfIndex, uint32_t BusyFlag)
{
    uint8_t Motor_i,Heater_i,PT_Sensor_i,Dispenser_i;
    uint32_t Status = OK;
    /*
     *
     *Test motors (configured, used(4x,arc,flat, btsr)),
     *Test heaters (if cold, current)
     *Test pt100,
     *Test pressure sensors (dispensers, head, whs)
     *Test ???
     One report on init, define a way to report multiple failures.
     */
    BuiltInTest_VoltageMeter(0);
    BuiltInTest_I2C_Comm(I2C2_BASE);
    BuiltInTest_I2C_Comm(I2C3_BASE);
    BuiltInTest_I2C_Comm(I2C4_BASE);
    BuiltInTest_UART_Comm(0);
    for (Motor_i = 0; Motor_i<NUM_OF_MOTORS;Motor_i++)
    {
        if (isMotorConfigured(Motor_i))
        {
            Status |= BuiltInTest_Motor(Motor_i);
        }
    }
    for (Heater_i = 0; Heater_i<HEATER_TYPE_MAX_HEATERS;Heater_i++)
    {
        //if (isHeaterConfigured(Heater_i))
        {
            Status |= BuiltInTest_Heater(Heater_i);
        }
    }
    for (PT_Sensor_i = 0; PT_Sensor_i<MAX_HEAD_CARD_TEMP_SENS_ID_1;PT_Sensor_i++)
    {
        //if (isHeaterConfigured(PT_Sensor_i))
        {
            Status |= BuiltInTest_PT_Sensor(PT_Sensor_i);
        }
    }
    for (Dispenser_i = 0; Dispenser_i<MAX_SYSTEM_DISPENSERS;Dispenser_i++)
    {
        //if (isDispenserConfigured(Dispenser_i))
        {
            Status |= BuiltInTest_Dispenser(Dispenser_i);
        }
    }
    //Status |= BuiltInTest_PressureSensor(HEAD_FLOW_METER);
    //Status |= BuiltInTest_PressureSensor(NU_FLOW_METER);
    //Status |= BuiltInTest_PressureSensor(DRIER_FLOW_METER);
    //Status |= BuiltInTest_PressureSensor(TUNNEL_SENSOR_IN);
    //Status |= BuiltInTest_PressureSensor(TUNNEL_SENSOR_OUT);

    //Test motors
    return OK;
}
void BuiltInTest_Start(void)
{
    BuiltInTestControlId = AddControlCallback("BuiltInTest", BuiltInTest_Main_State, eOneSecond, TemplateDataReadCBFunction,0,0, 0 );
    //return;
}
ass="k">static readonly DependencyProperty ItemsPanelProperty = DependencyProperty.Register("ItemsPanel", typeof(ItemsPanelTemplate), typeof(TouchStaticListBox), new PropertyMetadata(null)); static TouchStaticListBox() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchStaticListBox), new FrameworkPropertyMetadata(typeof(TouchStaticListBox))); } public TouchStaticListBox() { ListBoxItemLoadedCommand = new RelayCommand<TouchStaticListBoxItem>(RegisterListBoxItemEvents); Loaded += TouchStaticListBox_Loaded; } private void TouchStaticListBox_Loaded(object sender, RoutedEventArgs e) { OnSelectdItemChanged(); } private void RegisterListBoxItemEvents(TouchStaticListBoxItem item) { if (item.Tag == null) { item.Tag = 1; item.RegisterForPreviewMouseOrTouchUp(OnItemMouseUp); } } private void OnItemMouseUp(object sender, MouseOrTouchEventArgs e) { var scrollViewer = this.FindAncestor<LightTouchScrollViewer>(); if (scrollViewer != null && scrollViewer.IsAfterScrolling) return; var item = (e.Source is TouchStaticListBoxItem) ? e.Source as TouchStaticListBoxItem : (e.Source as DependencyObject).FindAncestor<TouchStaticListBoxItem>(); SelectedItem = item.DataContext; } private void OnSelectdItemChanged() { var items = GetItems(); items.ForEach(x => x.IsSelected = false); if (SelectedItem != null) { var selected_item = items.FirstOrDefault(x => SelectedItem.Equals(x.DataContext)); if (selected_item != null) { selected_item.IsSelected = true; } } } private List<TouchStaticListBoxItem> GetItems() { return this.FindVisualChildren<TouchStaticListBoxItem>().ToList(); } } }