comparison Discovery/Src/tMenuEditHardware.c @ 734:190e5814b2f5

Removed interface selection from sensor menu: By implementing the automatic sensor detection the need for the manual selection has become obsulete. By removing the selection button space became available to insert the sensor information button which shows detailed data of DigO2 sensor.
author Ideenmodellierer
date Sun, 15 Jan 2023 21:51:54 +0100
parents 9c65d226f4f6
children 5078da3845c0
comparison
equal deleted inserted replaced
733:7b0e020513e3 734:190e5814b2f5
60 //uint8_t OnAction_ExitHardw (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 60 //uint8_t OnAction_ExitHardw (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
61 uint8_t OnAction_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 61 uint8_t OnAction_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
62 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 62 uint8_t OnAction_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
63 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 63 uint8_t OnAction_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
64 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 64 uint8_t OnAction_O2_Calibrate (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
65 uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 65 //uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
66 uint8_t OnAction_Sensor_Info (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 66 uint8_t OnAction_Sensor_Info (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
67 uint8_t OnAction_Sensor_Detect (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 67 uint8_t OnAction_Sensor_Detect (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
68 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 68 uint8_t OnAction_Button (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
69 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 69 uint8_t OnAction_ButtonBalance (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
70 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); 70 // not required uint8_t OnAction_Bluetooth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
286 } 286 }
287 */ 287 */
288 288
289 void refresh_O2Sensors(void) 289 void refresh_O2Sensors(void)
290 { 290 {
291 static uint8_t stableMapCntDown = 10; 291 char strSensorId[20];
292 char text[32]; 292 char strSensorValue[20];
293 uint16_t y_line; 293 uint16_t y_line;
294 uint8_t index = 0; 294 uint8_t index = 0;
295 295
296 const SDiveState *pStateReal = stateRealGetPointer(); 296 const SDiveState *pStateReal = stateRealGetPointer();
297 SSettings *pSettings = settingsGetPointer(); 297 SSettings *pSettings = settingsGetPointer();
298 298
299 // if((pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_OPTIC)) 299 if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5) != 0)
300 { 300 {
301 if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5) != 0) 301 memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5);
302 { 302 pSettings->ppo2sensors_deactivated = 0x0; /* deactivation will be done by openEditO2Sensor if need */
303 if(stableMapCntDown == 0) 303
304 { 304 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
305 stableMapCntDown = 10; 305 for(index = 0; index < 3; index++)
306 memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5); 306 {
307 pSettings->ppo2sensors_deactivated = 0x0; /* deactivation will be done by openEditO2Sensor if need */ 307 switch(pSettings->ext_sensor_map[index])
308 openEdit_O2Sensors(); 308 {
309 } 309 case SENSOR_OPTIC: pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
310 else 310 break;
311 { 311 case SENSOR_ANALOG: if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_DIGITAL)
312 stableMapCntDown--; 312 {
313 } 313 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG;
314 } 314 }
315 } 315 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG)
316 #if 0 /*TODO: reactivate sensor information dialog */ 316 {
317 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANALOG;
318 }
319 break;
320 case SENSOR_DIGO2: if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG)
321 {
322 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG;
323 }
324 if(pSettings->ppo2sensors_source != O2_SENSOR_SOURCE_ANADIG)
325 {
326 pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_DIGITAL;
327 }
328 break;
329 default:
330 break;
331 }
332 }
333 openEdit_O2Sensors();
334 }
335
317 if((pStateReal->lifeData.extIf_sensor_Id != 0) && (haveSensorInfo == 0)) /* the sensor is detected after the interface has been selected => add button if info become available */ 336 if((pStateReal->lifeData.extIf_sensor_Id != 0) && (haveSensorInfo == 0)) /* the sensor is detected after the interface has been selected => add button if info become available */
318 { 337 {
338 #if 0
319 if(get_globalState() == StMHARD3_O2_Source) 339 if(get_globalState() == StMHARD3_O2_Source)
320 { 340 {
321 y_line = 5; 341 y_line = 5;
322 } 342 }
343 #endif
323 haveSensorInfo = 1; 344 haveSensorInfo = 1;
324 openEdit_O2Sensors(); 345 openEdit_O2Sensors();
346 #if 0
325 if(y_line == 5) 347 if(y_line == 5)
326 { 348 {
327 tMenuEdit_select(StMHARD3_O2_Source); 349 tMenuEdit_select(StMHARD3_O2_Source);
328 } 350 }
351 #endif
329 } 352 }
330 else 353 else
331 #endif
332 { 354 {
333 if(pStateReal->lifeData.extIf_sensor_Id == 0) 355 if(pStateReal->lifeData.extIf_sensor_Id == 0)
334 { 356 {
335 haveSensorInfo = 0; 357 haveSensorInfo = 0;
336 } 358 }
337 359
338 text[0] = '\001'; 360 strSensorId[0] = '\001';
339 text[1] = TXT_o2Sensors; 361 strSensorId[1] = TXT_o2Sensors;
340 text[2] = 0; 362 strSensorId[2] = 0;
341 write_topline(text); 363 write_topline(strSensorId);
342 364
343 365
344 text[0] = TXT_2BYTE; 366 strSensorId[0] = TXT_2BYTE;
345 text[1] = TXT2BYTE_Sensor; 367 strSensorId[1] = TXT2BYTE_Sensor;
346 text[2] = ' '; 368 strSensorId[2] = ' ';
347 text[3] = '1'; 369 strSensorId[3] = TXT_2BYTE;
348 text[4] = 0; 370 strSensorId[4] = 'X';
349 371 strSensorId[5] = '1';
372 strSensorId[6] = 0;
350 373
351 for(index = 0; index < 3; index++) 374 for(index = 0; index < 3; index++)
352 { 375 {
353 text[3] = '1' + index; 376 strSensorId[4] = 'X';
354 if((pSettings->ext_sensor_map[index] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[index] == SENSOR_DIGO2)) 377 strSensorId[5] = '1' + index;
378
379 switch(pSettings->ext_sensor_map[index])
380 {
381 case SENSOR_OPTIC: strSensorId[4] = TXT2BYTE_O2IFOptic;
382 break;
383 case SENSOR_ANALOG: strSensorId[4] = TXT2BYTE_O2IFAnalog;
384 break;
385 case SENSOR_DIGO2: strSensorId[4] = TXT2BYTE_O2IFDigital;
386 break;
387 case SENSOR_CO2: strSensorId[3] = 'C';
388 strSensorId[4] = 'O';
389 break;
390 default:
391 break;
392 }
393 if(strSensorId[4] != 'X')
394 {
395 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, strSensorId);
396 }
397 strSensorValue[0] = 0;
398 if((pSettings->ext_sensor_map[index] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[index] <= SENSOR_DIGO2))
399 {
400 snprintf(strSensorValue, 20,"%01.2f, %01.1f mV", pStateReal->lifeData.ppO2Sensor_bar[index], pStateReal->lifeData.sensorVoltage_mV[index]);
401 }
402 else if(pSettings->ext_sensor_map[index] == SENSOR_CO2)
403 {
404 snprintf(strSensorValue, 10,"%d ppm", pStateReal->lifeData.CO2_data.CO2_ppm);
405 }
406 y_line = ME_Y_LINE1 + (index * ME_Y_LINE_STEP);
407 if(strSensorValue[0] != 0)
408 {
409 write_label_var( 480, 800, y_line, &FontT48, strSensorValue);
410 }
411
412 #if 0
413 if(((pSettings->ext_sensor_map[index] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[index] > SENSOR_DIGO2)))
355 { 414 {
356 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, text); 415 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, text);
357 } 416 }
358 if(pSettings->ext_sensor_map[index] == SENSOR_CO2) 417 if(pSettings->ext_sensor_map[index] == SENSOR_CO2)
359 { 418 {
360 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, "CO2"); 419 write_label_var( 96, 340, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, "CO2");
361 } 420 }
362 } 421 #endif
422 }
423
424
425
363 426
364 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) 427 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC)
365 { 428 {
366 text[0] = TXT_2BYTE; 429 strSensorId[0] = TXT_2BYTE;
367 text[1] = TXT2BYTE_HUDbattery; 430 strSensorId[1] = TXT2BYTE_HUDbattery;
368 text[2] = 0; 431 strSensorId[2] = 0;
369 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, text); 432 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, strSensorId);
370 433
371 snprintf(text, 20,"%01.3fV", get_HUD_battery_voltage_V()); 434 snprintf(strSensorId, 20,"%01.3fV", get_HUD_battery_voltage_V());
372 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, text); 435 write_label_var( 480, 800, ME_Y_LINE4, &FontT48, strSensorId);
373 } 436 }
374 else 437 else
375 { 438 {
376 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)) 439 if((pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG))
377 { 440 {
378 text[0] = TXT_2BYTE; 441 strSensorId[0] = TXT_2BYTE;
379 text[1] = TXT2BYTE_O2Calib; 442 strSensorId[1] = TXT2BYTE_O2Calib;
380 text[2] = 0; 443 strSensorId[2] = 0;
381 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, text); 444 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, strSensorId);
382 snprintf(text, 20,"%d%%", O2_calib_gas); 445 snprintf(strSensorId, 20,"%d%%", O2_calib_gas);
383 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, text); 446 write_label_var( 480, 800, ME_Y_LINE4, &FontT48, strSensorId);
384 } 447 }
385 } 448 }
386 449
387 for(int i=0;i<3;i++) 450 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, "Autodetect");
388 { 451
389 text[0] = 0; 452 #if 0
390 if((pSettings->ext_sensor_map[i] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[i] == SENSOR_DIGO2))
391 {
392 snprintf(text, 20,"%01.2f, %01.1fmV", pStateReal->lifeData.ppO2Sensor_bar[i], pStateReal->lifeData.sensorVoltage_mV[i]);
393 }
394 else if(pSettings->ext_sensor_map[i] == SENSOR_CO2)
395 {
396 snprintf(text, 20,"%d ppm", pStateReal->lifeData.CO2_data.CO2_ppm);
397 }
398 y_line = ME_Y_LINE1 + (i * ME_Y_LINE_STEP);
399 if(text[0] != 0)
400 {
401 write_label_var( 400, 800, y_line, &FontT48, text);
402 }
403 }
404
405 if(DataEX_external_ADC_Present()) 453 if(DataEX_external_ADC_Present())
406 { 454 {
407 text[0] = TXT_2BYTE; 455 strSensorId[0] = TXT_2BYTE;
408 text[1] = TXT2BYTE_O2Interface; 456 strSensorId[1] = TXT2BYTE_O2Interface;
409 text[2] = 0; 457 strSensorId[2] = 0;
410 write_label_var( 30, 340, ME_Y_LINE5, &FontT48, text); 458 write_label_var( 30, 340, ME_Y_LINE5, &FontT48, strSensorId);
411 text[0] = TXT_2BYTE; 459 strSensorId[0] = TXT_2BYTE;
412 switch(pSettings->ppo2sensors_source) 460 switch(pSettings->ppo2sensors_source)
413 { 461 {
414 default: 462 default:
415 case O2_SENSOR_SOURCE_OPTIC: text[1] = TXT2BYTE_O2IFOptic; 463 case O2_SENSOR_SOURCE_OPTIC: strSensorId[1] = TXT2BYTE_O2IFOptic;
416 text[2] = 0; 464 strSensorId[2] = 0;
417 break; 465 break;
418 case O2_SENSOR_SOURCE_ANALOG: text[1] = TXT2BYTE_O2IFAnalog; 466 case O2_SENSOR_SOURCE_ANALOG: strSensorId[1] = TXT2BYTE_O2IFAnalog;
419 text[2] = 0; 467 strSensorId[2] = 0;
420 break; 468 break;
421 case O2_SENSOR_SOURCE_DIGITAL: text[1] = TXT2BYTE_O2IFDigital; 469 case O2_SENSOR_SOURCE_DIGITAL: strSensorId[1] = TXT2BYTE_O2IFDigital;
422 text[2] = 0; 470 strSensorId[2] = 0;
423 break; 471 break;
424 case O2_SENSOR_SOURCE_ANADIG: write_label_var( 30, 340, ME_Y_LINE6, &FontT48, "Autodetect"); 472 case O2_SENSOR_SOURCE_ANADIG: //write_label_var( 30, 340, ME_Y_LINE6, &FontT48, "Autodetect");
425 text[1] = TXT2BYTE_O2IFAnalog; 473 strSensorId[1] = TXT2BYTE_O2IFAnalog;
426 text[2] = ' '; 474 strSensorId[2] = ' ';
427 text[3] = '+'; 475 strSensorId[3] = '+';
428 text[4] = ' '; 476 strSensorId[4] = ' ';
429 text[5] = TXT_2BYTE; 477 strSensorId[5] = TXT_2BYTE;
430 text[6] = TXT2BYTE_O2IFDigital; 478 strSensorId[6] = TXT2BYTE_O2IFDigital;
431 text[7] = 0; 479 strSensorId[7] = 0;
432 break; 480 break;
433 #ifdef ENABLE_SENTINEL_MODE 481 #ifdef ENABLE_SENTINEL_MODE
434 case O2_SENSOR_SOURCE_SENTINEL: snprintf(text, 10,"Sentinel"); 482 case O2_SENSOR_SOURCE_SENTINEL: snprintf(text, 10,"Sentinel");
435 break; 483 break;
436 #endif 484 #endif
437 } 485 }
438 write_label_var( 400, 800, ME_Y_LINE5, &FontT48, text); 486 write_label_var( 480, 800, ME_Y_LINE5, &FontT48, strSensorId);
439 #if 0 487
440 if(haveSensorInfo == 1) 488
441 { 489 }
442 text[0] = TXT_Sensor;
443 text[1] = ' ';
444 text[2] = TXT_Information;
445 text[3] = 0;
446 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, text);
447 }
448 #endif 490 #endif
449 } 491 if(haveSensorInfo == 1)
450 if((pSettings->ext_sensor_map[0] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[0] == SENSOR_DIGO2)) 492 {
493 strSensorId[0] = TXT_Sensor;
494 strSensorId[1] = ' ';
495 strSensorId[2] = TXT_Information;
496 strSensorId[3] = 0;
497 write_label_var( 30, 340, ME_Y_LINE5, &FontT48, strSensorId);
498 }
499
500 if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] <= SENSOR_DIGO2))
451 { 501 {
452 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1); 502 tMenuEdit_refresh_field(StMHARD3_O2_Sensor1);
453 } 503 }
454 if((pSettings->ext_sensor_map[1] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[1] == SENSOR_DIGO2)) 504 if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] <= SENSOR_DIGO2))
455 { 505 {
456 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2); 506 tMenuEdit_refresh_field(StMHARD3_O2_Sensor2);
457 } 507 }
458 if((pSettings->ext_sensor_map[2] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[2] == SENSOR_DIGO2)) 508 if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] <= SENSOR_DIGO2))
459 { 509 {
460 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3); 510 tMenuEdit_refresh_field(StMHARD3_O2_Sensor3);
461 } 511 }
462 } 512 }
463 513
482 532
483 sensorActive[0] = 1; 533 sensorActive[0] = 1;
484 sensorActive[1] = 1; 534 sensorActive[1] = 1;
485 sensorActive[2] = 1; 535 sensorActive[2] = 1;
486 536
487 537 if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] > SENSOR_DIGO2)))
488 if(((pSettings->ext_sensor_map[0] != SENSOR_ANALOG) && (pSettings->ext_sensor_map[0] != SENSOR_DIGO2)))
489 { 538 {
490 pSettings->ppo2sensors_deactivated |= 1; 539 pSettings->ppo2sensors_deactivated |= 1;
491 } 540 }
492 else 541 else
493 { 542 {
494 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); 543 write_field_on_off(StMHARD3_O2_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]);
495 } 544 }
496 if(((pSettings->ext_sensor_map[1] != SENSOR_ANALOG) && (pSettings->ext_sensor_map[1] != SENSOR_DIGO2))) 545 if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] > SENSOR_DIGO2)))
497 { 546 {
498 pSettings->ppo2sensors_deactivated |= 2; 547 pSettings->ppo2sensors_deactivated |= 2;
499 } 548 }
500 else 549 else
501 { 550 {
502 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); 551 write_field_on_off(StMHARD3_O2_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]);
503 } 552 }
504 if(((pSettings->ext_sensor_map[2] != SENSOR_ANALOG) && (pSettings->ext_sensor_map[2] != SENSOR_DIGO2))) 553 if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] > SENSOR_DIGO2)))
505 { 554 {
506 pSettings->ppo2sensors_deactivated |= 4; 555 pSettings->ppo2sensors_deactivated |= 4;
507 } 556 }
508 else 557 else
509 { 558 {
531 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, "\016\016 %\017"); 580 write_label_var( 400, 800, ME_Y_LINE4, &FontT48, "\016\016 %\017");
532 581
533 write_field_toggle(StMHARD3_O2_Calibrate, 400, 800, ME_Y_LINE4, &FontT48, "", 21, 98); 582 write_field_toggle(StMHARD3_O2_Calibrate, 400, 800, ME_Y_LINE4, &FontT48, "", 21, 98);
534 } 583 }
535 584
536 585 if(haveSensorInfo != 0)
537 if(DataEX_external_ADC_Present()) 586 {
538 { 587 write_field_button(StMHARD3_Sensor_Info, 30, 800, ME_Y_LINE5, &FontT48, "");
539 write_field_button(StMHARD3_O2_Source, 30, 800, ME_Y_LINE5, &FontT48, ""); 588 }
540 #if 0 589
541 if(haveSensorInfo != 0) 590 write_field_button(StMHARD3_Sensor_Detect, 30, 800, ME_Y_LINE6, &FontT48, "Autodetect");
542 { 591
543 write_field_button(StMHARD3_Sensor_Info, 30, 800, ME_Y_LINE6, &FontT48, ""); 592 if((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] > SENSOR_DIGO2))
544 }
545 #endif
546 }
547
548
549 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)
550 {
551 write_field_button(StMHARD3_Sensor_Detect, 30, 800, ME_Y_LINE6, &FontT48, "Autodetect");
552 }
553
554 if((pSettings->ext_sensor_map[0] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[0] == SENSOR_DIGO2))
555 { 593 {
556 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1); 594 setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1);
557 } 595 }
558 if((pSettings->ext_sensor_map[1] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[1] == SENSOR_DIGO2)) 596 if((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] > SENSOR_DIGO2))
559 { 597 {
560 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2); 598 setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2);
561 } 599 }
562 if((pSettings->ext_sensor_map[2] == SENSOR_ANALOG) || (pSettings->ext_sensor_map[2] == SENSOR_DIGO2)) 600 if((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] > SENSOR_DIGO2))
563 { 601 {
564 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3); 602 setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3);
565 } 603 }
566 604
567 if((settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG) 605 if((settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG) || (settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)
571 ) 609 )
572 { 610 {
573 setEvent(StMHARD3_O2_Calibrate, (uint32_t)OnAction_O2_Calibrate); 611 setEvent(StMHARD3_O2_Calibrate, (uint32_t)OnAction_O2_Calibrate);
574 } 612 }
575 613
576 if(DataEX_external_ADC_Present()) 614 if(haveSensorInfo != 0)
577 { 615 {
578 setEvent(StMHARD3_O2_Source, (uint32_t)OnAction_O2_Source); 616 setEvent(StMHARD3_Sensor_Info, (uint32_t)OnAction_Sensor_Info);
579 #if 0 617 }
580 if(haveSensorInfo != 0) 618
581 { 619 setEvent(StMHARD3_Sensor_Detect, (uint32_t)OnAction_Sensor_Detect);
582 setEvent(StMHARD3_Sensor_Info, (uint32_t)OnAction_Sensor_Info);
583 }
584 #endif
585 }
586
587 if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANADIG)
588 {
589 setEvent(StMHARD3_Sensor_Detect, (uint32_t)OnAction_Sensor_Detect);
590 }
591
592
593 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); 620 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
594 } 621 }
595 622
596 623
597 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 624 uint8_t OnAction_Sensor1(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
706 exitMenuEditField(); 733 exitMenuEditField();
707 } 734 }
708 735
709 return retVal; 736 return retVal;
710 } 737 }
738 #if 0
711 uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 739 uint8_t OnAction_O2_Source (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
712 { 740 {
713 uint8_t source = settingsGetPointer()->ppo2sensors_source; 741 uint8_t source = settingsGetPointer()->ppo2sensors_source;
714 SSettings* pSettings = settingsGetPointer(); 742 SSettings* pSettings = settingsGetPointer();
715 743
742 pSettings->ppo2sensors_source = source; 770 pSettings->ppo2sensors_source = source;
743 771
744 DataEX_setExtInterface_Cmd(EXT_INTERFACE_COPY_SENSORMAP); 772 DataEX_setExtInterface_Cmd(EXT_INTERFACE_COPY_SENSORMAP);
745 773
746 openEdit_O2Sensors(); /* rebuild menu structure (Hide HUD <=> Show Calibrate) */ 774 openEdit_O2Sensors(); /* rebuild menu structure (Hide HUD <=> Show Calibrate) */
747 tMenuEdit_select(StMHARD3_O2_Source); 775 // tMenuEdit_select(StMHARD3_O2_Source);
748 return UPDATE_DIVESETTINGS; 776 return UPDATE_DIVESETTINGS;
749 } 777 }
750 778 #endif
751 uint8_t OnAction_Sensor_Info(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) 779 uint8_t OnAction_Sensor_Info(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
752 { 780 {
753 return EXIT_TO_INFO_SENSOR; 781 return EXIT_TO_INFO_SENSOR;
754 } 782 }
755 783