Исправление выявленных ошибок #23

Merged
klassents merged 3 commits from v0.5.1_bugs_from_arduboy into v0.5.1 2025-05-28 12:55:20 +03:00
3 changed files with 17 additions and 19 deletions

View File

@ -56,25 +56,23 @@ enum BitOrder
#define NOT_AN_INTERRUPT -1
// Math
#ifdef __cplusplus
#include <algorithm>
using std::min;
using std::max;
#else // C
#include <stdlib.h>
#ifndef abs
#define abs(x) ((x)>0?(x):-(x))
#endif // abs
#include <stdlib.h>
// undefine stdlib's abs if encountered
#ifdef abs
#undef abs
#endif
#ifndef abs
#define abs(x) ((x)>0?(x):-(x))
#endif // abs
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif // min
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif // min
#ifndef max
#define max(a,b) ((a)>(b)?(a):(b))
#endif // max
#ifndef max
#define max(a,b) ((a)>(b)?(a):(b))
#endif // max
#endif // __cplusplus
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)

View File

@ -94,7 +94,7 @@ struct EEPROMClass{
uint16_t length() { return (uint16_t)EEPROM_LENGHT; }
template< typename T >
T &put(int idx, T &data)
const T &put(int idx, const T &data)
{
void* dataPointer = (void*)&data;
// check if idx is valid

View File

@ -34,8 +34,8 @@ compiler.optimization_flags.debug=-Og -g3
compiler.extra_flags = -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medlow -Wall -fsigned-char -ffunction-sections
compiler.S.flags = {compiler.extra_flags} -x assembler-with-cpp {compiler.define} -I"{runtime.platform.path}/libraries/FreeRTOS/src" {compiler.optimization_flags} {compiler.warning_flags} {compiler.MIK32_Amur.extra_include}
compiler.c.flags = -c -std=gnu11 {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include}
compiler.cpp.flags = -c -std=gnu++17 -fabi-version=0 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include}
compiler.c.flags = -c -std=gnu11 -Werror=return-type {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include}
compiler.cpp.flags = -c -std=gnu++17 -fabi-version=0 -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics -Werror=return-type {compiler.extra_flags} {compiler.define} {compiler.warning_flags} {compiler.optimization_flags} {compiler.MIK32_Amur.extra_include}
compiler.c.elf.flags = -march=rv32imc_zicsr_zifencei -mabi=ilp32 -mcmodel=medlow -nostartfiles -Xlinker
compiler.ar.flags=rc
compiler.elf2bin.flags=-O binary