Platform + ESP8266 printf ERROR at compilation

By calling min you are using the std::min template.

The error in eclipse is e.g.

grafik

So the problem here is that it cannot find a valid candidate. The std::min template function expects both arguments to be of the same type.

  /**
   *  @brief This does what you think it does.
   *  @ingroup sorting_algorithms
   *  @param  __a  A thing of arbitrary type.
   *  @param  __b  Another thing of arbitrary type.
   *  @return   The lesser of the parameters.
   *
   *  This is the simple classic generic implementation.  It will work on
   *  temporary expressions, since they are only evaluated once, unlike a
   *  preprocessor macro.
  */
  template<typename _Tp>
    inline const _Tp&
    min(const _Tp& __a, const _Tp& __b)
    {
      // concept requirements
      __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
      //return __b < __a ? __b : __a;
      if (__b < __a)
	return __b;
      return __a;
    }

However since you are inputting the integer constant 0xf as the righth this interperted as the int type. On the right you have a uint8_t from the array. So those are not compatible. You must cast the left expression to a uint8_t as well.

  while ( i < num_channels )
  {
    printf("%x",min((uint8_t)0xf,values[i]));
    ++i;
  }

However, you don’t need the min function at all right? You set all values of the array to 0 initially and want to print out the number of responses on that channel So why not directly values[i] but only to a maximum of 0xf = 15? The number can get easily larget than 15 because you have num_reps = 100; so you can get at maximum 100 as values[i].