@@ -98,7 +98,7 @@ ScienceKitCarrier::ScienceKitCarrier(){
98
98
thread_ultrasonic = new rtos::Thread ();
99
99
#endif
100
100
101
- #ifdef ESP32
101
+ #ifdef ARDUINO_NANO_ESP32
102
102
wire_semaphore = xSemaphoreCreateMutex ();
103
103
#endif
104
104
@@ -124,7 +124,7 @@ ScienceKitCarrier::ScienceKitCarrier(){
124
124
125
125
int ScienceKitCarrier::begin (const uint8_t auxiliary_threads){
126
126
127
- #ifdef ESP32
127
+ #ifdef ARDUINO_NANO_ESP32
128
128
pinMode (LED_RED,OUTPUT);
129
129
pinMode (LED_GREEN,OUTPUT);
130
130
pinMode (LED_BLUE,OUTPUT);
@@ -249,7 +249,7 @@ void ScienceKitCarrier::updateAnalogInput(const uint8_t input_to_update){
249
249
250
250
if (!getExternalTemperatureIsConnected ()){
251
251
inputA=analogRead (inputA_pin)>>board_resolution;
252
- #ifdef ESP32
252
+ #ifdef ARDUINO_NANO_ESP32
253
253
beginExternalTemperature ();
254
254
#endif
255
255
}
@@ -291,12 +291,12 @@ int ScienceKitCarrier::beginAPDS(){
291
291
else {
292
292
apds9999->enableColorSensor ();
293
293
apds9999->enableProximitySensor ();
294
- apds9999->setGain (APDS9999_GAIN_3X );
294
+ apds9999->setGain (APDS9999_GAIN_18X );
295
295
apds9999->setLSResolution (APDS9999_LS_RES_16B);
296
296
apds9999->setLSRate (APDS9999_LS_RATE_25MS);
297
297
color_sensor_used = APDS9999_VERSION;
298
298
}
299
- #ifdef ESP32
299
+ #ifdef ARDUINO_NANO_ESP32
300
300
for (int i=0 ; i<=color_sensor_used; i++){
301
301
digitalWrite (LED_GREEN, LOW);
302
302
delay (100 );
@@ -319,10 +319,10 @@ void ScienceKitCarrier::updateAPDS(){
319
319
}
320
320
}
321
321
if (color_sensor_used==APDS9999_VERSION){
322
- r = apds9999->getRed ()*4097 /65535.0 ;
323
- g = apds9999->getGreen ()*4097 /262144.0 ;
324
- b = apds9999->getBlue ()*4097 /131072.0 ;
325
- c = apds9999->getIR ()*4097 /4096.0 ;
322
+ r = apds9999->getRed ()*5.0 * 4097 /65535.0 ;
323
+ g = apds9999->getGreen ()*5.0 * 4097 /262144.0 ;
324
+ b = apds9999->getBlue ()*5.0 * 4097 /131072.0 ;
325
+ c = apds9999->getIR ()*5.0 * 4097 /4096.0 ;
326
326
proximity = 255 - apds9999->getProximity ();
327
327
if (proximity>255 ){
328
328
proximity = 0 ;
@@ -436,7 +436,7 @@ float ScienceKitCarrier::getResistanceMeasureVolts(){
436
436
#ifdef ARDUINO_NANO_RP2040_CONNECT
437
437
value = REF_VOLTAGE*analogRead (resistance_pin)/ADC_RESOLUTION;
438
438
#endif
439
- #ifdef ESP32
439
+ #ifdef ARDUINO_NANO_ESP32
440
440
value = analogReadMilliVolts (resistance_pin)/1000.0 ;
441
441
#endif
442
442
return value;
@@ -519,7 +519,7 @@ void ScienceKitCarrier::threadBME688(){
519
519
}
520
520
}
521
521
522
- #ifdef ESP32
522
+ #ifdef ARDUINO_NANO_ESP32
523
523
void ScienceKitCarrier::freeRTOSInternalTemperature (void * pvParameters){
524
524
((ScienceKitCarrier*) pvParameters)->threadBME688 ();
525
525
}
@@ -650,7 +650,7 @@ void ScienceKitCarrier::errorTrap(const int error_code){
650
650
}
651
651
}
652
652
653
- #ifdef ESP32
653
+ #ifdef ARDUINO_NANO_ESP32
654
654
void ScienceKitCarrier::setStatusLed (const int led_state){
655
655
switch (led_state){
656
656
case STATUS_LED_OFF:
@@ -768,7 +768,7 @@ void ScienceKitCarrier::updateUltrasonic(){
768
768
if (ultrasonic_data==4294967295 ){
769
769
ultrasonic_measure = -1.0 ;
770
770
ultrasonic_is_connected = false ;
771
- #ifdef ESP32
771
+ #ifdef ARDUINO_NANO_ESP32
772
772
setStatusLed (STATUS_LED_RM_ULTRASONIC);
773
773
#endif
774
774
}
@@ -778,7 +778,7 @@ void ScienceKitCarrier::updateUltrasonic(){
778
778
ultrasonic_measure = 4500.0 ;
779
779
}
780
780
ultrasonic_is_connected = true ;
781
- #ifdef ESP32
781
+ #ifdef ARDUINO_NANO_ESP32
782
782
setStatusLed (STATUS_LED_ADD_ULTRASONIC);
783
783
#endif
784
784
}
@@ -831,7 +831,7 @@ void ScienceKitCarrier::threadUltrasonic(){
831
831
}
832
832
}
833
833
834
- #ifdef ESP32
834
+ #ifdef ARDUINO_NANO_ESP32
835
835
void ScienceKitCarrier::freeRTOSUltrasonic (void * pvParameters){
836
836
((ScienceKitCarrier*) pvParameters)->threadUltrasonic ();
837
837
}
@@ -857,7 +857,7 @@ void ScienceKitCarrier::updateExternalTemperature(){
857
857
#ifdef ARDUINO_NANO_RP2040_CONNECT
858
858
pinMode (OW_PIN,INPUT);
859
859
#endif
860
- #ifdef ESP32
860
+ #ifdef ARDUINO_NANO_ESP32
861
861
pinMode (INPUTA_PIN,INPUT);
862
862
#endif
863
863
@@ -870,14 +870,14 @@ void ScienceKitCarrier::updateExternalTemperature(){
870
870
if (ec == OneWireNg::EC_SUCCESS) {
871
871
if (scrpd->getAddr ()!=15 ){
872
872
external_temperature_is_connected=false ;
873
- #ifdef ESP32
873
+ #ifdef ARDUINO_NANO_ESP32
874
874
setStatusLed (STATUS_LED_RM_EXT_TEMP);
875
875
#endif
876
876
external_temperature = EXTERNAL_TEMPERATURE_DISABLED;
877
877
}
878
878
else {
879
879
external_temperature_is_connected=true ;
880
- #ifdef ESP32
880
+ #ifdef ARDUINO_NANO_ESP32
881
881
setStatusLed (STATUS_LED_ADD_EXT_TEMP);
882
882
#endif
883
883
long temp = scrpd->getTemp ();
@@ -910,7 +910,7 @@ void ScienceKitCarrier::threadExternalTemperature(){
910
910
}
911
911
}
912
912
913
- #ifdef ESP32
913
+ #ifdef ARDUINO_NANO_ESP32
914
914
void ScienceKitCarrier::freeRTOSExternalTemperature (void * pvParameters){
915
915
((ScienceKitCarrier*) pvParameters)->threadExternalTemperature ();
916
916
}
@@ -973,7 +973,7 @@ void ScienceKitCarrier::startAuxiliaryThreads(const uint8_t auxiliary_threads){
973
973
#ifdef ARDUINO_NANO_RP2040_CONNECT
974
974
thread_update_bme->start (mbed::callback (this , &ScienceKitCarrier::threadBME688));
975
975
#endif
976
- #ifdef ESP32
976
+ #ifdef ARDUINO_NANO_ESP32
977
977
xTaskCreatePinnedToCore (this ->freeRTOSInternalTemperature , " update_internal_temperature" , 10000 , this , 1 , &thread_internal_temperature, INTERNAL_TEMPERATURE_CORE);
978
978
#endif
979
979
}
@@ -986,7 +986,7 @@ void ScienceKitCarrier::startAuxiliaryThreads(const uint8_t auxiliary_threads){
986
986
#ifdef ARDUINO_NANO_RP2040_CONNECT
987
987
thread_external_temperature->start (mbed::callback (this , &ScienceKitCarrier::threadExternalTemperature));
988
988
#endif
989
- #ifdef ESP32
989
+ #ifdef ARDUINO_NANO_ESP32
990
990
xTaskCreatePinnedToCore (this ->freeRTOSExternalTemperature , " update_external_temperature" , 10000 , this , 1 , &thread_external_temperature, EXTERNAL_TEMPERATURE_CORE);
991
991
#endif
992
992
}
@@ -999,15 +999,15 @@ void ScienceKitCarrier::startAuxiliaryThreads(const uint8_t auxiliary_threads){
999
999
#ifdef ARDUINO_NANO_RP2040_CONNECT
1000
1000
thread_ultrasonic->start (mbed::callback (this , &ScienceKitCarrier::threadUltrasonic));
1001
1001
#endif
1002
- #ifdef ESP32
1002
+ #ifdef ARDUINO_NANO_ESP32
1003
1003
xTaskCreatePinnedToCore (this ->freeRTOSUltrasonic , " update_ultrasonic" , 10000 , this , 1 , &thread_ultrasonic, ULTRASONIC_CORE);
1004
1004
#endif
1005
1005
}
1006
1006
thread_ultrasonic_is_running = true ;
1007
1007
}
1008
1008
1009
1009
// start status led
1010
- #ifdef ESP32
1010
+ #ifdef ARDUINO_NANO_ESP32
1011
1011
if ((auxiliary_threads==START_AUXILIARY_THREADS)||(auxiliary_threads==START_STATUS_LED)){
1012
1012
if (!thread_led_is_running){
1013
1013
xTaskCreatePinnedToCore (this ->freeRTOSStatusLed , " update_led" , 10000 , this , 1 , &thread_led, LED_CORE);
0 commit comments