1919
2020#include  " Arduino_ScienceKitCarrier.h" 
2121
22- <<<<<<< HEAD
23- 
24- =======
25- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
2622#ifdef  ARDUINO_NANO_RP2040_CONNECT
2723short  ScienceKitCarrier::sampleBuffer[MICROPHONE_BUFFER_SIZE];
2824volatile  int  ScienceKitCarrier::samplesRead;
@@ -90,7 +86,6 @@ ScienceKitCarrier::ScienceKitCarrier(){
9086  external_temperature_is_connected=false ;
9187
9288  #ifdef  ARDUINO_NANO_RP2040_CONNECT
93- <<<<<<< HEAD
9489    microphone_rms=0 ;
9590    rms=0 ;
9691  #endif 
@@ -104,18 +99,6 @@ ScienceKitCarrier::ScienceKitCarrier(){
10499
105100  #ifdef  ARDUINO_NANO_ESP32
106101    wire_semaphore = xSemaphoreCreateMutex ();
107- =======
108-   microphone_rms=0 ;
109-   rms=0 ;
110-   #endif 
111- 
112-   round_robin_index=0 ;
113-   
114-   #ifdef  ARDUINO_NANO_RP2040_CONNECT
115-   thread_activity_led = new  rtos::Thread ();
116-   thread_update_bme = new  rtos::Thread ();
117-   thread_external_temperature = new  rtos::Thread ();
118- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
119102  #endif 
120103
121104  thread_bme_is_running = false ;
@@ -186,19 +169,9 @@ int ScienceKitCarrier::begin(const uint8_t auxiliary_threads){
186169  }
187170  #endif 
188171
189- <<<<<<< HEAD
190172  //  let's start bme688, external ds18b20 probe and ultrasonic sensor
191173  startAuxiliaryThreads (auxiliary_threads);
192174  return  1 ;
193- =======
194-     //  let's start ultrasonic and check if it is connected
195-   if  (beginUltrasonic ()!=0 ){
196-     return  ERR_BEGIN_ULTRASONIC;
197-   }
198- 
199-   //  let's start bme688 and external ds18b20 probe
200-   // WIP startAuxiliaryThreads(auxiliary_threads);
201- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
202175}
203176
204177
@@ -272,11 +245,7 @@ int ScienceKitCarrier::beginAnalogInput(){
272245
273246void  ScienceKitCarrier::updateAnalogInput (const  uint8_t  input_to_update){
274247  if  ((input_to_update==UPDATE_INPUT_A)||(input_to_update==UPDATE_ALL)){
275- <<<<<<< HEAD
276248
277- =======
278-     /*    WIP
279- >>>>>>> dd98cd0 (mod: added ESP example, flag to build, NOTE all 0s on BLE) 
280249    if  (!getExternalTemperatureIsConnected ()){
281250      inputA=analogRead (inputA_pin)>>board_resolution;
282251      #ifdef  ARDUINO_NANO_ESP32
@@ -286,11 +255,7 @@ void ScienceKitCarrier::updateAnalogInput(const uint8_t input_to_update){
286255    else {
287256      inputA=ANALOGIN_DISABLED;
288257    } 
289- <<<<<<< HEAD 
290258
291- ======= 
292-     */  
293- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
294259  }
295260  if  ((input_to_update==UPDATE_INPUT_B)||(input_to_update==UPDATE_ALL)){
296261    inputB=analogRead (inputB_pin)>>board_resolution;
@@ -657,14 +622,6 @@ float ScienceKitCarrier::getMagneticFieldZ(){
657622}
658623
659624
660- <<<<<<< HEAD
661- =======
662- #ifdef  ARDUINO_NANO_RP2040_CONNECT
663- void  ScienceKitCarrier::delay (unsigned  long  t){
664-   rtos::ThisThread::sleep_for (t);
665- }
666- #endif 
667- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
668625
669626
670627
@@ -694,7 +651,6 @@ void ScienceKitCarrier::errorTrap(const int error_code){
694651  }
695652}
696653
697- <<<<<<< HEAD
698654#ifdef  ARDUINO_NANO_ESP32
699655void  ScienceKitCarrier::setStatusLed (const  int  led_state){
700656  switch  (led_state){
@@ -727,52 +683,6 @@ void ScienceKitCarrier::setStatusLed(const int led_state){
727683      enable_led_red = false ;
728684      enable_led_green = false ;
729685      enable_led_blue = false ;
730- =======
731- #ifdef  ARDUINO_NANO_RP2040_CONNECT
732- void  ScienceKitCarrier::threadActivityLed (){
733-   while (1 ){
734-     switch  (activity_led_state){
735-       case  ACTIVITY_LED_OFF:
736-         digitalWrite (LEDB,LOW);
737-         digitalWrite (LEDG,LOW);
738-         break ;
739-       case  ACTIVITY_LED_BLE:               //  blue breathing effect
740-         digitalWrite (LEDG, LOW);
741-         for (int  i=255 ; i>0 ; i--){
742-           analogWrite (LEDB, i);
743-           rtos::ThisThread::sleep_for (10 );
744-         }
745-         for (int  i=0 ; i<255 ; i++){
746-           analogWrite (LEDB, i);
747-           rtos::ThisThread::sleep_for (10 );
748-         }
749-         rtos::ThisThread::sleep_for (100 );
750-         break ;
751-       case  ACTIVITY_LED_PAIRING:            //  blue-green flashing
752-         for (int  i = 255 ; i>0 ; i=i-2 ){
753-           analogWrite (LEDG,i);
754-           rtos::ThisThread::sleep_for (1 );
755-         }
756-         for (int  i = 0 ; i<255 ; i=i+2 ){
757-           analogWrite (LEDG,i);
758-           rtos::ThisThread::sleep_for (1 );
759-         }
760-         for (int  i = 255 ; i>0 ; i=i-2 ){
761-           analogWrite (LEDB,i);
762-           rtos::ThisThread::sleep_for (1 );
763-         }
764-         for (int  i = 0 ; i<255 ; i=i+2 ){
765-           analogWrite (LEDB,i);
766-           rtos::ThisThread::sleep_for (1 );
767-         }
768-         digitalWrite (LEDG, LOW);
769-         digitalWrite (LEDB, LOW);
770-         break ;
771-       default :                              //  any other value turns off leds
772-         digitalWrite (LEDB,LOW);
773-         digitalWrite (LEDG,LOW);
774-     }  
775- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
776686  }
777687}
778688#endif 
@@ -1019,10 +929,6 @@ void ScienceKitCarrier::freeRTOSExternalTemperature(void * pvParameters){
1019929/* *******************************************************************/ 
1020930/*                              Microphone                           */ 
1021931/* *******************************************************************/ 
1022- <<<<<<< HEAD
1023- 
1024- =======
1025- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
1026932#ifdef  ARDUINO_NANO_RP2040_CONNECT
1027933int  ScienceKitCarrier::beginMicrophone (){
1028934  PDM.setGain (50 );
@@ -1056,10 +962,6 @@ uint ScienceKitCarrier::getMicrophoneRMS(){
1056962  return  microphone_rms;
1057963}
1058964#endif 
1059- <<<<<<< HEAD
1060- 
1061- =======
1062- >>>>>>> dd98cd0  (mod: added ESP example, flag to build, NOTE all 0s on BLE)
1063965
1064966
1065967
0 commit comments