Nucleo-transfer
Dependencies: ADS1015 MPU6050 PixelArray PixelArray-Nucleo mbed WS2813
Fork of Nucleo-transfer by
Diff: Sensorplate/main.cpp
- Revision:
- 67:1b300aa30923
- Parent:
- 66:88c910cd4d9e
- Child:
- 68:1663f305ac33
--- a/Sensorplate/main.cpp Fri May 25 09:02:28 2018 +0000 +++ b/Sensorplate/main.cpp Tue May 29 09:38:01 2018 +0000 @@ -124,6 +124,7 @@ int LED_colour_wheel_percentage=0; int ring_colour_old,mixer=0; int colour_wheel_filler = 5; +bool patient_present=true; bool colour_wheel_drain_reposition = false; bool colour_wheel_drain_new_patient = false; bool circle_filling_reposition = false; @@ -143,6 +144,8 @@ Timer test_timer; DigitalIn test_pin(PA_11, PullDown); +float percentage_tester=0; + // Variable to set if belt is used to test algorithm: bool test_belt = 0; @@ -423,6 +426,12 @@ } usb_serial.printf("percentage in %d,%d\n",percentage_in,leds_on); + if(!patient_present){ + px.SetAll(colourbuf[4]); + px.SetAllI(int(2.55*intensity)); + } + + if(reposition_button_hold_timer.read_ms()) { usb_serial.printf("filling circle\n"); circle_filling_reposition = true; @@ -524,6 +533,7 @@ px.Set((16-circle_filled_reposition)%16,colourbuf[4]); px.SetAllI(int(intensity*2.55)); circle_filled_reposition--; + percentage_tester=0; } if(circle_filled_new_patient) { @@ -532,7 +542,10 @@ px.SetAllI(int(intensity*2.55*(7-(circle_filled_new_patient%5))/7)); circle_filled_new_patient--; } - + if(!connection_test_sensorplate) { + px.Set(6,colourbuf[0]); + px.SetI(6,int(intensity*2.55)); + } ws.write_offsets(px.getBuf(),0,0,0); ring_colour_old=ring_colour; } @@ -906,6 +919,10 @@ if(colour_code != 0b00 && pi_active == false && (comet%ALARMBUF)==(ALARMBUF-1)) { pi_active = true; } + if(testpin_sensorplate.read()) { + px.Set(6,colourbuf[0]); + px.SetI(6,255); + } ws.write_offsets(px.getBuf(),0,0,0); while(comet_timer.read_ms()<total_comet_cycle_time_ms) {} } @@ -921,6 +938,10 @@ } px.Set(i,colourbuf[4]); px.SetI(i,255); + if(testpin_sensorplate.read()) { + px.Set(6,colourbuf[0]); + px.SetI(6,255); + } while(comet_timer.read_ms()<total_comet_cycle_time_ms) {} ws.write_offsets(px.getBuf(),0,0,0); } @@ -1015,6 +1036,8 @@ } colour_wheel(LED_colour_wheel_percentage); // Function to select colour. + percentage_tester+=0.2; + //LED_colour_wheel_percentage=percentage_tester; set_userinterface_LED(); // Set LED's of user interface (LED's above buttons). if (test_mode == 1) { // If statement for test purposal.