message: Improve error reporting for sparkfun edge, fix false error detection issue.
diff: @@ -143,6 +143,10 @@ TfLiteStatus InitCamera(tflite::ErrorReporter* error_reporter) {
  am_hal_gpio_pinconfig(HM01B0_PIN_DVDD_EN, g_AM_HAL_GPIO_OUTPUT_12);
  am_hal_gpio_output_set(HM01B0_PIN_DVDD_EN);
  + // Configure Red LED for debugging.
  + am_hal_gpio_pinconfig(AM_BSP_GPIO_LED_RED, g_AM_HAL_GPIO_OUTPUT_12);
  + am_hal_gpio_output_clear(AM_BSP_GPIO_LED_RED);
  +
  hm01b0_power_up(&s_HM01B0Cfg);
  // TODO(njeff): check the delay time to just fit the spec.
  @@ -153,22 +157,23 @@ TfLiteStatus InitCamera(tflite::ErrorReporter* error_reporter) {
  // TODO(njeff): check the delay time to just fit the spec.
  am_util_delay_ms(1);
  - hm01b0_init_if(&s_HM01B0Cfg);
  + if (HM01B0_ERR_OK != hm01b0_init_if(&s_HM01B0Cfg)) {
  + return kTfLiteError;
  + }
  + if (HM01B0_ERR_OK !=
  hm01b0_init_system(&s_HM01B0Cfg, (hm_script_t*)sHM01B0InitScript,
  - sizeof(sHM01B0InitScript) / sizeof(hm_script_t));
  + sizeof(sHM01B0InitScript) / sizeof(hm_script_t))) {
  + return kTfLiteError;
  + }
  // Put camera into streaming mode - this makes it so that the camera
  // constantly captures images. It is still OK to read and image since the
  // camera uses a double-buffered input. This means there is always one valid
  // image to read while the other buffer fills. Streaming mode allows the
  // camera to perform auto exposure constantly.
  - am_hal_gpio_output_clear(AM_BSP_GPIO_LED_RED);
  - uint32_t error_code =
  - hm01b0_set_mode(&s_HM01B0Cfg, HM01B0_REG_MODE_SELECT_STREAMING, 0);
  - if (error_code == HM01B0_ERR_OK) {
  - am_hal_gpio_output_set(AM_BSP_GPIO_LED_RED);
  -
  + if (HM01B0_ERR_OK !=
  + hm01b0_set_mode(&s_HM01B0Cfg, HM01B0_REG_MODE_SELECT_STREAMING, 0)) {
  return kTfLiteError;
  }
  @@ -182,6 +187,7 @@ TfLiteStatus GetImage(tflite::ErrorReporter* error_reporter, int frame_width,
  if (!g_is_camera_initialized) {
  TfLiteStatus init_status = InitCamera(error_reporter);
  if (init_status != kTfLiteOk) {
  + am_hal_gpio_output_set(AM_BSP_GPIO_LED_RED);
  return init_status;
  }
  // Drop a few frames until auto exposure is calibrated.
  