Both getEpochTime() and inReference are uint32_t, so what is that statement trying to achieve?
Maybe forget using abs???
Code: Select all
return (getEpochTime() > inReference ) ? getEpochTime() - inReference : inReference - getEpochTime();
Both getEpochTime() and inReference are uint32_t, so what is that statement trying to achieve?
Code: Select all
return (getEpochTime() > inReference ) ? getEpochTime() - inReference : inReference - getEpochTime();
I've made a PR with the variant, please test it as I do not have this SIP.simpleboy wrote: Mon May 30, 2022 7:49 am This variant I make is also the one I use in the deprecated stm32 core version 1.5.0.
I want to update it now to the official stm32 core, but I think I need to edit a lot of things, maybe I have more dependencies on that earlier version. I appreciate your help with this.
The variant works fine. Thank you.fpiSTM wrote: Tue May 31, 2022 7:39 amI've made a PR with the variant, please test it as I do not have this SIP.simpleboy wrote: Mon May 30, 2022 7:49 am This variant I make is also the one I use in the deprecated stm32 core version 1.5.0.
I want to update it now to the official stm32 core, but I think I need to edit a lot of things, maybe I have more dependencies on that earlier version. I appreciate your help with this.
Casted it like what you suggest:fpiSTM wrote: Tue May 31, 2022 7:33 am STL C++ abs() is as described in this link:
https://en.cppreference.com/w/cpp/numeric/math/abs
so as stated by the log: abs(uint32_t) does not exist.
Simply cast like that:
return (abs(((long long)getEpochTime() - (long long)inReference)))
Moreover subtract 2 unsigned number is not advised...
This code is not part of the STM32RTC library, so it is not link to the core. It is purely an issue in the code you used.
Code: Select all
return (abs(((long long)getEpochTime() - (long long)inReference)));
Code: Select all
-------------------------------------------------------------------
STM32CubeProgrammer v2.10.0
-------------------------------------------------------------------
Serial Port ttyUSB0 is successfully opened.
Port configuration: parity = even, baudrate = 115200, data-bit = 8,
stop-bit = 1.0, flow-control = off
Code: Select all
${STM32CP_CLI} -c port=${PORT} p=none ${MODE} ${ERASE:+"-e all"} -q -d "${FILEPATH}" ${ADDRESS} "${OPTS}"
Code: Select all
-------------------------------------------------------------------
STM32CubeProgrammer v2.10.0
-------------------------------------------------------------------
Serial Port ttyUSB0 is successfully opened.
Port configuration: parity = none, baudrate = 115200, data-bit = 8,
stop-bit = 1.0, flow-control = off
Timeout error occured while waiting for acknowledgement.
Activating device: OK
Board : --
Response received from device: NACK
Error: GETID command not acknowledged!
Reemission of GetID command