Mercurial > public > ostc4
changeset 994:bad5561c0c59 GasConsumption
Fix a compilation error occurring on non-Windows platforms, caused by incorrect case in '#include' file names.
Also fix some compiler warnings from non-safe use of 'memcpy'. (mikeller)
author | heinrichsweikamp |
---|---|
date | Sun, 27 Apr 2025 09:56:22 +0200 (6 days ago) |
parents | df052f0347fb |
children | 768ed327ee69 |
files | Common/Drivers/CMSIS/Include/cmsis_gcc.h Discovery/Src/settings.c Discovery/Src/show_logbook.c Discovery/Src/t7.c Discovery/Src/tInfoPreDive.c Small_CPU/Src/gpio.c |
diffstat | 6 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Drivers/CMSIS/Include/cmsis_gcc.h Fri Apr 25 08:26:03 2025 +0200 +++ b/Common/Drivers/CMSIS/Include/cmsis_gcc.h Sun Apr 27 09:56:22 2025 +0200 @@ -185,10 +185,11 @@ \param [in] topOfMainStack Main Stack Pointer value to set */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); -} +// This is deprecated, get the compiler to shut up about it +//__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +//{ +// __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); +//} /**
--- a/Discovery/Src/settings.c Fri Apr 25 08:26:03 2025 +0200 +++ b/Discovery/Src/settings.c Sun Apr 27 09:56:22 2025 +0200 @@ -463,7 +463,7 @@ pSettings->gasConsumption_deco_l_min = pStandard->gasConsumption_deco_l_min; // no break case 0xFFFF000C: - memcpy(pSettings->customtext, " hwOS 4\n\r" " welcome\n\r", 60); + strncpy(pSettings->customtext, " hwOS 4\n\r" " welcome\n\r", sizeof(pSettings->customtext)); // no break case 0xFFFF000D: // nothing to do from 0xFFFF000D to 0xFFFF000E, just about header :-) case 0xFFFF000E:
--- a/Discovery/Src/show_logbook.c Fri Apr 25 08:26:03 2025 +0200 +++ b/Discovery/Src/show_logbook.c Sun Apr 27 09:56:22 2025 +0200 @@ -897,6 +897,7 @@ releaseFrame(17,tLOGbackground.FBStartAdress); } +#define MSG_LENGTH 30 static void show_logbook_logbook_show_log_page3(GFX_DrawCfgScreen *hgfx, uint8_t StepBackwards) { @@ -919,7 +920,7 @@ uint8_t gasdata[1000]; dataLength = logbook_readSampleData(StepBackwards, 1000, depthdata,gasdata, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - char msg[15]; + char msg[MSG_LENGTH]; char gas_name[15]; int j = 0; @@ -979,18 +980,18 @@ if(index < NUM_GASES) /* Switch to Bailout is not covered by log gas list */ { snprintf(gas_name,15,"Bailout"); - snprintf(msg,15,"G%d: %s",index +1, gas_name); + snprintf(msg, MSG_LENGTH, "G%d: %s", index +1, gas_name); } else { print_gas_name(gas_name,15,logbookHeader.gasordil[index-NUM_GASES].oxygen_percentage,logbookHeader.gasordil[index-NUM_GASES].helium_percentage); - snprintf(msg,15,"D%d: %s",index +1 - NUM_GASES, gas_name); + snprintf(msg, MSG_LENGTH, "D%d: %s", index + 1 - NUM_GASES, gas_name); } } else { print_gas_name(gas_name,15,logbookHeader.gasordil[index].oxygen_percentage,logbookHeader.gasordil[index].helium_percentage); - snprintf(msg,15,"G%d: %s",index +1, gas_name); + snprintf(msg, MSG_LENGTH, "G%d: %s", index + 1, gas_name); } Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,color,msg); }
--- a/Discovery/Src/t7.c Fri Apr 25 08:26:03 2025 +0200 +++ b/Discovery/Src/t7.c Sun Apr 27 09:56:22 2025 +0200 @@ -4648,7 +4648,7 @@ } else { - memcpy (&ChargerLog[0],&ChargerLog[1],sizeof(ChargerLog) - 1); + memmove(&ChargerLog[0], &ChargerLog[1], sizeof(ChargerLog) - 1); ChargerLog[curIndex] = level; } if(curIndex > 1) /* estimate time til charging is complete */
--- a/Discovery/Src/tInfoPreDive.c Fri Apr 25 08:26:03 2025 +0200 +++ b/Discovery/Src/tInfoPreDive.c Sun Apr 27 09:56:22 2025 +0200 @@ -70,7 +70,7 @@ } else { - memcpy (&pressureHistory[0],&pressureHistory[2],sizeof(pressureHistory) - 2); + memmove(&pressureHistory[0], &pressureHistory[2], sizeof(pressureHistory) - 2); pressureHistory[pressureHistoryIndex] = newValue; } } @@ -87,7 +87,7 @@ } else { - memcpy (&temperatureHistory[0],&temperatureHistory[2],sizeof(temperatureHistory) - 2); + memmove(&temperatureHistory[0], &temperatureHistory[2], sizeof(temperatureHistory) - 2); temperatureHistory[temperatureHistoryIndex] = newValue; } }
--- a/Small_CPU/Src/gpio.c Fri Apr 25 08:26:03 2025 +0200 +++ b/Small_CPU/Src/gpio.c Sun Apr 27 09:56:22 2025 +0200 @@ -25,7 +25,7 @@ #include "gpio.h" #include "data_exchange.h" #include "scheduler.h" -#include "uart_internal.h" +#include "uart_Internal.h" #include "GNSS.h" /* Exported variables --------------------------------------------------------*/