diff --git a/src/ds5/ds5-device.cpp b/src/ds5/ds5-device.cpp index 619ef2dbe8..b09523b2de 100644 --- a/src/ds5/ds5-device.cpp +++ b/src/ds5/ds5-device.cpp @@ -506,16 +506,10 @@ namespace librealsense notification ds5_notification_decoder::decode(int value) { - if (value == 0) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Success" }; - if (value == ds::ds5_notifications_types::hot_laser_power_reduce) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Hot laser power reduce" }; - if (value == ds::ds5_notifications_types::hot_laser_disable) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Hot laser disable" }; - if (value == ds::ds5_notifications_types::flag_B_laser_disable) - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, "Flag B laser disable" }; - - return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_WARN, "Unknown error!" }; + if (ds::ds5_fw_error_report.find(static_cast(value)) != ds::ds5_fw_error_report.end()) + return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_ERROR, ds::ds5_fw_error_report.at(static_cast(value)) }; + + return{ RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, value, RS2_LOG_SEVERITY_WARN, (to_string() << "D400 HW report - unresolved type " << value) }; } void ds5_device::create_snapshot(std::shared_ptr& snapshot) const diff --git a/src/ds5/ds5-private.h b/src/ds5/ds5-private.h index f1a0c7ed8c..79f00b07fc 100644 --- a/src/ds5/ds5-private.h +++ b/src/ds5/ds5-private.h @@ -407,9 +407,61 @@ namespace librealsense enum ds5_notifications_types { success = 0, - hot_laser_power_reduce = 1, // reported to error depth XU control - hot_laser_disable = 2, // reported to error depth XU control - flag_B_laser_disable = 3 // reported to error depth XU control + hot_laser_power_reduce, + hot_laser_disable, + flag_B_laser_disable, + stereo_module_not_connected, + eeprom_corrupted, + calibration_corrupted, + mm_upd_fail, + isp_upd_fail, + mm_force_pause, + mm_failure, + usb_scp_overflow, + usb_rec_overflow, + usb_cam_overflow, + mipi_left_error, + mipi_right_error, + mipi_rt_error, + mipi_fe_error, + i2c_cfg_left_error, + i2c_cfg_right_error, + i2c_cfg_rt_error, + i2c_cfg_fe_error, + stream_not_start_z, + stream_not_start_y, + stream_not_start_cam, + rec_error, + }; + + // Elaborate FW XU report. The reports may be consequently extended for PU/CTL/ISP + const std::map< uint8_t, std::string> ds5_fw_error_report = { + { success, "Success" }, + { hot_laser_power_reduce, "Laser hot - power reduce" }, + { hot_laser_disable, "Laser hot - disabled" }, + { flag_B_laser_disable, "Flag B - laser disabled" }, + { stereo_module_not_connected, "Stered Module is not connected" }, + { eeprom_corrupted, "EEPROM corrupted" }, + { calibration_corrupted, "Calibration corrupted" }, + { mm_upd_fail, "Moton Module update failed" }, + { isp_upd_fail, "ISP update failed" }, + { mm_force_pause, "Motion Module force pause" }, + { mm_failure, "Motion Module failure" }, + { usb_scp_overflow, "USB SCP overflow" }, + { usb_rec_overflow, "USB REC overflow" }, + { usb_cam_overflow, "USB CAM overflow" }, + { mipi_left_error, "Left MIPI error" }, + { mipi_right_error, "Right MIPI error" }, + { mipi_rt_error, "RT MIPI error" }, + { mipi_fe_error, "FishEye MIPI error" }, + { i2c_cfg_left_error, "Left IC2 Config error" }, + { i2c_cfg_right_error, "Right IC2 Config error" }, + { i2c_cfg_rt_error, "RT IC2 Config error" }, + { i2c_cfg_fe_error, "FishEye IC2 Config error" }, + { stream_not_start_z, "Depth stream start failure" }, + { stream_not_start_y, "IR stream start failure" }, + { stream_not_start_cam, "Camera stream start failure" }, + { rec_error, "REC error" }, }; } // librealsense::ds diff --git a/src/error-handling.cpp b/src/error-handling.cpp index 94a94eabcd..a4f3f6ece6 100644 --- a/src/error-handling.cpp +++ b/src/error-handling.cpp @@ -36,16 +36,14 @@ namespace librealsense { if (cancellable_timer.try_sleep(_poll_intervals_ms)) { - auto val = 0; try { - val = static_cast(_option->query()); + auto val = static_cast(_option->query()); if (val != 0 && !_silenced) { - auto n = _decoder->decode(val); auto strong = _notifications_processor.lock(); - if (strong) strong->raise_notification(n); + if (strong) strong->raise_notification(_decoder->decode(val)); val = static_cast(_option->query()); if (val != 0)