This has increased comments and a readme
Dependencies: mbed mbed-rtos TextLCD
Interface/Interface.cpp@25:9751619fa030, 2019-02-18 (annotated)
- Committer:
- thomasmorris
- Date:
- Mon Feb 18 22:04:54 2019 +0000
- Revision:
- 25:9751619fa030
- Parent:
- 24:728de4bf961e
- Child:
- 26:83550fc299aa
GET IN THE BIN
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 23:07a368f2cdb1 | 1 | #include "Interface.hpp" //Include the header file, this acts like a series of forward declarations |
thomasmorris | 16:9f98ec0ededb | 2 | //Constructor |
thomasmorris | 25:9751619fa030 | 3 | INTERFACE::INTERFACE(){}//Set all values to 0 |
thomasmorris | 25:9751619fa030 | 4 | |
thomasmorris | 16:9f98ec0ededb | 5 | INTERFACE::~INTERFACE(){} //Destructor |
thomasmorris | 16:9f98ec0ededb | 6 | //Interrupt run functions |
thomasmorris | 17:68b3fdabe4c5 | 7 | void INTERFACE::Interface_Init()//Set all values to 0 bar the default turns |
thomasmorris | 16:9f98ec0ededb | 8 | { |
thomasmorris | 24:728de4bf961e | 9 | Led_Select_Left_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 10 | Led_Select_Left = 0; |
thomasmorris | 24:728de4bf961e | 11 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 12 | |
thomasmorris | 24:728de4bf961e | 13 | Led_Select_Right_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 14 | Led_Select_Right= 0; |
thomasmorris | 24:728de4bf961e | 15 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 16 | |
thomasmorris | 23:07a368f2cdb1 | 17 | _Function_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 18 | _Function =2; |
thomasmorris | 23:07a368f2cdb1 | 19 | _Function_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 20 | |
thomasmorris | 23:07a368f2cdb1 | 21 | _Twist_Go_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 22 | _Twist_Go =0; |
thomasmorris | 23:07a368f2cdb1 | 23 | _Twist_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 24 | |
thomasmorris | 23:07a368f2cdb1 | 25 | _Anneal_Go_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 26 | _Anneal_Go =0; |
thomasmorris | 23:07a368f2cdb1 | 27 | _Anneal_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 28 | |
thomasmorris | 23:07a368f2cdb1 | 29 | _Test_Go_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 30 | _Test_Go =0; |
thomasmorris | 23:07a368f2cdb1 | 31 | _Test_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 32 | |
thomasmorris | 23:07a368f2cdb1 | 33 | _Select_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 34 | _Select =0; |
thomasmorris | 23:07a368f2cdb1 | 35 | _Select_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 36 | |
thomasmorris | 23:07a368f2cdb1 | 37 | _Turns_Done_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 38 | _Turns_Done =0; |
thomasmorris | 23:07a368f2cdb1 | 39 | _Turns_Done_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 40 | |
thomasmorris | 23:07a368f2cdb1 | 41 | _Turns_Todo_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 42 | if(Type_of_Rig == 2) |
thomasmorris | 25:9751619fa030 | 43 | { |
thomasmorris | 25:9751619fa030 | 44 | _Turns_Todo = Default_Coiling_Turns; |
thomasmorris | 25:9751619fa030 | 45 | } |
thomasmorris | 25:9751619fa030 | 46 | else if(Type_of_Rig == 3) |
thomasmorris | 25:9751619fa030 | 47 | { |
thomasmorris | 25:9751619fa030 | 48 | _Turns_Todo = Default_Twisting_Turns; |
thomasmorris | 25:9751619fa030 | 49 | } |
thomasmorris | 23:07a368f2cdb1 | 50 | _Turns_Todo_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 51 | |
thomasmorris | 23:07a368f2cdb1 | 52 | _Loop_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 53 | _Loop =6; |
thomasmorris | 23:07a368f2cdb1 | 54 | _Loop_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 55 | |
thomasmorris | 25:9751619fa030 | 56 | _On_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 57 | _On_Time =6; |
thomasmorris | 25:9751619fa030 | 58 | _On_Time_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 59 | |
thomasmorris | 25:9751619fa030 | 60 | _Off_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 61 | _Off_Time =6; |
thomasmorris | 25:9751619fa030 | 62 | _Off_Time_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 63 | |
thomasmorris | 23:07a368f2cdb1 | 64 | _Duty_Cycle_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 65 | _Duty_Cycle =0; |
thomasmorris | 23:07a368f2cdb1 | 66 | _Duty_Cycle_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 67 | |
thomasmorris | 23:07a368f2cdb1 | 68 | _Power_Time_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 69 | _Power_Time =0; |
thomasmorris | 23:07a368f2cdb1 | 70 | _Power_Time_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 71 | |
thomasmorris | 23:07a368f2cdb1 | 72 | Led_Select_Left_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 73 | Led_Select_Left = 0; |
thomasmorris | 23:07a368f2cdb1 | 74 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 75 | |
thomasmorris | 23:07a368f2cdb1 | 76 | Led_Select_Right_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 77 | Led_Select_Right= 0; |
thomasmorris | 23:07a368f2cdb1 | 78 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 79 | |
thomasmorris | 23:07a368f2cdb1 | 80 | Led_Power_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 81 | Led_Power =0; |
thomasmorris | 23:07a368f2cdb1 | 82 | Led_Power_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 83 | |
thomasmorris | 23:07a368f2cdb1 | 84 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 85 | _System_Running =0; |
thomasmorris | 23:07a368f2cdb1 | 86 | _System_Running_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 87 | |
thomasmorris | 24:728de4bf961e | 88 | |
thomasmorris | 24:728de4bf961e | 89 | Led_Select_Left_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 90 | Led_Select_Left = 0; |
thomasmorris | 24:728de4bf961e | 91 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 92 | |
thomasmorris | 24:728de4bf961e | 93 | Led_Select_Right_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 94 | Led_Select_Right= 1; |
thomasmorris | 24:728de4bf961e | 95 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 96 | } |
thomasmorris | 17:68b3fdabe4c5 | 97 | void INTERFACE::Up()//Up Routine |
thomasmorris | 16:9f98ec0ededb | 98 | { |
thomasmorris | 25:9751619fa030 | 99 | if (_Function == 2 || _Function == 3 )//Coiling or twist Function |
thomasmorris | 16:9f98ec0ededb | 100 | { |
thomasmorris | 23:07a368f2cdb1 | 101 | _Turns_Todo_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 102 | while(button_up.read() == 1) |
thomasmorris | 25:9751619fa030 | 103 | { |
thomasmorris | 25:9751619fa030 | 104 | _Turns_Todo = _Turns_Todo +1; |
thomasmorris | 25:9751619fa030 | 105 | Thread::wait(100); |
thomasmorris | 25:9751619fa030 | 106 | } |
thomasmorris | 23:07a368f2cdb1 | 107 | _Turns_Todo_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 108 | } |
thomasmorris | 25:9751619fa030 | 109 | else if (_Function == 0)//Annealing Function |
thomasmorris | 16:9f98ec0ededb | 110 | { |
thomasmorris | 25:9751619fa030 | 111 | if (_Select == 0)//Select = 0 |
thomasmorris | 23:07a368f2cdb1 | 112 | { |
thomasmorris | 23:07a368f2cdb1 | 113 | _Loop_mutex.lock(); |
thomasmorris | 16:9f98ec0ededb | 114 | _Loop = _Loop + 1; //Increases Repetitions in Annealing |
thomasmorris | 23:07a368f2cdb1 | 115 | _Loop_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 116 | } |
thomasmorris | 25:9751619fa030 | 117 | else if (_Select == 1)//Select = 1 |
thomasmorris | 16:9f98ec0ededb | 118 | { |
thomasmorris | 25:9751619fa030 | 119 | _On_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 120 | _On_Time = _On_Time + 1; //Increases On time |
thomasmorris | 25:9751619fa030 | 121 | _On_Time_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 122 | } |
thomasmorris | 25:9751619fa030 | 123 | else if (_Select == 2)//Select = 1 |
thomasmorris | 25:9751619fa030 | 124 | { |
thomasmorris | 25:9751619fa030 | 125 | _Off_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 126 | _Off_Time = _On_Time + 1; //Increases Off time |
thomasmorris | 25:9751619fa030 | 127 | _Off_Time_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 128 | } |
thomasmorris | 16:9f98ec0ededb | 129 | } |
thomasmorris | 25:9751619fa030 | 130 | else if (_Function == 1)//Test Function |
thomasmorris | 16:9f98ec0ededb | 131 | { |
thomasmorris | 25:9751619fa030 | 132 | if (_Select == 0)//Select = 0 |
thomasmorris | 16:9f98ec0ededb | 133 | { |
thomasmorris | 16:9f98ec0ededb | 134 | if (_Duty_Cycle < 100) |
thomasmorris | 16:9f98ec0ededb | 135 | { |
thomasmorris | 23:07a368f2cdb1 | 136 | _Duty_Cycle_mutex.lock(); |
thomasmorris | 16:9f98ec0ededb | 137 | _Duty_Cycle = _Duty_Cycle + 10; //Increases Testing Duty Cycle |
thomasmorris | 23:07a368f2cdb1 | 138 | _Duty_Cycle_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 139 | } |
thomasmorris | 24:728de4bf961e | 140 | } |
thomasmorris | 25:9751619fa030 | 141 | else if (_Select == 1)//Select = 1 |
thomasmorris | 24:728de4bf961e | 142 | { |
thomasmorris | 24:728de4bf961e | 143 | _Power_Time_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 144 | _Power_Time = _Power_Time + 1; //Increases time on |
thomasmorris | 24:728de4bf961e | 145 | _Power_Time_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 146 | } |
thomasmorris | 16:9f98ec0ededb | 147 | } |
thomasmorris | 16:9f98ec0ededb | 148 | } |
thomasmorris | 17:68b3fdabe4c5 | 149 | void INTERFACE::Down()//Down Routine |
thomasmorris | 16:9f98ec0ededb | 150 | { |
thomasmorris | 25:9751619fa030 | 151 | if (_Function == 2 || _Function == 3)//Coiling or twist Function |
thomasmorris | 25:9751619fa030 | 152 | { |
thomasmorris | 23:07a368f2cdb1 | 153 | _Turns_Todo_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 154 | while(button_up.read() == 1) |
thomasmorris | 25:9751619fa030 | 155 | { |
thomasmorris | 25:9751619fa030 | 156 | _Turns_Todo = _Turns_Todo -1; |
thomasmorris | 25:9751619fa030 | 157 | Thread::wait(100); |
thomasmorris | 25:9751619fa030 | 158 | } |
thomasmorris | 23:07a368f2cdb1 | 159 | _Turns_Todo_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 160 | } |
thomasmorris | 25:9751619fa030 | 161 | else if (_Function == 0)//Anneal Function |
thomasmorris | 16:9f98ec0ededb | 162 | { |
thomasmorris | 25:9751619fa030 | 163 | if (_Select == 0)//Select = 0 |
thomasmorris | 16:9f98ec0ededb | 164 | { |
thomasmorris | 21:6d9f6a986647 | 165 | |
thomasmorris | 16:9f98ec0ededb | 166 | if (_Loop > 0) |
thomasmorris | 16:9f98ec0ededb | 167 | { |
thomasmorris | 23:07a368f2cdb1 | 168 | _Loop_mutex.lock(); |
thomasmorris | 16:9f98ec0ededb | 169 | _Loop = _Loop - 1; |
thomasmorris | 23:07a368f2cdb1 | 170 | _Loop_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 171 | } |
thomasmorris | 24:728de4bf961e | 172 | } |
thomasmorris | 25:9751619fa030 | 173 | else if (_Select == 1)//Select = 1 |
thomasmorris | 24:728de4bf961e | 174 | { |
thomasmorris | 25:9751619fa030 | 175 | _On_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 176 | _On_Time = _On_Time - 1; //Decrease On time |
thomasmorris | 25:9751619fa030 | 177 | _On_Time_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 178 | } |
thomasmorris | 25:9751619fa030 | 179 | else if (_Select == 2)//Select = 1 |
thomasmorris | 25:9751619fa030 | 180 | { |
thomasmorris | 25:9751619fa030 | 181 | _Off_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 182 | _Off_Time = _On_Time - 1; //Decrements Off time |
thomasmorris | 25:9751619fa030 | 183 | _Off_Time_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 184 | } |
thomasmorris | 16:9f98ec0ededb | 185 | } |
thomasmorris | 25:9751619fa030 | 186 | else if (_Function == 1)//Test Function |
thomasmorris | 16:9f98ec0ededb | 187 | { |
thomasmorris | 25:9751619fa030 | 188 | if (_Select == 0)//Select = 0 |
thomasmorris | 16:9f98ec0ededb | 189 | { |
thomasmorris | 16:9f98ec0ededb | 190 | if (_Duty_Cycle > 0) |
thomasmorris | 16:9f98ec0ededb | 191 | { |
thomasmorris | 23:07a368f2cdb1 | 192 | _Duty_Cycle_mutex.lock(); |
thomasmorris | 16:9f98ec0ededb | 193 | _Duty_Cycle = _Duty_Cycle - 10; //Decreases duty |
thomasmorris | 23:07a368f2cdb1 | 194 | _Duty_Cycle_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 195 | } |
thomasmorris | 24:728de4bf961e | 196 | } |
thomasmorris | 25:9751619fa030 | 197 | else if (_Select == 1)//Select = 1 |
thomasmorris | 24:728de4bf961e | 198 | { |
thomasmorris | 24:728de4bf961e | 199 | if (_Power_Time > 0) |
thomasmorris | 16:9f98ec0ededb | 200 | { |
thomasmorris | 24:728de4bf961e | 201 | _Power_Time_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 202 | _Power_Time = _Power_Time - 1; //Decreases Time on |
thomasmorris | 24:728de4bf961e | 203 | _Power_Time_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 204 | } |
thomasmorris | 16:9f98ec0ededb | 205 | } |
thomasmorris | 24:728de4bf961e | 206 | |
thomasmorris | 16:9f98ec0ededb | 207 | } |
thomasmorris | 16:9f98ec0ededb | 208 | } |
thomasmorris | 17:68b3fdabe4c5 | 209 | void INTERFACE::Start_Stop()//Start / Stop Routine |
thomasmorris | 16:9f98ec0ededb | 210 | { |
thomasmorris | 24:728de4bf961e | 211 | |
thomasmorris | 24:728de4bf961e | 212 | if(_System_Running != 2) |
thomasmorris | 24:728de4bf961e | 213 | { |
thomasmorris | 24:728de4bf961e | 214 | _System_Running = !_System_Running; |
thomasmorris | 24:728de4bf961e | 215 | } |
thomasmorris | 23:07a368f2cdb1 | 216 | //System not running cases (START) |
thomasmorris | 24:728de4bf961e | 217 | printf("Function is: %d, System is: %d\n",_Function,_System_Running); |
thomasmorris | 24:728de4bf961e | 218 | |
thomasmorris | 24:728de4bf961e | 219 | //System Running cases (Unpause) |
thomasmorris | 25:9751619fa030 | 220 | if ((_Function == 2 || _Function == 3) & _System_Running == 2)//Coil Twist selected to be unpaused |
thomasmorris | 23:07a368f2cdb1 | 221 | { |
thomasmorris | 24:728de4bf961e | 222 | _Twist_Stop_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 223 | _Twist_Stop = false; |
thomasmorris | 24:728de4bf961e | 224 | _Twist_Stop_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 225 | |
thomasmorris | 23:07a368f2cdb1 | 226 | _Twist_Go_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 227 | _Twist_Go = true;//toggle used for coiling and twisting and Running the code |
thomasmorris | 23:07a368f2cdb1 | 228 | _Twist_Go_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 229 | |
thomasmorris | 24:728de4bf961e | 230 | STEPPER_MOTOR_1.Unpause_Code(); |
thomasmorris | 24:728de4bf961e | 231 | |
thomasmorris | 25:9751619fa030 | 232 | if(_Function == 2)//Coiling |
thomasmorris | 25:9751619fa030 | 233 | { |
thomasmorris | 25:9751619fa030 | 234 | printf("Coiling Code unpaused\n"); |
thomasmorris | 25:9751619fa030 | 235 | } |
thomasmorris | 25:9751619fa030 | 236 | if(_Function == 3)//Twisiting |
thomasmorris | 25:9751619fa030 | 237 | { |
thomasmorris | 25:9751619fa030 | 238 | printf("Twisting Code unpaused\n"); |
thomasmorris | 25:9751619fa030 | 239 | } |
thomasmorris | 24:728de4bf961e | 240 | _System_Running = 0; |
thomasmorris | 24:728de4bf961e | 241 | |
thomasmorris | 23:07a368f2cdb1 | 242 | } |
thomasmorris | 25:9751619fa030 | 243 | else if (_Function == 0 & _System_Running == 2) //Annealing selected to be unpaused |
thomasmorris | 23:07a368f2cdb1 | 244 | { |
thomasmorris | 24:728de4bf961e | 245 | _Anneal_Stop_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 246 | _Anneal_Stop = false; |
thomasmorris | 24:728de4bf961e | 247 | _Anneal_Stop_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 248 | printf("Annealing Code unpaused\n"); |
thomasmorris | 24:728de4bf961e | 249 | |
thomasmorris | 23:07a368f2cdb1 | 250 | _Anneal_Go_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 251 | _Anneal_Go = true;//toggle and Run the code |
thomasmorris | 23:07a368f2cdb1 | 252 | _Anneal_Go_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 253 | _System_Running = 0; |
thomasmorris | 23:07a368f2cdb1 | 254 | } |
thomasmorris | 25:9751619fa030 | 255 | else if (_Function == 1 & _System_Running == 2) //Testing selected to be re run |
thomasmorris | 16:9f98ec0ededb | 256 | { |
thomasmorris | 24:728de4bf961e | 257 | _Test_Stop_mutex.lock(); |
thomasmorris | 24:728de4bf961e | 258 | _Test_Stop = false; |
thomasmorris | 24:728de4bf961e | 259 | _Test_Stop_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 260 | printf("Testing Code unpaused\n"); |
thomasmorris | 23:07a368f2cdb1 | 261 | _Test_Go_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 262 | _Test_Go = true;//toggle and run the code |
thomasmorris | 23:07a368f2cdb1 | 263 | _Test_Go_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 264 | _System_Running = 0; |
thomasmorris | 24:728de4bf961e | 265 | |
thomasmorris | 16:9f98ec0ededb | 266 | } |
thomasmorris | 23:07a368f2cdb1 | 267 | //System Running cases (STOP) |
thomasmorris | 25:9751619fa030 | 268 | else if ((_Function == 2 || _Function == 3) & _System_Running == 1)//Coiling / Twisting selected to be stopped |
thomasmorris | 23:07a368f2cdb1 | 269 | { |
thomasmorris | 23:07a368f2cdb1 | 270 | _Twist_Stop_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 271 | _Twist_Stop = true; |
thomasmorris | 23:07a368f2cdb1 | 272 | _Twist_Stop_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 273 | |
thomasmorris | 25:9751619fa030 | 274 | if(_Function == 2) |
thomasmorris | 25:9751619fa030 | 275 | { |
thomasmorris | 25:9751619fa030 | 276 | printf("Coiling Code Paused\n"); |
thomasmorris | 25:9751619fa030 | 277 | } |
thomasmorris | 25:9751619fa030 | 278 | if(_Function == 3) |
thomasmorris | 25:9751619fa030 | 279 | { |
thomasmorris | 25:9751619fa030 | 280 | printf("Twisting Code Paused\n"); |
thomasmorris | 25:9751619fa030 | 281 | } |
thomasmorris | 23:07a368f2cdb1 | 282 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 283 | _System_Running = 2; |
thomasmorris | 23:07a368f2cdb1 | 284 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 285 | STEPPER_MOTOR_1.Pause_Code(); |
thomasmorris | 23:07a368f2cdb1 | 286 | } |
thomasmorris | 25:9751619fa030 | 287 | else if (_Function == 0 & _System_Running == 1) //Annealing selected to be stopped |
thomasmorris | 23:07a368f2cdb1 | 288 | { |
thomasmorris | 23:07a368f2cdb1 | 289 | _Anneal_Stop_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 290 | _Anneal_Stop = true; |
thomasmorris | 23:07a368f2cdb1 | 291 | _Anneal_Stop_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 292 | printf("Annealing Code Paused\n"); |
thomasmorris | 23:07a368f2cdb1 | 293 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 294 | _System_Running = 2; |
thomasmorris | 23:07a368f2cdb1 | 295 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 296 | } |
thomasmorris | 25:9751619fa030 | 297 | else if (_Function == 1 & _System_Running == 1) //Testing selected to be stopped |
thomasmorris | 16:9f98ec0ededb | 298 | { |
thomasmorris | 23:07a368f2cdb1 | 299 | _Test_Stop_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 300 | _Test_Stop = true; |
thomasmorris | 23:07a368f2cdb1 | 301 | _Test_Stop_mutex.unlock(); |
thomasmorris | 24:728de4bf961e | 302 | |
thomasmorris | 23:07a368f2cdb1 | 303 | printf("Testing Code Paused\n"); |
thomasmorris | 24:728de4bf961e | 304 | |
thomasmorris | 23:07a368f2cdb1 | 305 | _Tendon_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 306 | Tendon_Power=0; |
thomasmorris | 23:07a368f2cdb1 | 307 | _Tendon_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 308 | |
thomasmorris | 23:07a368f2cdb1 | 309 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 310 | _System_Running = 2; |
thomasmorris | 23:07a368f2cdb1 | 311 | _System_Running_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 312 | } |
thomasmorris | 24:728de4bf961e | 313 | //Start Cases |
thomasmorris | 25:9751619fa030 | 314 | else if ((_Function == 2 || _Function == 3) & _System_Running == 0)//Twist selected |
thomasmorris | 23:07a368f2cdb1 | 315 | { |
thomasmorris | 23:07a368f2cdb1 | 316 | _Twist_Go_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 317 | _Twist_Go = true;//toggle used for coiling and twisting and Running the code |
thomasmorris | 23:07a368f2cdb1 | 318 | _Twist_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 319 | } |
thomasmorris | 25:9751619fa030 | 320 | else if (_Function == 0 & _System_Running == 0) //Annealing selected |
thomasmorris | 16:9f98ec0ededb | 321 | { |
thomasmorris | 23:07a368f2cdb1 | 322 | _Anneal_Go_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 323 | _Anneal_Go = true;//toggle and Run the code |
thomasmorris | 23:07a368f2cdb1 | 324 | _Anneal_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 325 | } |
thomasmorris | 25:9751619fa030 | 326 | else if (_Function == 1 & _System_Running == 0) //Testing selected |
thomasmorris | 23:07a368f2cdb1 | 327 | { |
thomasmorris | 23:07a368f2cdb1 | 328 | _Test_Go_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 329 | _Test_Go = true;//toggle and run the code |
thomasmorris | 23:07a368f2cdb1 | 330 | _Test_Go_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 331 | } |
thomasmorris | 16:9f98ec0ededb | 332 | } |
thomasmorris | 17:68b3fdabe4c5 | 333 | void INTERFACE::Function()//Function Routine used to increment through the three functions |
thomasmorris | 16:9f98ec0ededb | 334 | { |
thomasmorris | 17:68b3fdabe4c5 | 335 | /* |
thomasmorris | 25:9751619fa030 | 336 | Function 0 = Anneal |
thomasmorris | 25:9751619fa030 | 337 | Function 1 = Test |
thomasmorris | 25:9751619fa030 | 338 | Function 2 = Coiling |
thomasmorris | 25:9751619fa030 | 339 | Function 3 = Twisting |
thomasmorris | 17:68b3fdabe4c5 | 340 | */ |
thomasmorris | 25:9751619fa030 | 341 | |
thomasmorris | 25:9751619fa030 | 342 | if(Type_of_Rig == 2) |
thomasmorris | 25:9751619fa030 | 343 | { |
thomasmorris | 25:9751619fa030 | 344 | if(_Function < 2) |
thomasmorris | 25:9751619fa030 | 345 | { |
thomasmorris | 25:9751619fa030 | 346 | _Function_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 347 | _Function = _Function + 1; |
thomasmorris | 25:9751619fa030 | 348 | _Function_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 349 | } |
thomasmorris | 25:9751619fa030 | 350 | else if(_Function == 2) |
thomasmorris | 25:9751619fa030 | 351 | { |
thomasmorris | 25:9751619fa030 | 352 | _Function_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 353 | _Function = 0; |
thomasmorris | 25:9751619fa030 | 354 | _Function_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 355 | } |
thomasmorris | 16:9f98ec0ededb | 356 | } |
thomasmorris | 25:9751619fa030 | 357 | else if(Type_of_Rig == 3) |
thomasmorris | 16:9f98ec0ededb | 358 | { |
thomasmorris | 25:9751619fa030 | 359 | if(_Function == 3) |
thomasmorris | 25:9751619fa030 | 360 | { |
thomasmorris | 25:9751619fa030 | 361 | _Function_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 362 | _Function = 0; |
thomasmorris | 25:9751619fa030 | 363 | _Function_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 364 | } |
thomasmorris | 25:9751619fa030 | 365 | else if(_Function < 2) |
thomasmorris | 25:9751619fa030 | 366 | { |
thomasmorris | 25:9751619fa030 | 367 | _Function_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 368 | _Function = _Function + 1; |
thomasmorris | 25:9751619fa030 | 369 | _Function_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 370 | } |
thomasmorris | 25:9751619fa030 | 371 | else if(_Function == 2) |
thomasmorris | 25:9751619fa030 | 372 | { |
thomasmorris | 25:9751619fa030 | 373 | _Function_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 374 | _Function = 3; |
thomasmorris | 25:9751619fa030 | 375 | _Function_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 376 | } |
thomasmorris | 16:9f98ec0ededb | 377 | } |
thomasmorris | 16:9f98ec0ededb | 378 | } |
thomasmorris | 17:68b3fdabe4c5 | 379 | void INTERFACE::Select()//Select Routine |
thomasmorris | 16:9f98ec0ededb | 380 | { |
thomasmorris | 23:07a368f2cdb1 | 381 | _Select_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 382 | if(_Select == 0 & _Function == !2)//All but anneal have 2 component menu's |
thomasmorris | 25:9751619fa030 | 383 | { |
thomasmorris | 25:9751619fa030 | 384 | _Select = 1; |
thomasmorris | 25:9751619fa030 | 385 | } |
thomasmorris | 25:9751619fa030 | 386 | else if(_Select == 1 & _Function == !2)//Toggle the value |
thomasmorris | 25:9751619fa030 | 387 | { |
thomasmorris | 25:9751619fa030 | 388 | _Select = 0; |
thomasmorris | 25:9751619fa030 | 389 | } |
thomasmorris | 25:9751619fa030 | 390 | else if(_Function == 1 & _Select < 2) |
thomasmorris | 25:9751619fa030 | 391 | { |
thomasmorris | 25:9751619fa030 | 392 | _Select = _Select + 1; |
thomasmorris | 25:9751619fa030 | 393 | } |
thomasmorris | 25:9751619fa030 | 394 | else if(_Select == 2 & _Function == 1)//Set select to 0 if the function is anneal, as anneal has 3 components in the menu |
thomasmorris | 25:9751619fa030 | 395 | { |
thomasmorris | 25:9751619fa030 | 396 | _Select = 0; |
thomasmorris | 25:9751619fa030 | 397 | } |
thomasmorris | 23:07a368f2cdb1 | 398 | _Select_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 399 | if(_Function == 0) |
thomasmorris | 21:6d9f6a986647 | 400 | { |
thomasmorris | 23:07a368f2cdb1 | 401 | Led_Select_Left_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 402 | Led_Select_Right = 1; |
thomasmorris | 23:07a368f2cdb1 | 403 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 404 | } |
thomasmorris | 25:9751619fa030 | 405 | else if(_Function == 1 & _Select == false) |
thomasmorris | 23:07a368f2cdb1 | 406 | { |
thomasmorris | 23:07a368f2cdb1 | 407 | Led_Select_Left_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 408 | Led_Select_Left = 1; |
thomasmorris | 23:07a368f2cdb1 | 409 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 410 | |
thomasmorris | 23:07a368f2cdb1 | 411 | Led_Select_Right_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 412 | Led_Select_Right= 0; |
thomasmorris | 23:07a368f2cdb1 | 413 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 21:6d9f6a986647 | 414 | } |
thomasmorris | 25:9751619fa030 | 415 | else if(_Function == 1 & _Select == true) |
thomasmorris | 21:6d9f6a986647 | 416 | { |
thomasmorris | 23:07a368f2cdb1 | 417 | Led_Select_Left_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 418 | Led_Select_Left = 0; |
thomasmorris | 23:07a368f2cdb1 | 419 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 420 | |
thomasmorris | 23:07a368f2cdb1 | 421 | Led_Select_Right_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 422 | Led_Select_Right= 1; |
thomasmorris | 23:07a368f2cdb1 | 423 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 21:6d9f6a986647 | 424 | } |
thomasmorris | 25:9751619fa030 | 425 | else if(_Function == 2 & _Select == false) |
thomasmorris | 25:9751619fa030 | 426 | { |
thomasmorris | 25:9751619fa030 | 427 | Led_Select_Left_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 428 | Led_Select_Left = 1; |
thomasmorris | 25:9751619fa030 | 429 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 430 | |
thomasmorris | 25:9751619fa030 | 431 | Led_Select_Right_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 432 | Led_Select_Right= 0; |
thomasmorris | 25:9751619fa030 | 433 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 434 | } |
thomasmorris | 25:9751619fa030 | 435 | else if(_Function == 2 & _Select == true) |
thomasmorris | 25:9751619fa030 | 436 | { |
thomasmorris | 25:9751619fa030 | 437 | Led_Select_Left_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 438 | Led_Select_Left = 0; |
thomasmorris | 25:9751619fa030 | 439 | Led_Select_Left_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 440 | |
thomasmorris | 25:9751619fa030 | 441 | Led_Select_Right_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 442 | Led_Select_Right= 1; |
thomasmorris | 25:9751619fa030 | 443 | Led_Select_Right_mutex.unlock(); |
thomasmorris | 25:9751619fa030 | 444 | } |
thomasmorris | 16:9f98ec0ededb | 445 | } |
thomasmorris | 17:68b3fdabe4c5 | 446 | void INTERFACE::Interface_main()//Main Routine to execute commands when the start button has been pressed |
thomasmorris | 16:9f98ec0ededb | 447 | { |
thomasmorris | 25:9751619fa030 | 448 | if (_Function == 2 || _Function == 3) //Turning Code |
thomasmorris | 16:9f98ec0ededb | 449 | { |
thomasmorris | 16:9f98ec0ededb | 450 | if (_Twist_Go == true) |
thomasmorris | 16:9f98ec0ededb | 451 | { |
thomasmorris | 23:07a368f2cdb1 | 452 | Led_Power_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 453 | Led_Power = 1; |
thomasmorris | 23:07a368f2cdb1 | 454 | Led_Power_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 455 | |
thomasmorris | 23:07a368f2cdb1 | 456 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 457 | _System_Running = 1; |
thomasmorris | 23:07a368f2cdb1 | 458 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 459 | |
thomasmorris | 25:9751619fa030 | 460 | STEPPER_MOTOR_1.Rotate_Steps(_Turns_Todo,_Function);//Rotates for the specified number of steps given |
thomasmorris | 23:07a368f2cdb1 | 461 | |
thomasmorris | 23:07a368f2cdb1 | 462 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 463 | _System_Running = 0; |
thomasmorris | 23:07a368f2cdb1 | 464 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 465 | |
thomasmorris | 23:07a368f2cdb1 | 466 | |
thomasmorris | 23:07a368f2cdb1 | 467 | _Twist_Go_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 468 | _Twist_Go = false; |
thomasmorris | 23:07a368f2cdb1 | 469 | _Twist_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 470 | |
thomasmorris | 23:07a368f2cdb1 | 471 | Led_Power_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 472 | Led_Power = 0; |
thomasmorris | 23:07a368f2cdb1 | 473 | Led_Power_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 474 | } |
thomasmorris | 16:9f98ec0ededb | 475 | } |
thomasmorris | 25:9751619fa030 | 476 | else if (_Function == 0) //Annealing Code |
thomasmorris | 16:9f98ec0ededb | 477 | { |
thomasmorris | 16:9f98ec0ededb | 478 | if (_Anneal_Go == true) |
thomasmorris | 16:9f98ec0ededb | 479 | { |
thomasmorris | 23:07a368f2cdb1 | 480 | Led_Power_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 481 | Led_Power = 1; |
thomasmorris | 23:07a368f2cdb1 | 482 | Led_Power_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 483 | |
thomasmorris | 23:07a368f2cdb1 | 484 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 485 | _System_Running = 1; |
thomasmorris | 23:07a368f2cdb1 | 486 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 487 | |
thomasmorris | 16:9f98ec0ededb | 488 | for ( int counter = 0; counter < _Loop; counter++) //Loop value, check if works |
thomasmorris | 16:9f98ec0ededb | 489 | { |
thomasmorris | 23:07a368f2cdb1 | 490 | if(_System_Running == 1) |
thomasmorris | 23:07a368f2cdb1 | 491 | { |
thomasmorris | 23:07a368f2cdb1 | 492 | _Tendon_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 493 | Tendon_Power.period(0.01); // set PWM period to 10 ms don't use pwm have this just to declare |
thomasmorris | 23:07a368f2cdb1 | 494 | Tendon_Power=1; // set duty cycle to 100% |
thomasmorris | 25:9751619fa030 | 495 | _On_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 496 | wait(_On_Time);//Variable |
thomasmorris | 25:9751619fa030 | 497 | _On_Time_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 498 | Tendon_Power=0; // set duty cycle to 0% |
thomasmorris | 25:9751619fa030 | 499 | _Off_Time_mutex.lock(); |
thomasmorris | 25:9751619fa030 | 500 | wait(_Off_Time);//Fixed off time |
thomasmorris | 25:9751619fa030 | 501 | _Off_Time_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 502 | _Tendon_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 503 | } |
thomasmorris | 23:07a368f2cdb1 | 504 | while(_System_Running == 2)//Stops the system and just spins in this while loop until system running is not paused |
thomasmorris | 23:07a368f2cdb1 | 505 | { |
thomasmorris | 23:07a368f2cdb1 | 506 | _Tendon_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 507 | Tendon_Power =0; |
thomasmorris | 23:07a368f2cdb1 | 508 | _Tendon_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 509 | } |
thomasmorris | 16:9f98ec0ededb | 510 | } |
thomasmorris | 23:07a368f2cdb1 | 511 | |
thomasmorris | 23:07a368f2cdb1 | 512 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 513 | _System_Running = 0; |
thomasmorris | 23:07a368f2cdb1 | 514 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 515 | |
thomasmorris | 23:07a368f2cdb1 | 516 | _Anneal_Go_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 517 | _Anneal_Go = false; |
thomasmorris | 23:07a368f2cdb1 | 518 | _Anneal_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 519 | |
thomasmorris | 23:07a368f2cdb1 | 520 | Led_Power_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 521 | Led_Power = 0; |
thomasmorris | 23:07a368f2cdb1 | 522 | Led_Power_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 523 | } |
thomasmorris | 16:9f98ec0ededb | 524 | } |
thomasmorris | 25:9751619fa030 | 525 | else if (_Function == 1) //Testing Code //This code is paused / unpaused in start / stop note this code is not paused it is re run. |
thomasmorris | 16:9f98ec0ededb | 526 | { |
thomasmorris | 16:9f98ec0ededb | 527 | if (_Test_Go == true) |
thomasmorris | 16:9f98ec0ededb | 528 | { |
thomasmorris | 23:07a368f2cdb1 | 529 | Led_Power_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 530 | Led_Power = 1; |
thomasmorris | 23:07a368f2cdb1 | 531 | Led_Power_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 532 | |
thomasmorris | 23:07a368f2cdb1 | 533 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 534 | _System_Running = 1; |
thomasmorris | 23:07a368f2cdb1 | 535 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 536 | |
thomasmorris | 23:07a368f2cdb1 | 537 | _Tendon_mutex.lock(); |
thomasmorris | 16:9f98ec0ededb | 538 | Tendon_Power.period(0.01); // set PWM period to 10 ms don't use pwm have this just to declare |
thomasmorris | 16:9f98ec0ededb | 539 | Tendon_Power= _Duty_Cycle / 100; // set duty cycle to variable input from buttons between 0-1 (on lcd this is a percentage) also increment by values of 10 |
thomasmorris | 16:9f98ec0ededb | 540 | wait(_Power_Time);//Variable on time for power on |
thomasmorris | 16:9f98ec0ededb | 541 | Tendon_Power=0; // set duty cycle to 0% and power off |
thomasmorris | 23:07a368f2cdb1 | 542 | _Tendon_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 543 | |
thomasmorris | 23:07a368f2cdb1 | 544 | _System_Running_mutex.lock(); |
thomasmorris | 23:07a368f2cdb1 | 545 | _System_Running = 0; |
thomasmorris | 23:07a368f2cdb1 | 546 | _System_Running_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 547 | |
thomasmorris | 23:07a368f2cdb1 | 548 | _Test_Go_mutex.lock(); |
thomasmorris | 17:68b3fdabe4c5 | 549 | _Test_Go = false; |
thomasmorris | 23:07a368f2cdb1 | 550 | _Test_Go_mutex.unlock(); |
thomasmorris | 23:07a368f2cdb1 | 551 | |
thomasmorris | 23:07a368f2cdb1 | 552 | Led_Power_mutex.lock(); |
thomasmorris | 21:6d9f6a986647 | 553 | Led_Power = 0; |
thomasmorris | 23:07a368f2cdb1 | 554 | Led_Power_mutex.unlock(); |
thomasmorris | 16:9f98ec0ededb | 555 | } |
thomasmorris | 16:9f98ec0ededb | 556 | } |
thomasmorris | 16:9f98ec0ededb | 557 | } |
thomasmorris | 17:68b3fdabe4c5 | 558 | //Setter functions |
thomasmorris | 23:07a368f2cdb1 | 559 | void INTERFACE::Set_System_Running(int System_Running){_System_Running_mutex.lock(); _System_Running = System_Running; _System_Running_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 560 | void INTERFACE::Set_Function(int Function){_Function_mutex.lock();_Function = Function;_Function_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 561 | void INTERFACE::Set_Twist_Go(bool Twist_Go){_Twist_Go_mutex.lock();_Twist_Go = Twist_Go;_Twist_Go_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 562 | void INTERFACE::Set_Anneal_Go(bool Anneal_Go){_Anneal_Go_mutex.lock();_Anneal_Go = Anneal_Go;_Anneal_Go_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 563 | void INTERFACE::Set_Test_Go(bool Test_Go){_Test_Go_mutex.lock();_Test_Go = Test_Go;_Test_Go_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 564 | void INTERFACE::Set_Twist_Stop(bool Twist_Stop){_Twist_Stop_mutex.lock();_Twist_Stop = Twist_Stop;_Twist_Stop_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 565 | void INTERFACE::Set_Anneal_Stop(bool Anneal_Stop){_Anneal_Stop_mutex.lock();_Anneal_Stop = Anneal_Stop;_Anneal_Stop_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 566 | void INTERFACE::Set_Test_Stop(bool Test_Stop){_Test_Stop_mutex.lock();_Test_Go = Test_Stop;_Test_Stop_mutex.unlock();} |
thomasmorris | 25:9751619fa030 | 567 | void INTERFACE::Set_Select(int Select){_Select_mutex.lock();_Select = Select;_Select_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 568 | void INTERFACE::Set_Turns_Done(int Turns_Done){_Turns_Done_mutex.lock();_Turns_Done = Turns_Done;_Turns_Done_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 569 | void INTERFACE::Set_Turns_To_Do(int Turns_Todo){_Turns_Todo_mutex.lock();_Turns_Todo = Turns_Todo;_Turns_Todo_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 570 | void INTERFACE::Set_Loop(int Loop){_Loop_mutex.lock();Loop = Loop;_Loop_mutex.unlock();} |
thomasmorris | 25:9751619fa030 | 571 | void INTERFACE::Set_On_Time(int On_Time){_On_Time_mutex.lock();_On_Time = On_Time;_On_Time_mutex.unlock();} |
thomasmorris | 25:9751619fa030 | 572 | void INTERFACE::Set_Off_Time(int Off_Time){_Off_Time_mutex.lock();_Off_Time = Off_Time;_Off_Time_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 573 | void INTERFACE::Set_Duty_Cycle(int Duty_Cycle){_Duty_Cycle_mutex.lock();_Duty_Cycle = Duty_Cycle;_Duty_Cycle_mutex.unlock();} |
thomasmorris | 23:07a368f2cdb1 | 574 | void INTERFACE::Set_Power_Time(float Power_Time){_Power_Time_mutex.lock();_Power_Time = Power_Time;_Power_Time_mutex.unlock();} |
thomasmorris | 17:68b3fdabe4c5 | 575 | //Getter functions |
thomasmorris | 23:07a368f2cdb1 | 576 | int INTERFACE::Get_System_Running(){return _System_Running;} |
thomasmorris | 23:07a368f2cdb1 | 577 | int INTERFACE::Get_Function(){return _Function;} |
thomasmorris | 16:9f98ec0ededb | 578 | bool INTERFACE::Get_Twist_Go(){return _Twist_Go;} |
thomasmorris | 16:9f98ec0ededb | 579 | bool INTERFACE::Get_Anneal_Go(){return _Anneal_Go;} |
thomasmorris | 16:9f98ec0ededb | 580 | bool INTERFACE::Get_Test_Go(){return _Test_Go;} |
thomasmorris | 23:07a368f2cdb1 | 581 | bool INTERFACE::Get_Twist_Stop(){return _Twist_Stop;} |
thomasmorris | 23:07a368f2cdb1 | 582 | bool INTERFACE::Get_Anneal_Stop(){return _Anneal_Stop;} |
thomasmorris | 23:07a368f2cdb1 | 583 | bool INTERFACE::Get_Test_Stop(){return _Test_Stop;} |
thomasmorris | 25:9751619fa030 | 584 | int INTERFACE::Get_Select(){return _Select;} |
thomasmorris | 18:3523660f3930 | 585 | int INTERFACE::Get_Turns_Done(){_Turns_Done = STEPPER_MOTOR_1.Get_Turns(); return _Turns_Done;} |
thomasmorris | 16:9f98ec0ededb | 586 | int INTERFACE::Get_Turns_To_Do(){return _Turns_Todo;} |
thomasmorris | 16:9f98ec0ededb | 587 | int INTERFACE::Get_Loop(){return _Loop;} |
thomasmorris | 25:9751619fa030 | 588 | int INTERFACE::Get_On_Time(){return _On_Time;} |
thomasmorris | 25:9751619fa030 | 589 | int INTERFACE::Get_Off_Time(){return _Off_Time;} |
thomasmorris | 16:9f98ec0ededb | 590 | int INTERFACE::Get_Duty_Cycle(){return _Duty_Cycle;} |
thomasmorris | 23:07a368f2cdb1 | 591 | int INTERFACE::Get_Power_Time(){return _Power_Time;} |