-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRespirador_tela.ino
1769 lines (1539 loc) · 37.5 KB
/
Respirador_tela.ino
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//alteracoes lib nextionhardware //dbserial e mudar delay para delayMicroseconds
#include "Arduino.h"
#include <TaskScheduler.h>
#include "EEPROM.h"
#define RXD2 16
#define TXD2 17
#include "Nextion.h"
#define CH0_OFFSET 160
#define CH1_OFFSET 119
#define CH2_OFFSET 20
#define CH3_OFFSET 240
//#define EEPROM_SIZE 32
//EEPROM.put(0, 9);
uint8_t ch0_data =0x00;
uint8_t ch1_data =0x00;
uint8_t ch2_data =0x00;
uint8_t ch3_data =0x00;
float medidaanterior=0;
float medidaatual=0;
float soma=0;
int primeira=0;
int Pause=0;
//RTC_DATA_ATTR
int tempo=0;
//RTC_DATA_ATTR
bool ciclo=false;
int tempoinspiracao=1000;
int tempoexpiracao=2000;
int pausaexp=100;
int pausains=100;
int cont=0;
#include <Servo.h>
Servo servo1;
Servo servo2;
int pos = 0;
static const int servoPin = 4;
static const int servoPin2 = 5;
unsigned long lastmillis=0;
int sense_state=1;
int mode_state=1;
uint32_t dual_state;
int pag=0;
int change=330;
uint32_t inspexpauto=33;
uint32_t autofio2=0;
uint32_t sexo;
char crazy[1];
//RTC_NOINIT_ATTR
uint32_t volume;
uint32_t RPM;
uint32_t pressao;
uint32_t fluxs;
uint32_t PEEP;
uint32_t FIO2;
uint32_t SENS;
uint32_t TINS;
uint32_t TSUB;
uint32_t INSPEXP;
uint32_t altura;
uint32_t idade;
uint32_t volcalc;
uint32_t pausa;
uint32_t pressaomax;
uint32_t pressaomin;
uint32_t volumecorrentemax;
uint32_t volumecorrentemin;
uint32_t peepmax;
uint32_t peepmin;
uint32_t fluxomax;
uint32_t fluxomin;
uint32_t platomax;
uint32_t platomin;
uint32_t rpmmax;
uint32_t rpmmin;
uint32_t maxapnea;
uint32_t minapnea;
uint32_t sao2min;
uint32_t co2min;
class FLASHvariables
{ //Class to hold various persistent variables we want to save to non-volatile SRAM
public:
//VARIABLES
uint32_t volume;
uint32_t RPM;
uint32_t pressao;
uint32_t fluxs;
uint32_t PEEP;
uint32_t FIO2;
uint32_t SENS;
uint32_t TINS;
uint32_t TSUB;
uint32_t INSPEXP;
uint32_t altura;
uint32_t idade;
uint32_t volcalc;
uint32_t pausa;
//
//uint32_t pressaomax;
//uint32_t pressaomin;
//uint32_t volumecorrentemax;
//uint32_t volumecorrentemin;
//uint32_t peepmax;
//uint32_t peepmin;
//uint32_t fluxomax;
//uint32_t fluxomin;
//uint32_t platomax;
//uint32_t platomin;
//uint32_t rpmmax;
//uint32_t rpmmin;
//uint32_t maxapnea;
//uint32_t minapnea;
//uint32_t sao2min;
//uint32_t co2min;
uint8_t varsGood;
//METHODS
void save();
void get();
void initialize();
} myVars;
void FLASHvariables::save()
{
EEPROM.put(0,myVars);
EEPROM.commit();
}
void FLASHvariables::get()
{
EEPROM.begin(sizeof(myVars));
EEPROM.get(0,myVars);
}
void FLASHvariables::initialize()
{
//If no data can be found in flash RAM, initialize the variables held in Class Structure here.
uint32_t volume=200;
uint32_t RPM=10;
uint32_t pressao=40;
uint32_t fluxs=60;
uint32_t PEEP=55;
uint32_t FIO2=20;
uint32_t SENS=20;
uint32_t TINS=10;
uint32_t TSUB=1;
uint32_t INSPEXP=33;
uint32_t altura=175;
uint32_t idade=65;
uint32_t volcalc=300;
uint32_t pausa=10;
//uint32_t pressaomax=45;
//uint32_t pressaomin=30;
//uint32_t volumecorrentemax=422;
//uint32_t volumecorrentemin=222;
//uint32_t peepmax=7;
//uint32_t peepmin=4;
//uint32_t fluxomax=38;
//uint32_t fluxomin=20;
//uint32_t platomax=35;
//uint32_t platomin=25;
//uint32_t rpmmax=18;
//uint32_t rpmmin=12;
//uint32_t maxapnea=5;
//uint32_t minapnea=18;
//uint32_t sao2min=85;
//uint32_t co2min=25;
varsGood=190;
EEPROM.put(0,myVars);
EEPROM.commit();
}
//============END FLASHVARIABLES CLASS DEFINITION =======================
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; }
esp_chip_info_t chip_info; //Instantiate object chip_info of class esp_chip_info_t to access data on chip hardware
uint32_t pressaoinstantanea=40;
uint32_t volumecorrente=322;
uint32_t lastpeep=4;
uint32_t fluxoinstantaneo=33;
uint32_t fio2fracao=40;
uint32_t sao2=85;
uint32_t pressaopk=40;
uint32_t plato=30;
uint32_t rpmpaciente=18;
uint32_t iefracao=2;
void t1Callback();
void t2Callback();
void t3Callback();
void t4Callback();
TaskHandle_t Task1;
TaskHandle_t Task2;
Task t1(10, TASK_FOREVER, &t1Callback);
Task t2(100, TASK_FOREVER, &t2Callback);
Task t3(10, TASK_FOREVER, &t3Callback);
Task t4(100, TASK_FOREVER, &t4Callback);
Scheduler runner;
void save(){
//EEPROM.put(0, volume);
// EEPROM.commit();
//EEPROM.put(8, RPM);
// EEPROM.commit();
// EEPROM.put(4, pressao);
// EEPROM.commit();
// EEPROM.put(6, PEEP);
// EEPROM.commit();
// EEPROM.put(8, fluxs);
// EEPROM.commit();
// EEPROM.put(10, altura);
// EEPROM.commit();
//EEPROM.put(12, INSPEXP);
// EEPROM.commit();
// EEPROM.put(14, mode_state);
// EEPROM.commit();
//
// EEPROM.put(16, sense_state);
// EEPROM.commit();
//
// EEPROM.put(18, sexo);
// EEPROM.commit();
// EEPROM.put(20, SENS);
// EEPROM.commit();
// EEPROM.put(22, TINS);
// EEPROM.commit();
// EEPROM.put(24, TSUB);
// EEPROM.commit();
// EEPROM.put(26, pausa);
// EEPROM.commit();
// EEPROM.put(28, FIO2);
// EEPROM.commit();
//
}
void savealarm(){
}
//Declare a number object [page id:0,component id:3, component name: "n0"].
NexWaveform s0 = NexWaveform(0, 1, "s0");
//page 2
NexNumber vca = NexNumber(2, 12, "vca");
NexNumber vci = NexNumber(2, 11, "vci");
NexNumber fla = NexNumber(2, 14, "fla");
NexNumber fli = NexNumber(2, 13, "fli");
NexNumber pra = NexNumber(2, 16, "pra");
NexNumber pri = NexNumber(2, 15, "pri");
NexNumber rpa = NexNumber(2, 22, "rpa");
NexNumber rpi = NexNumber(2, 21, "rpi");
NexNumber pta = NexNumber(2, 20, "pta");
NexNumber pti = NexNumber(2, 19, "pti");
NexNumber pea = NexNumber(2, 18, "pea");
NexNumber pei = NexNumber(2, 17, "pei");
NexNumber apa = NexNumber(2, 33, "apa");
NexNumber api = NexNumber(2, 32, "api");
//NexNumber soa = NexNumber(2, 22, "soa");
NexNumber soi = NexNumber(2, 34, "soi");
NexNumber coi = NexNumber(2, 71, "coi");
//NexButton b1 = NexButton(0, 15, "b1");
NexButton a2 = NexButton(2, 23, "b2");
NexButton a3 = NexButton(2, 24, "b3");
NexButton a4 = NexButton(2, 25, "b4");
NexButton a5 = NexButton(2, 26, "b5");
NexButton a6 = NexButton(2, 27, "b6");
NexButton a7 = NexButton(2, 28, "b7");
NexButton a8 = NexButton(2, 67, "b8");
NexButton a9 = NexButton(2, 36, "a9");
NexButton a10 = NexButton(2, 37, "b10");
NexButton a11 = NexButton(2, 38, "b11");
NexButton a12 = NexButton(2, 39, "b12");
NexButton a13 = NexButton(2, 35, "b13");
NexButton a14 = NexButton(2, 68, "b14");
NexButton a15 = NexButton(2, 69, "b15");
NexButton a16 = NexButton(2, 40, "b16");
NexButton a17 = NexButton(2, 41, "b17");
NexButton a18 = NexButton(2, 70, "b18");
NexButton a19 = NexButton(2, 42, "b19");
NexButton a20 = NexButton(2, 43, "b20");
//NexButton a21 = NexButton(2, 15, "b21");
NexButton a22 = NexButton(2, 44, "b22");
NexButton a23 = NexButton(2, 45, "b23");
NexButton a24 = NexButton(2, 46, "b24");
NexButton a25 = NexButton(2, 47, "b25");
NexButton a26 = NexButton(2, 48, "b26");
NexButton a27 = NexButton(2, 49, "b27");
//NexButton a28 = NexButton(2, 16, "b28");
NexButton a29 = NexButton(2, 50, "b29");
NexButton a30 = NexButton(2, 51, "b30");
//NexButton a31 = NexButton(2, 15, "b31");
NexButton a32 = NexButton(2, 52, "b32");
NexButton a33 = NexButton(2, 53, "b33");
NexButton a34 = NexButton(2, 54, "b34");
NexButton a35 = NexButton(2, 55, "b35");
NexButton a36 = NexButton(2, 56, "b36");
NexButton a37 = NexButton(2, 57, "b37");
//NexButton a38 = NexButton(2, 58, "b38");
NexButton a39 = NexButton(2, 58, "b39");
//NexButton a40 = NexButton(2, 15, "b40");
//NexButton a41 = NexButton(2, 52, "b41");
NexButton a42 = NexButton(2, 59, "b42");
NexButton a43 = NexButton(2, 60, "b43");
NexButton a44 = NexButton(2, 61, "b44");
NexButton a45 = NexButton(2, 62, "b45");
NexButton a46 = NexButton(2, 63, "b46");
NexButton a47 = NexButton(2, 64, "b47");
//NexButton a48 = NexButton(2, 64, "b48");
NexButton a49 = NexButton(2, 65, "b49");
//page0
NexNumber vce = NexNumber(0, 2, "vce");
NexNumber flx = NexNumber(0, 3, "flx");
NexNumber prs = NexNumber(0, 4, "prs");
NexNumber pee = NexNumber(0, 8, "pee");
NexNumber sao = NexNumber(0, 20, "sao");
NexNumber pla = NexNumber(0, 23, "pla");
NexNumber rpm = NexNumber(0, 25, "rpm");
NexNumber ief = NexNumber(0, 31, "ief");
NexNumber ppk = NexNumber(0, 34, "ppk");
NexNumber fio = NexNumber(0, 13, "fio");
//NexVariable va0=NexVariable(0,35,"va0");
//page 1
NexCheckbox c0 = NexCheckbox(1, 67, "c0"); //insp/exp
NexCheckbox c1 = NexCheckbox(1, 28, "c1");//auto fi02
NexCheckbox c2 = NexCheckbox(1, 69, "c2");//sexo m f
NexDSButton bt0 = NexDSButton(1, 3, "bt0"); //modo
NexDSButton bt1 = NexDSButton(1, 4, "bt1");
NexDSButton bt2 = NexDSButton(1, 11, "bt2");
NexDSButton bt3 = NexDSButton(1, 59, "bt3"); //modo sens
NexDSButton bt4 = NexDSButton(1, 60, "bt4");
//NexText t0 = NexText(1, 5, "t0");
//VOLUME
NexNumber n0 = NexNumber(1, 14, "n0");
NexButton b3 = NexButton(1, 12, "b3");
NexButton b4 = NexButton(1, 13, "b4");
//RPM
NexNumber n1 = NexNumber(1, 17, "n1");
NexNumber n22 = NexNumber(1, 20, "n22");
NexButton b5 = NexButton(1, 15, "b5");
NexButton b6 = NexButton(1, 16, "b6");
//Pressao
NexButton b7 = NexButton(1, 18, "b7");
NexButton b8 = NexButton(1, 19, "b8");
//Fluxo
NexNumber fl = NexNumber(1, 39, "fl");
NexButton b18 = NexButton(1, 37, "b18");
NexButton b19 = NexButton(1, 38, "b19");
//PEEP
NexNumber pe = NexNumber(1, 35, "pe");
NexButton b9 = NexButton(1, 21, "b9");
NexButton b10 = NexButton(1, 22, "b10");
///FIO2
NexNumber n4 = NexNumber(1, 25, "n4");
NexButton b11 = NexButton(1, 23, "b11");
NexButton b12 = NexButton(1, 24, "b12");
//Sens
NexNumber x2 = NexNumber(1, 40, "x2");
NexButton b13 = NexButton(1, 26, "b13");
NexButton b14 = NexButton(1, 27, "b14");
///Tins
NexNumber x3 = NexNumber(1, 44, "x3");
NexButton b20 = NexButton(1, 42, "b20");
NexButton b21 = NexButton(1, 43, "b21");
///tsub
NexNumber x4 = NexNumber(1, 48, "x4");
NexButton b22 = NexButton(1, 46, "b22");
NexButton b23 = NexButton(1, 47, "b23");
//ins/ex
NexNumber n7 = NexNumber(1, 64, "n7");
NexButton b28 = NexButton(1, 62, "b28");
NexButton b29 = NexButton(1, 63, "b29");
//pausa
NexNumber x0 = NexNumber(1, 34, "x0");
NexButton b1 = NexButton(1, 31, "b1");
NexButton b15 = NexButton(1, 32, "b15");
///altura
NexNumber x5 = NexNumber(1, 52, "x5");
NexButton b24 = NexButton(1, 50, "b24");
NexButton b25 = NexButton(1, 51, "b25");
//idade
NexNumber n5 = NexNumber(1, 56, "n5");
NexButton b26 = NexButton(1, 54, "b26");
NexButton b27 = NexButton(1, 55, "b27");
//vol calc
NexNumber n6 = NexNumber(1, 57, "n6");
//aplicar
NexButton b16 = NexButton(1, 30, "b16");
//pausa insp
NexButton b17 = NexButton(1, 33, "b17");
//page
NexPage page0 = NexPage(0, 0, "page0");
NexPage page1 = NexPage(1, 0, "page1");
NexPage page2 = NexPage(2, 0, "page2");
NexPage page3 = NexPage(3, 0, "page3");
char buffer[100];
NexTouch *nex_listen_list2[] =
{
&page0,
&page1,
&page2,
&a2,
&a3,
&a4,
&a5,
&a6,
&a7,
&a8,
&a9,
&a10,
&a11,
&a12,
&a13,
&a14,
&a15,
&a16,
&a17,
&a18,
&a19,
&a20,
&a22,
&a23,
&a24,
&a25,
&a26,
&a27,
&a29,
&a30,
&a32,
&a33,
&a34,
&a35,
&a36,
&a37,
&a39,
&a42,
&a43,
&a44,
&a45,
&a46,
&a47,
&a49,
NULL
};
// Register object n0, b0, b1, to the touch event list.
NexTouch *nex_listen_list0[] =
{
&vce,
&page0,
&page1,
&page2,
NULL
};
NexTouch *nex_listen_list1[] =
{
&page0,
&page1,
&page2,
&b1,
&b3,
&b4,
&b5,
&b6,
&b7,
&b8,
&b9,
&b10,
&b11,
&b12,
&b13,
&b14,
&b15,
&b16,
&b17,
&b18,
&b19,
&b20,
&b21,
&b22,
&b23,
&b24,
&b25,
&b26,
&b27,
&b28,
&b29,
&bt0,
&bt1,
&bt2,
&bt3,
&bt4,
&c0,
&c1,
&c2,
NULL
};
// funcoes alarmes
void a2PopCallback(void *ptr)
{
a2.Set_background_color_bco(61248);
}
void a3PopCallback(void *ptr)
{
a3.Set_background_color_bco(61248);
}
void a4PopCallback(void *ptr)
{
a4.Set_background_color_bco(61248);
}
void a5PopCallback(void *ptr)
{
a5.Set_background_color_bco(61248);
}
void a6PopCallback(void *ptr)
{
a6.Set_background_color_bco(61248);
}
void a7PopCallback(void *ptr)
{
a7.Set_background_color_bco(61248);
}
void a8PopCallback(void *ptr)
{
a8.Set_background_color_bco(61248);
}
void a13PopCallback(void *ptr)
{
a13.Set_background_color_bco(61248);
}
void a14PopCallback(void *ptr)
{
a14.Set_background_color_bco(61248);
}
void a22PopCallback(void *ptr)
{
vci.getValue(&volumecorrentemin);
volumecorrentemin += 1;
vci.setValue(volumecorrentemin);
}
void a9PopCallback(void *ptr)
{
vci.getValue(&volumecorrentemin);
volumecorrentemin -= 1;
vci.setValue(volumecorrentemin);
}
void a42PopCallback(void *ptr)
{
vca.getValue(&volumecorrentemax);
volumecorrentemax += 1;
vca.setValue(volumecorrentemax);
}
void a32PopCallback(void *ptr)
{
vca.getValue(&volumecorrentemax);
volumecorrentemax -= 1;
vca.setValue(volumecorrentemax);
}
//flux
void a23PopCallback(void *ptr)
{
fli.getValue(&fluxomin);
fluxomin += 1;
fli.setValue(fluxomin);
}
void a10PopCallback(void *ptr)
{
fli.getValue(&fluxomin);
fluxomin -= 1;
fli.setValue(fluxomin);
}
void a43PopCallback(void *ptr)
{
fla.getValue(&fluxomax);
fluxomax += 1;
fla.setValue(fluxomax);
}
void a33PopCallback(void *ptr)
{
fla.getValue(&fluxomax);
fluxomax -= 1;
fla.setValue(fluxomax);
}
//press
void a24PopCallback(void *ptr)
{
pri.getValue(&pressaomin);
pressaomin += 1;
pri.setValue(pressaomin);
}
void a11PopCallback(void *ptr)
{
pri.getValue(&pressaomin);
pressaomin -= 1;
pri.setValue(pressaomin);
}
void a44PopCallback(void *ptr)
{
pra.getValue(&pressaomax);
pressaomax += 1;
pra.setValue(pressaomax);
}
void a34PopCallback(void *ptr)
{
pra.getValue(&pressaomax);
pressaomax -= 1;
pra.setValue(pressaomax);
}
//peep
void a25PopCallback(void *ptr)
{
pei.getValue(&peepmin);
peepmin += 1;
pei.setValue(peepmin);
}
void a12PopCallback(void *ptr)
{
pei.getValue(&peepmin);
peepmin -= 1;
pei.setValue(peepmin);
}
void a45PopCallback(void *ptr)
{
pea.getValue(&peepmax);
peepmax += 1;
pea.setValue(peepmax);
}
void a35PopCallback(void *ptr)
{
pea.getValue(&peepmax);
peepmax -= 1;
pea.setValue(peepmax);
}
//plat
void a26PopCallback(void *ptr)
{
pti.getValue(&platomin);
platomin += 1;
pti.setValue(platomin);
}
void a16PopCallback(void *ptr)
{
pti.getValue(&platomin);
platomin -= 1;
pti.setValue(platomin);
}
void a46PopCallback(void *ptr)
{
pta.getValue(&platomax);
platomax += 1;
pta.setValue(platomax);
}
void a36PopCallback(void *ptr)
{
pta.getValue(&platomax);
platomax -= 1;
pta.setValue(platomax);
}
//rpm
void a27PopCallback(void *ptr)
{
rpi.getValue(&rpmmin);
rpmmin += 1;
rpi.setValue(rpmmin);
}
void a17PopCallback(void *ptr)
{
rpi.getValue(&rpmmin);
rpmmin -= 1;
rpi.setValue(rpmmin);
}
void a47PopCallback(void *ptr)
{
rpa.getValue(&rpmmax);
rpmmax += 1;
rpa.setValue(rpmmax);
}
void a37PopCallback(void *ptr)
{
rpa.getValue(&rpmmax);
rpmmax -= 1;
rpa.setValue(rpmmax);
}
//apnea
void a29PopCallback(void *ptr)
{
api.getValue(&minapnea);
minapnea += 1;
api.setValue(minapnea);
}
void a19PopCallback(void *ptr)
{
api.getValue(&minapnea);
minapnea -= 1;
api.setValue(minapnea);
}
void a49PopCallback(void *ptr)
{
apa.getValue(&maxapnea);
maxapnea += 1;
apa.setValue(maxapnea);
}
void a39PopCallback(void *ptr)
{
apa.getValue(&maxapnea);
maxapnea -= 1;
apa.setValue(maxapnea);
}
//sao2
//
//void a10PopCallback(void *ptr)
//{
// vci.getValue(&volumecorrentemin);
// volumecorrentemin += 1;
// vci.setValue(volumecorrentemin);
//}
//void a9PopCallback(void *ptr)
//{
// vci.getValue(&volumecorrentemin);
// volumecorrentemin -= 1;
// vci.setValue(volumecorrentemin);
//}
void a30PopCallback(void *ptr)
{
soi.getValue(&sao2min);
sao2min += 1;
soi.setValue(sao2min);
}
void a20PopCallback(void *ptr)
{
soi.getValue(&sao2min);
sao2min -= 1;
soi.setValue(sao2min);
}
//co2
//void a10PopCallback(void *ptr)
//{
// vci.getValue(&volumecorrentemin);
// volumecorrentemin += 1;
// vci.setValue(volumecorrentemin);
//}
//void a9PopCallback(void *ptr)
//{
// vci.getValue(&volumecorrentemin);
// volumecorrentemin -= 1;
// vci.setValue(volumecorrentemin);
//}
void a15PopCallback(void *ptr)
{
coi.getValue(&co2min);
co2min += 1;
coi.setValue(co2min);
}
void a18PopCallback(void *ptr)
{
coi.getValue(&co2min);
co2min -= 1;
coi.setValue(co2min);
}
void c0PopCallback(void *ptr){
NexCheckbox *cn = (NexCheckbox *)ptr;
memset(buffer, 200, sizeof(buffer));
c0.getValue(&dual_state);
if(dual_state==1){
c0.setValue(1);
}
else{
c0.setValue(0);
}
}
void c1PopCallback(void *ptr){
NexCheckbox *cn = (NexCheckbox *)ptr;
memset(buffer, 200, sizeof(buffer));
c1.getValue(&dual_state);
if(dual_state==1){
c1.setValue(1);
}
else{
c1.setValue(0);
}
}
///sexo
void c2PopCallback(void *ptr){
NexCheckbox *cn = (NexCheckbox *)ptr;
memset(buffer, 200, sizeof(buffer));
c2.getValue(&dual_state);
if(dual_state==1){
sexo=true;
c2.setValue(1);
if (sexo==true)volcalc= (52 + (0.75 * (altura - 152.4)))*6;
if (sexo==false)volcalc= (49 + (0.67 * (altura - 152.4)))*6;
n6.setValue(volcalc);
}
else{
c2.setValue(0);
sexo=false;
if (sexo==true)volcalc= (52 + (0.75 * (altura - 152.4)))*6;
if (sexo==false)volcalc= (49 + (0.67 * (altura - 152.4)))*6;
n6.setValue(volcalc);
}
}
//vcv
void bt0PopCallback(void *ptr){
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 200, sizeof(buffer));
bt0.getValue(&dual_state);/* Get the state value of dual state button component . */
if (mode_state != 1){
mode_state=1;
tempo=0;
}
if(mode_state==1) {
bt0.setValue(1);
bt1.setValue(0);
bt2.setValue(0);
}
}
//pcv
void bt1PopCallback(void *ptr){
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 200, sizeof(buffer));
bt1.getValue(&dual_state);
if (mode_state != 2) {
mode_state=2;
tempo=0;
}
if(mode_state==2){
bt1.setValue(1);
bt0.setValue(0);
bt2.setValue(0);
}
}
//psv
void bt2PopCallback(void *ptr){
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 200, sizeof(buffer));
bt2.getValue(&dual_state);
if (mode_state != 3){
mode_state=3;
tempo=0;
}
if(mode_state==3){
bt2.setValue(1);
bt0.setValue(0);
bt1.setValue(0);
}
}
//sens cmh20
void bt3PopCallback(void *ptr){
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 200, sizeof(buffer));
bt3.getValue(&dual_state);
if (sense_state != 1){
sense_state=1;
}
if(sense_state==1) {
bt3.setValue(1);
bt4.setValue(0);
}
}
//sens fluxo
void bt4PopCallback(void *ptr){
NexDSButton *btn = (NexDSButton *)ptr;
memset(buffer, 200, sizeof(buffer));
bt4.getValue(&dual_state);
if (sense_state != 2){
sense_state=2;
}
if(sense_state==2){
bt4.setValue(1);
bt3.setValue(0);
}
}
void b3PopCallback(void *ptr)
{
n0.getValue(&volume);
volume += 1;
n0.setValue(volume);
}
void b4PopCallback(void *ptr)
{
n0.getValue(&volume);
volume -= 1;
n0.setValue(volume);
}
void b5PopCallback(void *ptr)
{