From 787bc46bdcaafeb100216360b5c3109eed88ad2e Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Sun, 3 Apr 2022 12:37:27 +1000 Subject: [PATCH 01/37] SC7A20 tweaks (#1251) * Clean up handling of addresses * Update SC7A20.hpp * Try remapped Accel readings * Fake LIS setup? * Refining build options --- source/Core/Drivers/SC7A20.cpp | 34 +- source/Core/Drivers/SC7A20.hpp | 4 +- source/Core/Drivers/SC7A20_defines.h | 1 + source/Makefile | 6 +- .../Third_Party/FreeRTOS/Source/queue.c | 4342 ++++++++--------- 5 files changed, 1951 insertions(+), 2436 deletions(-) diff --git a/source/Core/Drivers/SC7A20.cpp b/source/Core/Drivers/SC7A20.cpp index cd37e584..81c8d1c2 100644 --- a/source/Core/Drivers/SC7A20.cpp +++ b/source/Core/Drivers/SC7A20.cpp @@ -5,11 +5,16 @@ * Author: Ralim */ +#include "LIS2DH12_defines.hpp" #include #include #include -uint8_t SC7A20::activeAddress; +bool SC7A20::isInImitationMode; +/* +- This little accelerometer seems to come in two forms, its "normal" setup, and then one where it imitates the LIS2DH12 +- This can be detected by checking the whoami registers +*/ bool SC7A20::detect() { if (FRToSI2C::probe(SC7A20_ADDRESS)) { @@ -17,7 +22,7 @@ bool SC7A20::detect() { uint8_t id = 0; if (FRToSI2C::Mem_Read(SC7A20_ADDRESS, SC7A20_WHO_AMI_I, &id, 1)) { if (id == SC7A20_WHO_AM_I_VALUE) { - activeAddress = SC7A20_ADDRESS; + isInImitationMode = false; return true; } } @@ -27,7 +32,7 @@ bool SC7A20::detect() { uint8_t id = 0; if (FRToSI2C::Mem_Read(SC7A20_ADDRESS2, SC7A20_WHO_AMI_I, &id, 1)) { if (id == SC7A20_WHO_AM_I_VALUE) { - activeAddress = SC7A20_ADDRESS2; + isInImitationMode = true; return true; } } @@ -54,6 +59,20 @@ static const FRToSI2C::I2C_REG i2c_registers[] = { // }; +static const FRToSI2C::I2C_REG i2c_registers_alt[] = {{LIS_CTRL_REG1, 0b00110111, 0}, // 200Hz XYZ + {LIS_CTRL_REG2, 0b00000000, 0}, // + {LIS_CTRL_REG3, 0b01100000, 0}, // Setup interrupt pins + {LIS_CTRL_REG4, 0b00001000, 0}, // Block update mode off, HR on + {LIS_CTRL_REG5, 0b00000010, 0}, // + {LIS_CTRL_REG6, 0b01100010, 0}, + // Basically setup the unit to run, and enable 4D orientation detection + {LIS_INT2_CFG, 0b01111110, 0}, // setup for movement detection + {LIS_INT2_THS, 0x28, 0}, // + {LIS_INT2_DURATION, 64, 0}, // + {LIS_INT1_CFG, 0b01111110, 0}, // + {LIS_INT1_THS, 0x28, 0}, // + {LIS_INT1_DURATION, 64, 0}}; + bool SC7A20::initalize() { // Setup acceleration readings // 2G range @@ -63,15 +82,18 @@ bool SC7A20::initalize() { // Orientation recognition in symmetrical mode // Hysteresis is set to ~ 16 counts // Theta blocking is set to 0b10 - - return FRToSI2C::writeRegistersBulk(activeAddress, i2c_registers, sizeof(i2c_registers) / sizeof(i2c_registers[0])); + if (isInImitationMode) { + return FRToSI2C::writeRegistersBulk(SC7A20_ADDRESS2, i2c_registers_alt, sizeof(i2c_registers_alt) / sizeof(i2c_registers_alt[0])); + } else { + return FRToSI2C::writeRegistersBulk(SC7A20_ADDRESS, i2c_registers, sizeof(i2c_registers) / sizeof(i2c_registers[0])); + } } void SC7A20::getAxisReadings(int16_t &x, int16_t &y, int16_t &z) { // We can tell the accelerometer to output in LE mode which makes this simple uint16_t sensorData[3] = {0, 0, 0}; - if (FRToSI2C::Mem_Read(SC7A20_ADDRESS, SC7A20_OUT_X_L, (uint8_t *)sensorData, 6) == false) { + if (FRToSI2C::Mem_Read(isInImitationMode ? SC7A20_ADDRESS2 : SC7A20_ADDRESS, isInImitationMode ? SC7A20_OUT_X_L_ALT : SC7A20_OUT_X_L, (uint8_t *)sensorData, 6) == false) { x = y = z = 0; return; } diff --git a/source/Core/Drivers/SC7A20.hpp b/source/Core/Drivers/SC7A20.hpp index 88a942cb..ea65f824 100644 --- a/source/Core/Drivers/SC7A20.hpp +++ b/source/Core/Drivers/SC7A20.hpp @@ -17,7 +17,7 @@ public: static bool initalize(); // 1 = rh, 2,=lh, 8=flat static Orientation getOrientation() { - uint8_t val = ((FRToSI2C::I2C_RegisterRead(activeAddress, SC7A20_INT2_SOURCE) >> 2) - 1); + uint8_t val = ((FRToSI2C::I2C_RegisterRead(isInImitationMode ? SC7A20_ADDRESS2 : SC7A20_ADDRESS, SC7A20_INT2_SOURCE) >> 2) - 1); if (val == 1) { #ifdef SC7_ORI_FLIP return Orientation::ORIENTATION_RIGHT_HAND; @@ -36,7 +36,7 @@ public: static void getAxisReadings(int16_t &x, int16_t &y, int16_t &z); private: - static uint8_t activeAddress; + static bool isInImitationMode; }; #endif /* CORE_DRIVERS_BMA223_HPP_ */ diff --git a/source/Core/Drivers/SC7A20_defines.h b/source/Core/Drivers/SC7A20_defines.h index 85fc5720..0ff64b02 100644 --- a/source/Core/Drivers/SC7A20_defines.h +++ b/source/Core/Drivers/SC7A20_defines.h @@ -23,6 +23,7 @@ #define SC7A20_REFERENCE 0x26 #define SC7A20_STATUS_REG 0x27 #define SC7A20_OUT_X_L 0x28 +#define SC7A20_OUT_X_L_ALT 0xA8 #define SC7A20_OUT_X_H 0x29 #define SC7A20_OUT_Y_L 0x2A #define SC7A20_OUT_Y_H 0x2B diff --git a/source/Makefile b/source/Makefile index 7169ca2d..0de50fbf 100644 --- a/source/Makefile +++ b/source/Makefile @@ -192,7 +192,7 @@ $(shell find $(DEVICE_BSP_DIR) -type f -name '*.cpp') \ $(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp') # code optimisation ------------------------------------------------------------ -OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -ffreestanding -fno-common +OPTIM=-Os -flto -finline-small-functions -fshort-wchar -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common # global defines --------------------------------------------------------------- GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U @@ -293,8 +293,6 @@ CXXFLAGS=$(DEV_CXXFLAGS) \ -fno-non-call-exceptions \ -fno-use-cxa-atexit \ -fno-strict-aliasing \ - -fno-rtti \ - -fno-exceptions \ -fno-threadsafe-statics \ -T$(LDSCRIPT) @@ -307,7 +305,7 @@ CFLAGS=$(DEV_CFLAGS) \ $(GLOBAL_DEFINES) \ -D${COMPILER} \ -MMD \ - -std=gnu99 \ + -std=gnu11 \ $(OPTIM) \ -T$(LDSCRIPT) \ -c diff --git a/source/Middlewares/Third_Party/FreeRTOS/Source/queue.c b/source/Middlewares/Third_Party/FreeRTOS/Source/queue.c index e35055fa..7c216fac 100644 --- a/source/Middlewares/Third_Party/FreeRTOS/Source/queue.c +++ b/source/Middlewares/Third_Party/FreeRTOS/Source/queue.c @@ -34,11 +34,12 @@ task.h is included from an application file. */ #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE #include "FreeRTOS.h" -#include "task.h" #include "queue.h" +#include "task.h" -#if ( configUSE_CO_ROUTINES == 1 ) - #include "croutine.h" + +#if (configUSE_CO_ROUTINES == 1) +#include "croutine.h" #endif /* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified @@ -47,10 +48,9 @@ for the header files above, but not in this file, in order to generate the correct privileged Vs unprivileged linkage and placement. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */ - /* Constants used with the cRxLock and cTxLock structure members. */ -#define queueUNLOCKED ( ( int8_t ) -1 ) -#define queueLOCKED_UNMODIFIED ( ( int8_t ) 0 ) +#define queueUNLOCKED ((int8_t)-1) +#define queueLOCKED_UNMODIFIED ((int8_t)0) /* When the Queue_t structure is used to represent a base queue its pcHead and pcTail members are used as pointers into the queue storage area. When the @@ -61,32 +61,30 @@ names to the pcHead and structure member to ensure the readability of the code is maintained. The QueuePointers_t and SemaphoreData_t types are used to form a union as their usage is mutually exclusive dependent on what the queue is being used for. */ -#define uxQueueType pcHead -#define queueQUEUE_IS_MUTEX NULL +#define uxQueueType pcHead +#define queueQUEUE_IS_MUTEX NULL -typedef struct QueuePointers -{ - int8_t *pcTail; /*< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */ - int8_t *pcReadFrom; /*< Points to the last place that a queued item was read from when the structure is used as a queue. */ +typedef struct QueuePointers { + int8_t *pcTail; /*< Points to the byte at the end of the queue storage area. Once more byte is allocated than necessary to store the queue items, this is used as a marker. */ + int8_t *pcReadFrom; /*< Points to the last place that a queued item was read from when the structure is used as a queue. */ } QueuePointers_t; -typedef struct SemaphoreData -{ - TaskHandle_t xMutexHolder; /*< The handle of the task that holds the mutex. */ - UBaseType_t uxRecursiveCallCount;/*< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */ +typedef struct SemaphoreData { + TaskHandle_t xMutexHolder; /*< The handle of the task that holds the mutex. */ + UBaseType_t uxRecursiveCallCount; /*< Maintains a count of the number of times a recursive mutex has been recursively 'taken' when the structure is used as a mutex. */ } SemaphoreData_t; /* Semaphores do not actually store or copy data, so have an item size of zero. */ -#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( UBaseType_t ) 0 ) -#define queueMUTEX_GIVE_BLOCK_TIME ( ( TickType_t ) 0U ) +#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ((UBaseType_t)0) +#define queueMUTEX_GIVE_BLOCK_TIME ((TickType_t)0U) -#if( configUSE_PREEMPTION == 0 ) - /* If the cooperative scheduler is being used then a yield should not be - performed just because a higher priority task has been woken. */ - #define queueYIELD_IF_USING_PREEMPTION() +#if (configUSE_PREEMPTION == 0) +/* If the cooperative scheduler is being used then a yield should not be +performed just because a higher priority task has been woken. */ +#define queueYIELD_IF_USING_PREEMPTION() #else - #define queueYIELD_IF_USING_PREEMPTION() portYIELD_WITHIN_API() +#define queueYIELD_IF_USING_PREEMPTION() portYIELD_WITHIN_API() #endif /* @@ -94,39 +92,38 @@ zero. */ * Items are queued by copy, not reference. See the following link for the * rationale: https://www.freertos.org/Embedded-RTOS-Queues.html */ -typedef struct QueueDefinition /* The old naming convention is used to prevent breaking kernel aware debuggers. */ +typedef struct QueueDefinition /* The old naming convention is used to prevent breaking kernel aware debuggers. */ { - int8_t *pcHead; /*< Points to the beginning of the queue storage area. */ - int8_t *pcWriteTo; /*< Points to the free next place in the storage area. */ + int8_t *pcHead; /*< Points to the beginning of the queue storage area. */ + int8_t *pcWriteTo; /*< Points to the free next place in the storage area. */ - union - { - QueuePointers_t xQueue; /*< Data required exclusively when this structure is used as a queue. */ - SemaphoreData_t xSemaphore; /*< Data required exclusively when this structure is used as a semaphore. */ - } u; + union { + QueuePointers_t xQueue; /*< Data required exclusively when this structure is used as a queue. */ + SemaphoreData_t xSemaphore; /*< Data required exclusively when this structure is used as a semaphore. */ + } u; - List_t xTasksWaitingToSend; /*< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */ - List_t xTasksWaitingToReceive; /*< List of tasks that are blocked waiting to read from this queue. Stored in priority order. */ + List_t xTasksWaitingToSend; /*< List of tasks that are blocked waiting to post onto this queue. Stored in priority order. */ + List_t xTasksWaitingToReceive; /*< List of tasks that are blocked waiting to read from this queue. Stored in priority order. */ - volatile UBaseType_t uxMessagesWaiting;/*< The number of items currently in the queue. */ - UBaseType_t uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */ - UBaseType_t uxItemSize; /*< The size of each items that the queue will hold. */ + volatile UBaseType_t uxMessagesWaiting; /*< The number of items currently in the queue. */ + UBaseType_t uxLength; /*< The length of the queue defined as the number of items it will hold, not the number of bytes. */ + UBaseType_t uxItemSize; /*< The size of each items that the queue will hold. */ - volatile int8_t cRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - volatile int8_t cTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ + volatile int8_t cRxLock; /*< Stores the number of items received from the queue (removed from the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ + volatile int8_t cTxLock; /*< Stores the number of items transmitted to the queue (added to the queue) while the queue was locked. Set to queueUNLOCKED when the queue is not locked. */ - #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) - uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the memory used by the queue was statically allocated to ensure no attempt is made to free the memory. */ - #endif +#if ((configSUPPORT_STATIC_ALLOCATION == 1) && (configSUPPORT_DYNAMIC_ALLOCATION == 1)) + uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the memory used by the queue was statically allocated to ensure no attempt is made to free the memory. */ +#endif - #if ( configUSE_QUEUE_SETS == 1 ) - struct QueueDefinition *pxQueueSetContainer; - #endif +#if (configUSE_QUEUE_SETS == 1) + struct QueueDefinition *pxQueueSetContainer; +#endif - #if ( configUSE_TRACE_FACILITY == 1 ) - UBaseType_t uxQueueNumber; - uint8_t ucQueueType; - #endif +#if (configUSE_TRACE_FACILITY == 1) + UBaseType_t uxQueueNumber; + uint8_t ucQueueType; +#endif } xQUEUE; @@ -140,26 +137,25 @@ typedef xQUEUE Queue_t; * The queue registry is just a means for kernel aware debuggers to locate * queue structures. It has no other purpose so is an optional component. */ -#if ( configQUEUE_REGISTRY_SIZE > 0 ) +#if (configQUEUE_REGISTRY_SIZE > 0) - /* The type stored within the queue registry array. This allows a name - to be assigned to each queue making kernel aware debugging a little - more user friendly. */ - typedef struct QUEUE_REGISTRY_ITEM - { - const char *pcQueueName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - QueueHandle_t xHandle; - } xQueueRegistryItem; +/* The type stored within the queue registry array. This allows a name +to be assigned to each queue making kernel aware debugging a little +more user friendly. */ +typedef struct QUEUE_REGISTRY_ITEM { + const char *pcQueueName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ + QueueHandle_t xHandle; +} xQueueRegistryItem; - /* The old xQueueRegistryItem name is maintained above then typedefed to the - new xQueueRegistryItem name below to enable the use of older kernel aware - debuggers. */ - typedef xQueueRegistryItem QueueRegistryItem_t; +/* The old xQueueRegistryItem name is maintained above then typedefed to the +new xQueueRegistryItem name below to enable the use of older kernel aware +debuggers. */ +typedef xQueueRegistryItem QueueRegistryItem_t; - /* The queue registry is simply an array of QueueRegistryItem_t structures. - The pcQueueName member of a structure being NULL is indicative of the - array position being vacant. */ - PRIVILEGED_DATA QueueRegistryItem_t xQueueRegistry[ configQUEUE_REGISTRY_SIZE ]; +/* The queue registry is simply an array of QueueRegistryItem_t structures. +The pcQueueName member of a structure being NULL is indicative of the +array position being vacant. */ +PRIVILEGED_DATA QueueRegistryItem_t xQueueRegistry[configQUEUE_REGISTRY_SIZE]; #endif /* configQUEUE_REGISTRY_SIZE */ @@ -171,65 +167,65 @@ typedef xQUEUE Queue_t; * to indicate that a task may require unblocking. When the queue in unlocked * these lock counts are inspected, and the appropriate action taken. */ -static void prvUnlockQueue( Queue_t * const pxQueue ) PRIVILEGED_FUNCTION; +static void prvUnlockQueue(Queue_t *const pxQueue) PRIVILEGED_FUNCTION; /* * Uses a critical section to determine if there is any data in a queue. * * @return pdTRUE if the queue contains no items, otherwise pdFALSE. */ -static BaseType_t prvIsQueueEmpty( const Queue_t *pxQueue ) PRIVILEGED_FUNCTION; +static BaseType_t prvIsQueueEmpty(const Queue_t *pxQueue) PRIVILEGED_FUNCTION; /* * Uses a critical section to determine if there is any space in a queue. * * @return pdTRUE if there is no space, otherwise pdFALSE; */ -static BaseType_t prvIsQueueFull( const Queue_t *pxQueue ) PRIVILEGED_FUNCTION; +static BaseType_t prvIsQueueFull(const Queue_t *pxQueue) PRIVILEGED_FUNCTION; /* * Copies an item into the queue, either at the front of the queue or the * back of the queue. */ -static BaseType_t prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition ) PRIVILEGED_FUNCTION; +static BaseType_t prvCopyDataToQueue(Queue_t *const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition) PRIVILEGED_FUNCTION; /* * Copies an item out of a queue. */ -static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; +static void prvCopyDataFromQueue(Queue_t *const pxQueue, void *const pvBuffer) PRIVILEGED_FUNCTION; -#if ( configUSE_QUEUE_SETS == 1 ) - /* - * Checks to see if a queue is a member of a queue set, and if so, notifies - * the queue set that the queue contains data. - */ - static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue ) PRIVILEGED_FUNCTION; +#if (configUSE_QUEUE_SETS == 1) +/* + * Checks to see if a queue is a member of a queue set, and if so, notifies + * the queue set that the queue contains data. + */ +static BaseType_t prvNotifyQueueSetContainer(const Queue_t *const pxQueue) PRIVILEGED_FUNCTION; #endif /* * Called after a Queue_t structure has been allocated either statically or * dynamically to fill in the structure's members. */ -static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION; +static void prvInitialiseNewQueue(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue) PRIVILEGED_FUNCTION; /* * Mutexes are a special type of queue. When a mutex is created, first the * queue is created, then prvInitialiseMutex() is called to configure the queue * as a mutex. */ -#if( configUSE_MUTEXES == 1 ) - static void prvInitialiseMutex( Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION; +#if (configUSE_MUTEXES == 1) +static void prvInitialiseMutex(Queue_t *pxNewQueue) PRIVILEGED_FUNCTION; #endif -#if( configUSE_MUTEXES == 1 ) - /* - * If a task waiting for a mutex causes the mutex holder to inherit a - * priority, but the waiting task times out, then the holder should - * disinherit the priority - but only down to the highest priority of any - * other tasks that are waiting for the same mutex. This function returns - * that priority. - */ - static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue ) PRIVILEGED_FUNCTION; +#if (configUSE_MUTEXES == 1) +/* + * If a task waiting for a mutex causes the mutex holder to inherit a + * priority, but the waiting task times out, then the holder should + * disinherit the priority - but only down to the highest priority of any + * other tasks that are waiting for the same mutex. This function returns + * that priority. + */ +static UBaseType_t prvGetDisinheritPriorityAfterTimeout(const Queue_t *const pxQueue) PRIVILEGED_FUNCTION; #endif /*-----------------------------------------------------------*/ @@ -237,2709 +233,2207 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT * Macro to mark a queue as locked. Locking a queue prevents an ISR from * accessing the queue event lists. */ -#define prvLockQueue( pxQueue ) \ - taskENTER_CRITICAL(); \ - { \ - if( ( pxQueue )->cRxLock == queueUNLOCKED ) \ - { \ - ( pxQueue )->cRxLock = queueLOCKED_UNMODIFIED; \ - } \ - if( ( pxQueue )->cTxLock == queueUNLOCKED ) \ - { \ - ( pxQueue )->cTxLock = queueLOCKED_UNMODIFIED; \ - } \ - } \ - taskEXIT_CRITICAL() +#define prvLockQueue(pxQueue) \ + taskENTER_CRITICAL(); \ + { \ + if ((pxQueue)->cRxLock == queueUNLOCKED) { \ + (pxQueue)->cRxLock = queueLOCKED_UNMODIFIED; \ + } \ + if ((pxQueue)->cTxLock == queueUNLOCKED) { \ + (pxQueue)->cTxLock = queueLOCKED_UNMODIFIED; \ + } \ + } \ + taskEXIT_CRITICAL() /*-----------------------------------------------------------*/ -BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) -{ -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueGenericReset(QueueHandle_t xQueue, BaseType_t xNewQueue) { + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); + configASSERT(pxQueue); - taskENTER_CRITICAL(); - { - pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ - pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U; - pxQueue->pcWriteTo = pxQueue->pcHead; - pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - 1U ) * pxQueue->uxItemSize ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ - pxQueue->cRxLock = queueUNLOCKED; - pxQueue->cTxLock = queueUNLOCKED; + taskENTER_CRITICAL(); + { + pxQueue->u.xQueue.pcTail = pxQueue->pcHead + (pxQueue->uxLength * pxQueue->uxItemSize); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ + pxQueue->uxMessagesWaiting = (UBaseType_t)0U; + pxQueue->pcWriteTo = pxQueue->pcHead; + pxQueue->u.xQueue.pcReadFrom + = pxQueue->pcHead + ((pxQueue->uxLength - 1U) * pxQueue->uxItemSize); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ + pxQueue->cRxLock = queueUNLOCKED; + pxQueue->cTxLock = queueUNLOCKED; - if( xNewQueue == pdFALSE ) - { - /* If there are tasks blocked waiting to read from the queue, then - the tasks will remain blocked as after this function exits the queue - will still be empty. If there are tasks blocked waiting to write to - the queue, then one should be unblocked as after this function exits - it will be possible to write to it. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* Ensure the event queues start in the correct state. */ - vListInitialise( &( pxQueue->xTasksWaitingToSend ) ); - vListInitialise( &( pxQueue->xTasksWaitingToReceive ) ); - } - } - taskEXIT_CRITICAL(); + if (xNewQueue == pdFALSE) { + /* If there are tasks blocked waiting to read from the queue, then + the tasks will remain blocked as after this function exits the queue + will still be empty. If there are tasks blocked waiting to write to + the queue, then one should be unblocked as after this function exits + it will be possible to write to it. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* Ensure the event queues start in the correct state. */ + vListInitialise(&(pxQueue->xTasksWaitingToSend)); + vListInitialise(&(pxQueue->xTasksWaitingToReceive)); + } + } + taskEXIT_CRITICAL(); - /* A value is returned for calling semantic consistency with previous - versions. */ - return pdPASS; + /* A value is returned for calling semantic consistency with previous + versions. */ + return pdPASS; } /*-----------------------------------------------------------*/ -#if( configSUPPORT_STATIC_ALLOCATION == 1 ) +#if (configSUPPORT_STATIC_ALLOCATION == 1) - QueueHandle_t xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType ) - { - Queue_t *pxNewQueue; +QueueHandle_t xQueueGenericCreateStatic(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType) { + Queue_t *pxNewQueue; - configASSERT( uxQueueLength > ( UBaseType_t ) 0 ); + configASSERT(uxQueueLength > (UBaseType_t)0); - /* The StaticQueue_t structure and the queue storage area must be - supplied. */ - configASSERT( pxStaticQueue != NULL ); + /* The StaticQueue_t structure and the queue storage area must be + supplied. */ + configASSERT(pxStaticQueue != NULL); - /* A queue storage area should be provided if the item size is not 0, and - should not be provided if the item size is 0. */ - configASSERT( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0 ) ) ); - configASSERT( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0 ) ) ); + /* A queue storage area should be provided if the item size is not 0, and + should not be provided if the item size is 0. */ + configASSERT(!((pucQueueStorage != NULL) && (uxItemSize == 0))); + configASSERT(!((pucQueueStorage == NULL) && (uxItemSize != 0))); - #if( configASSERT_DEFINED == 1 ) - { - /* Sanity check that the size of the structure used to declare a - variable of type StaticQueue_t or StaticSemaphore_t equals the size of - the real queue and semaphore structures. */ - volatile size_t xSize = sizeof( StaticQueue_t ); - configASSERT( xSize == sizeof( Queue_t ) ); - ( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */ - } - #endif /* configASSERT_DEFINED */ +#if (configASSERT_DEFINED == 1) + { + /* Sanity check that the size of the structure used to declare a + variable of type StaticQueue_t or StaticSemaphore_t equals the size of + the real queue and semaphore structures. */ + volatile size_t xSize = sizeof(StaticQueue_t); + configASSERT(xSize == sizeof(Queue_t)); + (void)xSize; /* Keeps lint quiet when configASSERT() is not defined. */ + } +#endif /* configASSERT_DEFINED */ - /* The address of a statically allocated queue was passed in, use it. - The address of a statically allocated storage area was also passed in - but is already set. */ - pxNewQueue = ( Queue_t * ) pxStaticQueue; /*lint !e740 !e9087 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */ + /* The address of a statically allocated queue was passed in, use it. + The address of a statically allocated storage area was also passed in + but is already set. */ + pxNewQueue = (Queue_t *)pxStaticQueue; /*lint !e740 !e9087 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */ - if( pxNewQueue != NULL ) - { - #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) - { - /* Queues can be allocated wither statically or dynamically, so - note this queue was allocated statically in case the queue is - later deleted. */ - pxNewQueue->ucStaticallyAllocated = pdTRUE; - } - #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ + if (pxNewQueue != NULL) { +#if (configSUPPORT_DYNAMIC_ALLOCATION == 1) + { + /* Queues can be allocated wither statically or dynamically, so + note this queue was allocated statically in case the queue is + later deleted. */ + pxNewQueue->ucStaticallyAllocated = pdTRUE; + } +#endif /* configSUPPORT_DYNAMIC_ALLOCATION */ - prvInitialiseNewQueue( uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue ); - } - else - { - traceQUEUE_CREATE_FAILED( ucQueueType ); - mtCOVERAGE_TEST_MARKER(); - } + prvInitialiseNewQueue(uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue); + } else { + traceQUEUE_CREATE_FAILED(ucQueueType); + mtCOVERAGE_TEST_MARKER(); + } - return pxNewQueue; - } + return pxNewQueue; +} #endif /* configSUPPORT_STATIC_ALLOCATION */ /*-----------------------------------------------------------*/ -#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) +#if (configSUPPORT_DYNAMIC_ALLOCATION == 1) - QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) - { - Queue_t *pxNewQueue; - size_t xQueueSizeInBytes; - uint8_t *pucQueueStorage; +QueueHandle_t xQueueGenericCreate(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType) { + Queue_t *pxNewQueue; + size_t xQueueSizeInBytes; + uint8_t *pucQueueStorage; - configASSERT( uxQueueLength > ( UBaseType_t ) 0 ); + configASSERT(uxQueueLength > (UBaseType_t)0); - /* Allocate enough space to hold the maximum number of items that - can be in the queue at any time. It is valid for uxItemSize to be - zero in the case the queue is used as a semaphore. */ - xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ + /* Allocate enough space to hold the maximum number of items that + can be in the queue at any time. It is valid for uxItemSize to be + zero in the case the queue is used as a semaphore. */ + xQueueSizeInBytes = (size_t)(uxQueueLength * uxItemSize); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ - /* Allocate the queue and storage area. Justification for MISRA - deviation as follows: pvPortMalloc() always ensures returned memory - blocks are aligned per the requirements of the MCU stack. In this case - pvPortMalloc() must return a pointer that is guaranteed to meet the - alignment requirements of the Queue_t structure - which in this case - is an int8_t *. Therefore, whenever the stack alignment requirements - are greater than or equal to the pointer to char requirements the cast - is safe. In other cases alignment requirements are not strict (one or - two bytes). */ - pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) + xQueueSizeInBytes ); /*lint !e9087 !e9079 see comment above. */ + /* Allocate the queue and storage area. Justification for MISRA + deviation as follows: pvPortMalloc() always ensures returned memory + blocks are aligned per the requirements of the MCU stack. In this case + pvPortMalloc() must return a pointer that is guaranteed to meet the + alignment requirements of the Queue_t structure - which in this case + is an int8_t *. Therefore, whenever the stack alignment requirements + are greater than or equal to the pointer to char requirements the cast + is safe. In other cases alignment requirements are not strict (one or + two bytes). */ + pxNewQueue = (Queue_t *)pvPortMalloc(sizeof(Queue_t) + xQueueSizeInBytes); /*lint !e9087 !e9079 see comment above. */ - if( pxNewQueue != NULL ) - { - /* Jump past the queue structure to find the location of the queue - storage area. */ - pucQueueStorage = ( uint8_t * ) pxNewQueue; - pucQueueStorage += sizeof( Queue_t ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ + if (pxNewQueue != NULL) { + /* Jump past the queue structure to find the location of the queue + storage area. */ + pucQueueStorage = (uint8_t *)pxNewQueue; + pucQueueStorage += sizeof(Queue_t); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ - #if( configSUPPORT_STATIC_ALLOCATION == 1 ) - { - /* Queues can be created either statically or dynamically, so - note this task was created dynamically in case it is later - deleted. */ - pxNewQueue->ucStaticallyAllocated = pdFALSE; - } - #endif /* configSUPPORT_STATIC_ALLOCATION */ +#if (configSUPPORT_STATIC_ALLOCATION == 1) + { + /* Queues can be created either statically or dynamically, so + note this task was created dynamically in case it is later + deleted. */ + pxNewQueue->ucStaticallyAllocated = pdFALSE; + } +#endif /* configSUPPORT_STATIC_ALLOCATION */ - prvInitialiseNewQueue( uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue ); - } - else - { - traceQUEUE_CREATE_FAILED( ucQueueType ); - mtCOVERAGE_TEST_MARKER(); - } + prvInitialiseNewQueue(uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue); + } else { + traceQUEUE_CREATE_FAILED(ucQueueType); + mtCOVERAGE_TEST_MARKER(); + } - return pxNewQueue; - } + return pxNewQueue; +} #endif /* configSUPPORT_STATIC_ALLOCATION */ /*-----------------------------------------------------------*/ -static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue ) -{ - /* Remove compiler warnings about unused parameters should - configUSE_TRACE_FACILITY not be set to 1. */ - ( void ) ucQueueType; +static void prvInitialiseNewQueue(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue) { + /* Remove compiler warnings about unused parameters should + configUSE_TRACE_FACILITY not be set to 1. */ + (void)ucQueueType; - if( uxItemSize == ( UBaseType_t ) 0 ) - { - /* No RAM was allocated for the queue storage area, but PC head cannot - be set to NULL because NULL is used as a key to say the queue is used as - a mutex. Therefore just set pcHead to point to the queue as a benign - value that is known to be within the memory map. */ - pxNewQueue->pcHead = ( int8_t * ) pxNewQueue; - } - else - { - /* Set the head to the start of the queue storage area. */ - pxNewQueue->pcHead = ( int8_t * ) pucQueueStorage; - } + if (uxItemSize == (UBaseType_t)0) { + /* No RAM was allocated for the queue storage area, but PC head cannot + be set to NULL because NULL is used as a key to say the queue is used as + a mutex. Therefore just set pcHead to point to the queue as a benign + value that is known to be within the memory map. */ + pxNewQueue->pcHead = (int8_t *)pxNewQueue; + } else { + /* Set the head to the start of the queue storage area. */ + pxNewQueue->pcHead = (int8_t *)pucQueueStorage; + } - /* Initialise the queue members as described where the queue type is - defined. */ - pxNewQueue->uxLength = uxQueueLength; - pxNewQueue->uxItemSize = uxItemSize; - ( void ) xQueueGenericReset( pxNewQueue, pdTRUE ); + /* Initialise the queue members as described where the queue type is + defined. */ + pxNewQueue->uxLength = uxQueueLength; + pxNewQueue->uxItemSize = uxItemSize; + (void)xQueueGenericReset(pxNewQueue, pdTRUE); - #if ( configUSE_TRACE_FACILITY == 1 ) - { - pxNewQueue->ucQueueType = ucQueueType; - } - #endif /* configUSE_TRACE_FACILITY */ +#if (configUSE_TRACE_FACILITY == 1) + { pxNewQueue->ucQueueType = ucQueueType; } +#endif /* configUSE_TRACE_FACILITY */ - #if( configUSE_QUEUE_SETS == 1 ) - { - pxNewQueue->pxQueueSetContainer = NULL; - } - #endif /* configUSE_QUEUE_SETS */ +#if (configUSE_QUEUE_SETS == 1) + { pxNewQueue->pxQueueSetContainer = NULL; } +#endif /* configUSE_QUEUE_SETS */ - traceQUEUE_CREATE( pxNewQueue ); + traceQUEUE_CREATE(pxNewQueue); } /*-----------------------------------------------------------*/ -#if( configUSE_MUTEXES == 1 ) +#if (configUSE_MUTEXES == 1) - static void prvInitialiseMutex( Queue_t *pxNewQueue ) - { - if( pxNewQueue != NULL ) - { - /* The queue create function will set all the queue structure members - correctly for a generic queue, but this function is creating a - mutex. Overwrite those members that need to be set differently - - in particular the information required for priority inheritance. */ - pxNewQueue->u.xSemaphore.xMutexHolder = NULL; - pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX; +static void prvInitialiseMutex(Queue_t *pxNewQueue) { + if (pxNewQueue != NULL) { + /* The queue create function will set all the queue structure members + correctly for a generic queue, but this function is creating a + mutex. Overwrite those members that need to be set differently - + in particular the information required for priority inheritance. */ + pxNewQueue->u.xSemaphore.xMutexHolder = NULL; + pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX; - /* In case this is a recursive mutex. */ - pxNewQueue->u.xSemaphore.uxRecursiveCallCount = 0; + /* In case this is a recursive mutex. */ + pxNewQueue->u.xSemaphore.uxRecursiveCallCount = 0; - traceCREATE_MUTEX( pxNewQueue ); + traceCREATE_MUTEX(pxNewQueue); - /* Start with the semaphore in the expected state. */ - ( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK ); - } - else - { - traceCREATE_MUTEX_FAILED(); - } - } + /* Start with the semaphore in the expected state. */ + (void)xQueueGenericSend(pxNewQueue, NULL, (TickType_t)0U, queueSEND_TO_BACK); + } else { + traceCREATE_MUTEX_FAILED(); + } +} #endif /* configUSE_MUTEXES */ /*-----------------------------------------------------------*/ -#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) +#if ((configUSE_MUTEXES == 1) && (configSUPPORT_DYNAMIC_ALLOCATION == 1)) - QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) - { - QueueHandle_t xNewQueue; - const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0; +QueueHandle_t xQueueCreateMutex(const uint8_t ucQueueType) { + QueueHandle_t xNewQueue; + const UBaseType_t uxMutexLength = (UBaseType_t)1, uxMutexSize = (UBaseType_t)0; - xNewQueue = xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType ); - prvInitialiseMutex( ( Queue_t * ) xNewQueue ); + xNewQueue = xQueueGenericCreate(uxMutexLength, uxMutexSize, ucQueueType); + prvInitialiseMutex((Queue_t *)xNewQueue); - return xNewQueue; - } + return xNewQueue; +} #endif /* configUSE_MUTEXES */ /*-----------------------------------------------------------*/ -#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) +#if ((configUSE_MUTEXES == 1) && (configSUPPORT_STATIC_ALLOCATION == 1)) - QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue ) - { - QueueHandle_t xNewQueue; - const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0; +QueueHandle_t xQueueCreateMutexStatic(const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue) { + QueueHandle_t xNewQueue; + const UBaseType_t uxMutexLength = (UBaseType_t)1, uxMutexSize = (UBaseType_t)0; - /* Prevent compiler warnings about unused parameters if - configUSE_TRACE_FACILITY does not equal 1. */ - ( void ) ucQueueType; + /* Prevent compiler warnings about unused parameters if + configUSE_TRACE_FACILITY does not equal 1. */ + (void)ucQueueType; - xNewQueue = xQueueGenericCreateStatic( uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType ); - prvInitialiseMutex( ( Queue_t * ) xNewQueue ); + xNewQueue = xQueueGenericCreateStatic(uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType); + prvInitialiseMutex((Queue_t *)xNewQueue); - return xNewQueue; - } + return xNewQueue; +} #endif /* configUSE_MUTEXES */ /*-----------------------------------------------------------*/ -#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) +#if ((configUSE_MUTEXES == 1) && (INCLUDE_xSemaphoreGetMutexHolder == 1)) - TaskHandle_t xQueueGetMutexHolder( QueueHandle_t xSemaphore ) - { - TaskHandle_t pxReturn; - Queue_t * const pxSemaphore = ( Queue_t * ) xSemaphore; +TaskHandle_t xQueueGetMutexHolder(QueueHandle_t xSemaphore) { + TaskHandle_t pxReturn; + Queue_t *const pxSemaphore = (Queue_t *)xSemaphore; - /* This function is called by xSemaphoreGetMutexHolder(), and should not - be called directly. Note: This is a good way of determining if the - calling task is the mutex holder, but not a good way of determining the - identity of the mutex holder, as the holder may change between the - following critical section exiting and the function returning. */ - taskENTER_CRITICAL(); - { - if( pxSemaphore->uxQueueType == queueQUEUE_IS_MUTEX ) - { - pxReturn = pxSemaphore->u.xSemaphore.xMutexHolder; - } - else - { - pxReturn = NULL; - } - } - taskEXIT_CRITICAL(); + /* This function is called by xSemaphoreGetMutexHolder(), and should not + be called directly. Note: This is a good way of determining if the + calling task is the mutex holder, but not a good way of determining the + identity of the mutex holder, as the holder may change between the + following critical section exiting and the function returning. */ + taskENTER_CRITICAL(); + { + if (pxSemaphore->uxQueueType == queueQUEUE_IS_MUTEX) { + pxReturn = pxSemaphore->u.xSemaphore.xMutexHolder; + } else { + pxReturn = NULL; + } + } + taskEXIT_CRITICAL(); - return pxReturn; - } /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */ + return pxReturn; +} /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */ #endif /*-----------------------------------------------------------*/ -#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) +#if ((configUSE_MUTEXES == 1) && (INCLUDE_xSemaphoreGetMutexHolder == 1)) - TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) - { - TaskHandle_t pxReturn; +TaskHandle_t xQueueGetMutexHolderFromISR(QueueHandle_t xSemaphore) { + TaskHandle_t pxReturn; - configASSERT( xSemaphore ); + configASSERT(xSemaphore); - /* Mutexes cannot be used in interrupt service routines, so the mutex - holder should not change in an ISR, and therefore a critical section is - not required here. */ - if( ( ( Queue_t * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX ) - { - pxReturn = ( ( Queue_t * ) xSemaphore )->u.xSemaphore.xMutexHolder; - } - else - { - pxReturn = NULL; - } + /* Mutexes cannot be used in interrupt service routines, so the mutex + holder should not change in an ISR, and therefore a critical section is + not required here. */ + if (((Queue_t *)xSemaphore)->uxQueueType == queueQUEUE_IS_MUTEX) { + pxReturn = ((Queue_t *)xSemaphore)->u.xSemaphore.xMutexHolder; + } else { + pxReturn = NULL; + } - return pxReturn; - } /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */ + return pxReturn; +} /*lint !e818 xSemaphore cannot be a pointer to const because it is a typedef. */ #endif /*-----------------------------------------------------------*/ -#if ( configUSE_RECURSIVE_MUTEXES == 1 ) +#if (configUSE_RECURSIVE_MUTEXES == 1) - BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) - { - BaseType_t xReturn; - Queue_t * const pxMutex = ( Queue_t * ) xMutex; +BaseType_t xQueueGiveMutexRecursive(QueueHandle_t xMutex) { + BaseType_t xReturn; + Queue_t *const pxMutex = (Queue_t *)xMutex; - configASSERT( pxMutex ); + configASSERT(pxMutex); - /* If this is the task that holds the mutex then xMutexHolder will not - change outside of this task. If this task does not hold the mutex then - pxMutexHolder can never coincidentally equal the tasks handle, and as - this is the only condition we are interested in it does not matter if - pxMutexHolder is accessed simultaneously by another task. Therefore no - mutual exclusion is required to test the pxMutexHolder variable. */ - if( pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle() ) - { - traceGIVE_MUTEX_RECURSIVE( pxMutex ); + /* If this is the task that holds the mutex then xMutexHolder will not + change outside of this task. If this task does not hold the mutex then + pxMutexHolder can never coincidentally equal the tasks handle, and as + this is the only condition we are interested in it does not matter if + pxMutexHolder is accessed simultaneously by another task. Therefore no + mutual exclusion is required to test the pxMutexHolder variable. */ + if (pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle()) { + traceGIVE_MUTEX_RECURSIVE(pxMutex); - /* uxRecursiveCallCount cannot be zero if xMutexHolder is equal to - the task handle, therefore no underflow check is required. Also, - uxRecursiveCallCount is only modified by the mutex holder, and as - there can only be one, no mutual exclusion is required to modify the - uxRecursiveCallCount member. */ - ( pxMutex->u.xSemaphore.uxRecursiveCallCount )--; + /* uxRecursiveCallCount cannot be zero if xMutexHolder is equal to + the task handle, therefore no underflow check is required. Also, + uxRecursiveCallCount is only modified by the mutex holder, and as + there can only be one, no mutual exclusion is required to modify the + uxRecursiveCallCount member. */ + (pxMutex->u.xSemaphore.uxRecursiveCallCount)--; - /* Has the recursive call count unwound to 0? */ - if( pxMutex->u.xSemaphore.uxRecursiveCallCount == ( UBaseType_t ) 0 ) - { - /* Return the mutex. This will automatically unblock any other - task that might be waiting to access the mutex. */ - ( void ) xQueueGenericSend( pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK ); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + /* Has the recursive call count unwound to 0? */ + if (pxMutex->u.xSemaphore.uxRecursiveCallCount == (UBaseType_t)0) { + /* Return the mutex. This will automatically unblock any other + task that might be waiting to access the mutex. */ + (void)xQueueGenericSend(pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK); + } else { + mtCOVERAGE_TEST_MARKER(); + } - xReturn = pdPASS; - } - else - { - /* The mutex cannot be given because the calling task is not the - holder. */ - xReturn = pdFAIL; + xReturn = pdPASS; + } else { + /* The mutex cannot be given because the calling task is not the + holder. */ + xReturn = pdFAIL; - traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex ); - } + traceGIVE_MUTEX_RECURSIVE_FAILED(pxMutex); + } - return xReturn; - } + return xReturn; +} #endif /* configUSE_RECURSIVE_MUTEXES */ /*-----------------------------------------------------------*/ -#if ( configUSE_RECURSIVE_MUTEXES == 1 ) +#if (configUSE_RECURSIVE_MUTEXES == 1) - BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ) - { - BaseType_t xReturn; - Queue_t * const pxMutex = ( Queue_t * ) xMutex; +BaseType_t xQueueTakeMutexRecursive(QueueHandle_t xMutex, TickType_t xTicksToWait) { + BaseType_t xReturn; + Queue_t *const pxMutex = (Queue_t *)xMutex; - configASSERT( pxMutex ); + configASSERT(pxMutex); - /* Comments regarding mutual exclusion as per those within - xQueueGiveMutexRecursive(). */ + /* Comments regarding mutual exclusion as per those within + xQueueGiveMutexRecursive(). */ - traceTAKE_MUTEX_RECURSIVE( pxMutex ); + traceTAKE_MUTEX_RECURSIVE(pxMutex); - if( pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle() ) - { - ( pxMutex->u.xSemaphore.uxRecursiveCallCount )++; - xReturn = pdPASS; - } - else - { - xReturn = xQueueSemaphoreTake( pxMutex, xTicksToWait ); + if (pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle()) { + (pxMutex->u.xSemaphore.uxRecursiveCallCount)++; + xReturn = pdPASS; + } else { + xReturn = xQueueSemaphoreTake(pxMutex, xTicksToWait); - /* pdPASS will only be returned if the mutex was successfully - obtained. The calling task may have entered the Blocked state - before reaching here. */ - if( xReturn != pdFAIL ) - { - ( pxMutex->u.xSemaphore.uxRecursiveCallCount )++; - } - else - { - traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex ); - } - } + /* pdPASS will only be returned if the mutex was successfully + obtained. The calling task may have entered the Blocked state + before reaching here. */ + if (xReturn != pdFAIL) { + (pxMutex->u.xSemaphore.uxRecursiveCallCount)++; + } else { + traceTAKE_MUTEX_RECURSIVE_FAILED(pxMutex); + } + } - return xReturn; - } + return xReturn; +} #endif /* configUSE_RECURSIVE_MUTEXES */ /*-----------------------------------------------------------*/ -#if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) +#if ((configUSE_COUNTING_SEMAPHORES == 1) && (configSUPPORT_STATIC_ALLOCATION == 1)) - QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue ) - { - QueueHandle_t xHandle; +QueueHandle_t xQueueCreateCountingSemaphoreStatic(const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue) { + QueueHandle_t xHandle; - configASSERT( uxMaxCount != 0 ); - configASSERT( uxInitialCount <= uxMaxCount ); + configASSERT(uxMaxCount != 0); + configASSERT(uxInitialCount <= uxMaxCount); - xHandle = xQueueGenericCreateStatic( uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticQueue, queueQUEUE_TYPE_COUNTING_SEMAPHORE ); + xHandle = xQueueGenericCreateStatic(uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticQueue, queueQUEUE_TYPE_COUNTING_SEMAPHORE); - if( xHandle != NULL ) - { - ( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount; + if (xHandle != NULL) { + ((Queue_t *)xHandle)->uxMessagesWaiting = uxInitialCount; - traceCREATE_COUNTING_SEMAPHORE(); - } - else - { - traceCREATE_COUNTING_SEMAPHORE_FAILED(); - } + traceCREATE_COUNTING_SEMAPHORE(); + } else { + traceCREATE_COUNTING_SEMAPHORE_FAILED(); + } - return xHandle; - } + return xHandle; +} #endif /* ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */ /*-----------------------------------------------------------*/ -#if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) +#if ((configUSE_COUNTING_SEMAPHORES == 1) && (configSUPPORT_DYNAMIC_ALLOCATION == 1)) - QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) - { - QueueHandle_t xHandle; +QueueHandle_t xQueueCreateCountingSemaphore(const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount) { + QueueHandle_t xHandle; - configASSERT( uxMaxCount != 0 ); - configASSERT( uxInitialCount <= uxMaxCount ); + configASSERT(uxMaxCount != 0); + configASSERT(uxInitialCount <= uxMaxCount); - xHandle = xQueueGenericCreate( uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE ); + xHandle = xQueueGenericCreate(uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE); - if( xHandle != NULL ) - { - ( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount; + if (xHandle != NULL) { + ((Queue_t *)xHandle)->uxMessagesWaiting = uxInitialCount; - traceCREATE_COUNTING_SEMAPHORE(); - } - else - { - traceCREATE_COUNTING_SEMAPHORE_FAILED(); - } + traceCREATE_COUNTING_SEMAPHORE(); + } else { + traceCREATE_COUNTING_SEMAPHORE_FAILED(); + } - return xHandle; - } + return xHandle; +} #endif /* ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */ /*-----------------------------------------------------------*/ -BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition ) -{ -BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired; -TimeOut_t xTimeOut; -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueGenericSend(QueueHandle_t xQueue, const void *const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition) { + BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired; + TimeOut_t xTimeOut; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); - configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) ); - #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - { - configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); - } - #endif - - - /*lint -save -e904 This function relaxes the coding standard somewhat to - allow return statements within the function itself. This is done in the - interest of execution time efficiency. */ - for( ;; ) - { - taskENTER_CRITICAL(); - { - /* Is there room on the queue now? The running task must be the - highest priority task wanting to access the queue. If the head item - in the queue is to be overwritten then it does not matter if the - queue is full. */ - if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) ) - { - traceQUEUE_SEND( pxQueue ); - - #if ( configUSE_QUEUE_SETS == 1 ) - { - const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; - - xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); - - if( pxQueue->pxQueueSetContainer != NULL ) - { - if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) ) - { - /* Do not notify the queue set as an existing item - was overwritten in the queue so the number of items - in the queue has not changed. */ - mtCOVERAGE_TEST_MARKER(); - } - else if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) - { - /* The queue is a member of a queue set, and posting - to the queue set caused a higher priority task to - unblock. A context switch is required. */ - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* If there was a task waiting for data to arrive on the - queue then unblock it now. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The unblocked task has a priority higher than - our own so yield immediately. Yes it is ok to - do this from within the critical section - the - kernel takes care of that. */ - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else if( xYieldRequired != pdFALSE ) - { - /* This path is a special case that will only get - executed if the task was holding multiple mutexes - and the mutexes were given back in an order that is - different to that in which they were taken. */ - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } - #else /* configUSE_QUEUE_SETS */ - { - xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); - - /* If there was a task waiting for data to arrive on the - queue then unblock it now. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The unblocked task has a priority higher than - our own so yield immediately. Yes it is ok to do - this from within the critical section - the kernel - takes care of that. */ - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else if( xYieldRequired != pdFALSE ) - { - /* This path is a special case that will only get - executed if the task was holding multiple mutexes and - the mutexes were given back in an order that is - different to that in which they were taken. */ - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #endif /* configUSE_QUEUE_SETS */ - - taskEXIT_CRITICAL(); - return pdPASS; - } - else - { - if( xTicksToWait == ( TickType_t ) 0 ) - { - /* The queue was full and no block time is specified (or - the block time has expired) so leave now. */ - taskEXIT_CRITICAL(); - - /* Return to the original privilege level before exiting - the function. */ - traceQUEUE_SEND_FAILED( pxQueue ); - return errQUEUE_FULL; - } - else if( xEntryTimeSet == pdFALSE ) - { - /* The queue was full and a block time was specified so - configure the timeout structure. */ - vTaskInternalSetTimeOutState( &xTimeOut ); - xEntryTimeSet = pdTRUE; - } - else - { - /* Entry time was already set. */ - mtCOVERAGE_TEST_MARKER(); - } - } - } - taskEXIT_CRITICAL(); - - /* Interrupts and other tasks can send to and receive from the queue - now the critical section has been exited. */ - - vTaskSuspendAll(); - prvLockQueue( pxQueue ); - - /* Update the timeout state to see if it has expired yet. */ - if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) - { - if( prvIsQueueFull( pxQueue ) != pdFALSE ) - { - traceBLOCKING_ON_QUEUE_SEND( pxQueue ); - vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait ); - - /* Unlocking the queue means queue events can effect the - event list. It is possible that interrupts occurring now - remove this task from the event list again - but as the - scheduler is suspended the task will go onto the pending - ready last instead of the actual ready list. */ - prvUnlockQueue( pxQueue ); - - /* Resuming the scheduler will move tasks from the pending - ready list into the ready list - so it is feasible that this - task is already in a ready list before it yields - in which - case the yield will not cause a context switch unless there - is also a higher priority task in the pending ready list. */ - if( xTaskResumeAll() == pdFALSE ) - { - portYIELD_WITHIN_API(); - } - } - else - { - /* Try again. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - } - } - else - { - /* The timeout has expired. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - - traceQUEUE_SEND_FAILED( pxQueue ); - return errQUEUE_FULL; - } - } /*lint -restore */ -} -/*-----------------------------------------------------------*/ - -BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition ) -{ -BaseType_t xReturn; -UBaseType_t uxSavedInterruptStatus; -Queue_t * const pxQueue = xQueue; - - configASSERT( pxQueue ); - configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); - configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) ); - - /* RTOS ports that support interrupt nesting have the concept of a maximum - system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are kept permanently enabled, even - when the RTOS kernel is in a critical section, but cannot make any calls to - FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h - then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion - failure if a FreeRTOS API function is called from an interrupt that has been - assigned a priority above the configured maximum system call priority. - Only FreeRTOS functions that end in FromISR can be called from interrupts - that have been assigned a priority at or (logically) below the maximum - system call interrupt priority. FreeRTOS maintains a separate interrupt - safe API to ensure interrupt entry is as fast and as simple as possible. - More information (albeit Cortex-M specific) is provided on the following - link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ - portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); - - /* Similar to xQueueGenericSend, except without blocking if there is no room - in the queue. Also don't directly wake a task that was blocked on a queue - read, instead return a flag to say whether a context switch is required or - not (i.e. has a task with a higher priority than us been woken by this - post). */ - uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - { - if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) ) - { - const int8_t cTxLock = pxQueue->cTxLock; - const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; - - traceQUEUE_SEND_FROM_ISR( pxQueue ); - - /* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a - semaphore or mutex. That means prvCopyDataToQueue() cannot result - in a task disinheriting a priority and prvCopyDataToQueue() can be - called here even though the disinherit function does not check if - the scheduler is suspended before accessing the ready lists. */ - ( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition ); - - /* The event list is not altered if the queue is locked. This will - be done when the queue is unlocked later. */ - if( cTxLock == queueUNLOCKED ) - { - #if ( configUSE_QUEUE_SETS == 1 ) - { - if( pxQueue->pxQueueSetContainer != NULL ) - { - if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) ) - { - /* Do not notify the queue set as an existing item - was overwritten in the queue so the number of items - in the queue has not changed. */ - mtCOVERAGE_TEST_MARKER(); - } - else if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) - { - /* The queue is a member of a queue set, and posting - to the queue set caused a higher priority task to - unblock. A context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so - record that a context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } - #else /* configUSE_QUEUE_SETS */ - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so record that a - context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - /* Not used in this path. */ - ( void ) uxPreviousMessagesWaiting; - } - #endif /* configUSE_QUEUE_SETS */ - } - else - { - /* Increment the lock count so the task that unlocks the queue - knows that data was posted while it was locked. */ - pxQueue->cTxLock = ( int8_t ) ( cTxLock + 1 ); - } - - xReturn = pdPASS; - } - else - { - traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ); - xReturn = errQUEUE_FULL; - } - } - portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); - - return xReturn; -} -/*-----------------------------------------------------------*/ - -BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, BaseType_t * const pxHigherPriorityTaskWoken ) -{ -BaseType_t xReturn; -UBaseType_t uxSavedInterruptStatus; -Queue_t * const pxQueue = xQueue; - - /* Similar to xQueueGenericSendFromISR() but used with semaphores where the - item size is 0. Don't directly wake a task that was blocked on a queue - read, instead return a flag to say whether a context switch is required or - not (i.e. has a task with a higher priority than us been woken by this - post). */ - - configASSERT( pxQueue ); - - /* xQueueGenericSendFromISR() should be used instead of xQueueGiveFromISR() - if the item size is not 0. */ - configASSERT( pxQueue->uxItemSize == 0 ); - - /* Normally a mutex would not be given from an interrupt, especially if - there is a mutex holder, as priority inheritance makes no sense for an - interrupts, only tasks. */ - configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->u.xSemaphore.xMutexHolder != NULL ) ) ); - - /* RTOS ports that support interrupt nesting have the concept of a maximum - system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are kept permanently enabled, even - when the RTOS kernel is in a critical section, but cannot make any calls to - FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h - then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion - failure if a FreeRTOS API function is called from an interrupt that has been - assigned a priority above the configured maximum system call priority. - Only FreeRTOS functions that end in FromISR can be called from interrupts - that have been assigned a priority at or (logically) below the maximum - system call interrupt priority. FreeRTOS maintains a separate interrupt - safe API to ensure interrupt entry is as fast and as simple as possible. - More information (albeit Cortex-M specific) is provided on the following - link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ - portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); - - uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - { - const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; - - /* When the queue is used to implement a semaphore no data is ever - moved through the queue but it is still valid to see if the queue 'has - space'. */ - if( uxMessagesWaiting < pxQueue->uxLength ) - { - const int8_t cTxLock = pxQueue->cTxLock; - - traceQUEUE_SEND_FROM_ISR( pxQueue ); - - /* A task can only have an inherited priority if it is a mutex - holder - and if there is a mutex holder then the mutex cannot be - given from an ISR. As this is the ISR version of the function it - can be assumed there is no mutex holder and no need to determine if - priority disinheritance is needed. Simply increase the count of - messages (semaphores) available. */ - pxQueue->uxMessagesWaiting = uxMessagesWaiting + ( UBaseType_t ) 1; - - /* The event list is not altered if the queue is locked. This will - be done when the queue is unlocked later. */ - if( cTxLock == queueUNLOCKED ) - { - #if ( configUSE_QUEUE_SETS == 1 ) - { - if( pxQueue->pxQueueSetContainer != NULL ) - { - if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) - { - /* The semaphore is a member of a queue set, and - posting to the queue set caused a higher priority - task to unblock. A context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so - record that a context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } - #else /* configUSE_QUEUE_SETS */ - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so record that a - context switch is required. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #endif /* configUSE_QUEUE_SETS */ - } - else - { - /* Increment the lock count so the task that unlocks the queue - knows that data was posted while it was locked. */ - pxQueue->cTxLock = ( int8_t ) ( cTxLock + 1 ); - } - - xReturn = pdPASS; - } - else - { - traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ); - xReturn = errQUEUE_FULL; - } - } - portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); - - return xReturn; -} -/*-----------------------------------------------------------*/ - -BaseType_t xQueueReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait ) -{ -BaseType_t xEntryTimeSet = pdFALSE; -TimeOut_t xTimeOut; -Queue_t * const pxQueue = xQueue; - - /* Check the pointer is not NULL. */ - configASSERT( ( pxQueue ) ); - - /* The buffer into which data is received can only be NULL if the data size - is zero (so no data is copied into the buffer. */ - configASSERT( !( ( ( pvBuffer ) == NULL ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) ); - - /* Cannot block if the scheduler is suspended. */ - #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - { - configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); - } - #endif - - - /*lint -save -e904 This function relaxes the coding standard somewhat to - allow return statements within the function itself. This is done in the - interest of execution time efficiency. */ - for( ;; ) - { - taskENTER_CRITICAL(); - { - const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; - - /* Is there data in the queue now? To be running the calling task - must be the highest priority task wanting to access the queue. */ - if( uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - /* Data available, remove one item. */ - prvCopyDataFromQueue( pxQueue, pvBuffer ); - traceQUEUE_RECEIVE( pxQueue ); - pxQueue->uxMessagesWaiting = uxMessagesWaiting - ( UBaseType_t ) 1; - - /* There is now space in the queue, were any tasks waiting to - post to the queue? If so, unblock the highest priority waiting - task. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - taskEXIT_CRITICAL(); - return pdPASS; - } - else - { - if( xTicksToWait == ( TickType_t ) 0 ) - { - /* The queue was empty and no block time is specified (or - the block time has expired) so leave now. */ - taskEXIT_CRITICAL(); - traceQUEUE_RECEIVE_FAILED( pxQueue ); - return errQUEUE_EMPTY; - } - else if( xEntryTimeSet == pdFALSE ) - { - /* The queue was empty and a block time was specified so - configure the timeout structure. */ - vTaskInternalSetTimeOutState( &xTimeOut ); - xEntryTimeSet = pdTRUE; - } - else - { - /* Entry time was already set. */ - mtCOVERAGE_TEST_MARKER(); - } - } - } - taskEXIT_CRITICAL(); - - /* Interrupts and other tasks can send to and receive from the queue - now the critical section has been exited. */ - - vTaskSuspendAll(); - prvLockQueue( pxQueue ); - - /* Update the timeout state to see if it has expired yet. */ - if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) - { - /* The timeout has not expired. If the queue is still empty place - the task on the list of tasks waiting to receive from the queue. */ - if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) - { - traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ); - vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); - prvUnlockQueue( pxQueue ); - if( xTaskResumeAll() == pdFALSE ) - { - portYIELD_WITHIN_API(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* The queue contains data again. Loop back to try and read the - data. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - } - } - else - { - /* Timed out. If there is no data in the queue exit, otherwise loop - back and attempt to read the data. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - - if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) - { - traceQUEUE_RECEIVE_FAILED( pxQueue ); - return errQUEUE_EMPTY; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } /*lint -restore */ -} -/*-----------------------------------------------------------*/ - -BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue, TickType_t xTicksToWait ) -{ -BaseType_t xEntryTimeSet = pdFALSE; -TimeOut_t xTimeOut; -Queue_t * const pxQueue = xQueue; - -#if( configUSE_MUTEXES == 1 ) - BaseType_t xInheritanceOccurred = pdFALSE; + configASSERT(pxQueue); + configASSERT(!((pvItemToQueue == NULL) && (pxQueue->uxItemSize != (UBaseType_t)0U))); + configASSERT(!((xCopyPosition == queueOVERWRITE) && (pxQueue->uxLength != 1))); +#if ((INCLUDE_xTaskGetSchedulerState == 1) || (configUSE_TIMERS == 1)) + { configASSERT(!((xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) && (xTicksToWait != 0))); } #endif - /* Check the queue pointer is not NULL. */ - configASSERT( ( pxQueue ) ); + /*lint -save -e904 This function relaxes the coding standard somewhat to + allow return statements within the function itself. This is done in the + interest of execution time efficiency. */ + for (;;) { + taskENTER_CRITICAL(); + { + /* Is there room on the queue now? The running task must be the + highest priority task wanting to access the queue. If the head item + in the queue is to be overwritten then it does not matter if the + queue is full. */ + if ((pxQueue->uxMessagesWaiting < pxQueue->uxLength) || (xCopyPosition == queueOVERWRITE)) { + traceQUEUE_SEND(pxQueue); - /* Check this really is a semaphore, in which case the item size will be - 0. */ - configASSERT( pxQueue->uxItemSize == 0 ); +#if (configUSE_QUEUE_SETS == 1) + { + const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; - /* Cannot block if the scheduler is suspended. */ - #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - { - configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); - } - #endif + xYieldRequired = prvCopyDataToQueue(pxQueue, pvItemToQueue, xCopyPosition); + if (pxQueue->pxQueueSetContainer != NULL) { + if ((xCopyPosition == queueOVERWRITE) && (uxPreviousMessagesWaiting != (UBaseType_t)0)) { + /* Do not notify the queue set as an existing item + was overwritten in the queue so the number of items + in the queue has not changed. */ + mtCOVERAGE_TEST_MARKER(); + } else if (prvNotifyQueueSetContainer(pxQueue) != pdFALSE) { + /* The queue is a member of a queue set, and posting + to the queue set caused a higher priority task to + unblock. A context switch is required. */ + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* If there was a task waiting for data to arrive on the + queue then unblock it now. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The unblocked task has a priority higher than + our own so yield immediately. Yes it is ok to + do this from within the critical section - the + kernel takes care of that. */ + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else if (xYieldRequired != pdFALSE) { + /* This path is a special case that will only get + executed if the task was holding multiple mutexes + and the mutexes were given back in an order that is + different to that in which they were taken. */ + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + } +#else /* configUSE_QUEUE_SETS */ + { + xYieldRequired = prvCopyDataToQueue(pxQueue, pvItemToQueue, xCopyPosition); - /*lint -save -e904 This function relaxes the coding standard somewhat to allow return - statements within the function itself. This is done in the interest - of execution time efficiency. */ - for( ;; ) - { - taskENTER_CRITICAL(); - { - /* Semaphores are queues with an item size of 0, and where the - number of messages in the queue is the semaphore's count value. */ - const UBaseType_t uxSemaphoreCount = pxQueue->uxMessagesWaiting; + /* If there was a task waiting for data to arrive on the + queue then unblock it now. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The unblocked task has a priority higher than + our own so yield immediately. Yes it is ok to do + this from within the critical section - the kernel + takes care of that. */ + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else if (xYieldRequired != pdFALSE) { + /* This path is a special case that will only get + executed if the task was holding multiple mutexes and + the mutexes were given back in an order that is + different to that in which they were taken. */ + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +#endif /* configUSE_QUEUE_SETS */ - /* Is there data in the queue now? To be running the calling task - must be the highest priority task wanting to access the queue. */ - if( uxSemaphoreCount > ( UBaseType_t ) 0 ) - { - traceQUEUE_RECEIVE( pxQueue ); + taskEXIT_CRITICAL(); + return pdPASS; + } else { + if (xTicksToWait == (TickType_t)0) { + /* The queue was full and no block time is specified (or + the block time has expired) so leave now. */ + taskEXIT_CRITICAL(); - /* Semaphores are queues with a data size of zero and where the - messages waiting is the semaphore's count. Reduce the count. */ - pxQueue->uxMessagesWaiting = uxSemaphoreCount - ( UBaseType_t ) 1; + /* Return to the original privilege level before exiting + the function. */ + traceQUEUE_SEND_FAILED(pxQueue); + return errQUEUE_FULL; + } else if (xEntryTimeSet == pdFALSE) { + /* The queue was full and a block time was specified so + configure the timeout structure. */ + vTaskInternalSetTimeOutState(&xTimeOut); + xEntryTimeSet = pdTRUE; + } else { + /* Entry time was already set. */ + mtCOVERAGE_TEST_MARKER(); + } + } + } + taskEXIT_CRITICAL(); - #if ( configUSE_MUTEXES == 1 ) - { - if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) - { - /* Record the information required to implement - priority inheritance should it become necessary. */ - pxQueue->u.xSemaphore.xMutexHolder = pvTaskIncrementMutexHeldCount(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #endif /* configUSE_MUTEXES */ + /* Interrupts and other tasks can send to and receive from the queue + now the critical section has been exited. */ - /* Check to see if other tasks are blocked waiting to give the - semaphore, and if so, unblock the highest priority such task. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + vTaskSuspendAll(); + prvLockQueue(pxQueue); - taskEXIT_CRITICAL(); - return pdPASS; - } - else - { - if( xTicksToWait == ( TickType_t ) 0 ) - { - /* For inheritance to have occurred there must have been an - initial timeout, and an adjusted timeout cannot become 0, as - if it were 0 the function would have exited. */ - #if( configUSE_MUTEXES == 1 ) - { - configASSERT( xInheritanceOccurred == pdFALSE ); - } - #endif /* configUSE_MUTEXES */ + /* Update the timeout state to see if it has expired yet. */ + if (xTaskCheckForTimeOut(&xTimeOut, &xTicksToWait) == pdFALSE) { + if (prvIsQueueFull(pxQueue) != pdFALSE) { + traceBLOCKING_ON_QUEUE_SEND(pxQueue); + vTaskPlaceOnEventList(&(pxQueue->xTasksWaitingToSend), xTicksToWait); - /* The semaphore count was 0 and no block time is specified - (or the block time has expired) so exit now. */ - taskEXIT_CRITICAL(); - traceQUEUE_RECEIVE_FAILED( pxQueue ); - return errQUEUE_EMPTY; - } - else if( xEntryTimeSet == pdFALSE ) - { - /* The semaphore count was 0 and a block time was specified - so configure the timeout structure ready to block. */ - vTaskInternalSetTimeOutState( &xTimeOut ); - xEntryTimeSet = pdTRUE; - } - else - { - /* Entry time was already set. */ - mtCOVERAGE_TEST_MARKER(); - } - } - } - taskEXIT_CRITICAL(); + /* Unlocking the queue means queue events can effect the + event list. It is possible that interrupts occurring now + remove this task from the event list again - but as the + scheduler is suspended the task will go onto the pending + ready last instead of the actual ready list. */ + prvUnlockQueue(pxQueue); - /* Interrupts and other tasks can give to and take from the semaphore - now the critical section has been exited. */ + /* Resuming the scheduler will move tasks from the pending + ready list into the ready list - so it is feasible that this + task is already in a ready list before it yields - in which + case the yield will not cause a context switch unless there + is also a higher priority task in the pending ready list. */ + if (xTaskResumeAll() == pdFALSE) { + portYIELD_WITHIN_API(); + } + } else { + /* Try again. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + } + } else { + /* The timeout has expired. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); - vTaskSuspendAll(); - prvLockQueue( pxQueue ); - - /* Update the timeout state to see if it has expired yet. */ - if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) - { - /* A block time is specified and not expired. If the semaphore - count is 0 then enter the Blocked state to wait for a semaphore to - become available. As semaphores are implemented with queues the - queue being empty is equivalent to the semaphore count being 0. */ - if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) - { - traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ); - - #if ( configUSE_MUTEXES == 1 ) - { - if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) - { - taskENTER_CRITICAL(); - { - xInheritanceOccurred = xTaskPriorityInherit( pxQueue->u.xSemaphore.xMutexHolder ); - } - taskEXIT_CRITICAL(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #endif - - vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); - prvUnlockQueue( pxQueue ); - if( xTaskResumeAll() == pdFALSE ) - { - portYIELD_WITHIN_API(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* There was no timeout and the semaphore count was not 0, so - attempt to take the semaphore again. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - } - } - else - { - /* Timed out. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - - /* If the semaphore count is 0 exit now as the timeout has - expired. Otherwise return to attempt to take the semaphore that is - known to be available. As semaphores are implemented by queues the - queue being empty is equivalent to the semaphore count being 0. */ - if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) - { - #if ( configUSE_MUTEXES == 1 ) - { - /* xInheritanceOccurred could only have be set if - pxQueue->uxQueueType == queueQUEUE_IS_MUTEX so no need to - test the mutex type again to check it is actually a mutex. */ - if( xInheritanceOccurred != pdFALSE ) - { - taskENTER_CRITICAL(); - { - UBaseType_t uxHighestWaitingPriority; - - /* This task blocking on the mutex caused another - task to inherit this task's priority. Now this task - has timed out the priority should be disinherited - again, but only as low as the next highest priority - task that is waiting for the same mutex. */ - uxHighestWaitingPriority = prvGetDisinheritPriorityAfterTimeout( pxQueue ); - vTaskPriorityDisinheritAfterTimeout( pxQueue->u.xSemaphore.xMutexHolder, uxHighestWaitingPriority ); - } - taskEXIT_CRITICAL(); - } - } - #endif /* configUSE_MUTEXES */ - - traceQUEUE_RECEIVE_FAILED( pxQueue ); - return errQUEUE_EMPTY; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } /*lint -restore */ + traceQUEUE_SEND_FAILED(pxQueue); + return errQUEUE_FULL; + } + } /*lint -restore */ } /*-----------------------------------------------------------*/ -BaseType_t xQueuePeek( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait ) -{ -BaseType_t xEntryTimeSet = pdFALSE; -TimeOut_t xTimeOut; -int8_t *pcOriginalReadPosition; -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueGenericSendFromISR(QueueHandle_t xQueue, const void *const pvItemToQueue, BaseType_t *const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition) { + BaseType_t xReturn; + UBaseType_t uxSavedInterruptStatus; + Queue_t *const pxQueue = xQueue; - /* Check the pointer is not NULL. */ - configASSERT( ( pxQueue ) ); + configASSERT(pxQueue); + configASSERT(!((pvItemToQueue == NULL) && (pxQueue->uxItemSize != (UBaseType_t)0U))); + configASSERT(!((xCopyPosition == queueOVERWRITE) && (pxQueue->uxLength != 1))); - /* The buffer into which data is received can only be NULL if the data size - is zero (so no data is copied into the buffer. */ - configASSERT( !( ( ( pvBuffer ) == NULL ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) ); + /* RTOS ports that support interrupt nesting have the concept of a maximum + system call (or maximum API call) interrupt priority. Interrupts that are + above the maximum system call priority are kept permanently enabled, even + when the RTOS kernel is in a critical section, but cannot make any calls to + FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h + then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion + failure if a FreeRTOS API function is called from an interrupt that has been + assigned a priority above the configured maximum system call priority. + Only FreeRTOS functions that end in FromISR can be called from interrupts + that have been assigned a priority at or (logically) below the maximum + system call interrupt priority. FreeRTOS maintains a separate interrupt + safe API to ensure interrupt entry is as fast and as simple as possible. + More information (albeit Cortex-M specific) is provided on the following + link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ + portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); - /* Cannot block if the scheduler is suspended. */ - #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) - { - configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) ); - } - #endif + /* Similar to xQueueGenericSend, except without blocking if there is no room + in the queue. Also don't directly wake a task that was blocked on a queue + read, instead return a flag to say whether a context switch is required or + not (i.e. has a task with a higher priority than us been woken by this + post). */ + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); + { + if ((pxQueue->uxMessagesWaiting < pxQueue->uxLength) || (xCopyPosition == queueOVERWRITE)) { + const int8_t cTxLock = pxQueue->cTxLock; + const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting; + traceQUEUE_SEND_FROM_ISR(pxQueue); - /*lint -save -e904 This function relaxes the coding standard somewhat to - allow return statements within the function itself. This is done in the - interest of execution time efficiency. */ - for( ;; ) - { - taskENTER_CRITICAL(); - { - const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; + /* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a + semaphore or mutex. That means prvCopyDataToQueue() cannot result + in a task disinheriting a priority and prvCopyDataToQueue() can be + called here even though the disinherit function does not check if + the scheduler is suspended before accessing the ready lists. */ + (void)prvCopyDataToQueue(pxQueue, pvItemToQueue, xCopyPosition); - /* Is there data in the queue now? To be running the calling task - must be the highest priority task wanting to access the queue. */ - if( uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - /* Remember the read position so it can be reset after the data - is read from the queue as this function is only peeking the - data, not removing it. */ - pcOriginalReadPosition = pxQueue->u.xQueue.pcReadFrom; + /* The event list is not altered if the queue is locked. This will + be done when the queue is unlocked later. */ + if (cTxLock == queueUNLOCKED) { +#if (configUSE_QUEUE_SETS == 1) + { + if (pxQueue->pxQueueSetContainer != NULL) { + if ((xCopyPosition == queueOVERWRITE) && (uxPreviousMessagesWaiting != (UBaseType_t)0)) { + /* Do not notify the queue set as an existing item + was overwritten in the queue so the number of items + in the queue has not changed. */ + mtCOVERAGE_TEST_MARKER(); + } else if (prvNotifyQueueSetContainer(pxQueue) != pdFALSE) { + /* The queue is a member of a queue set, and posting + to the queue set caused a higher priority task to + unblock. A context switch is required. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority so + record that a context switch is required. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + } +#else /* configUSE_QUEUE_SETS */ + { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority so record that a + context switch is required. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } - prvCopyDataFromQueue( pxQueue, pvBuffer ); - traceQUEUE_PEEK( pxQueue ); + /* Not used in this path. */ + (void)uxPreviousMessagesWaiting; + } +#endif /* configUSE_QUEUE_SETS */ + } else { + /* Increment the lock count so the task that unlocks the queue + knows that data was posted while it was locked. */ + pxQueue->cTxLock = (int8_t)(cTxLock + 1); + } - /* The data is not being removed, so reset the read pointer. */ - pxQueue->u.xQueue.pcReadFrom = pcOriginalReadPosition; + xReturn = pdPASS; + } else { + traceQUEUE_SEND_FROM_ISR_FAILED(pxQueue); + xReturn = errQUEUE_FULL; + } + } + portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedInterruptStatus); - /* The data is being left in the queue, so see if there are - any other tasks waiting for the data. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority than this task. */ - queueYIELD_IF_USING_PREEMPTION(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - - taskEXIT_CRITICAL(); - return pdPASS; - } - else - { - if( xTicksToWait == ( TickType_t ) 0 ) - { - /* The queue was empty and no block time is specified (or - the block time has expired) so leave now. */ - taskEXIT_CRITICAL(); - traceQUEUE_PEEK_FAILED( pxQueue ); - return errQUEUE_EMPTY; - } - else if( xEntryTimeSet == pdFALSE ) - { - /* The queue was empty and a block time was specified so - configure the timeout structure ready to enter the blocked - state. */ - vTaskInternalSetTimeOutState( &xTimeOut ); - xEntryTimeSet = pdTRUE; - } - else - { - /* Entry time was already set. */ - mtCOVERAGE_TEST_MARKER(); - } - } - } - taskEXIT_CRITICAL(); - - /* Interrupts and other tasks can send to and receive from the queue - now the critical section has been exited. */ - - vTaskSuspendAll(); - prvLockQueue( pxQueue ); - - /* Update the timeout state to see if it has expired yet. */ - if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE ) - { - /* Timeout has not expired yet, check to see if there is data in the - queue now, and if not enter the Blocked state to wait for data. */ - if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) - { - traceBLOCKING_ON_QUEUE_PEEK( pxQueue ); - vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait ); - prvUnlockQueue( pxQueue ); - if( xTaskResumeAll() == pdFALSE ) - { - portYIELD_WITHIN_API(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* There is data in the queue now, so don't enter the blocked - state, instead return to try and obtain the data. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - } - } - else - { - /* The timeout has expired. If there is still no data in the queue - exit, otherwise go back and try to read the data again. */ - prvUnlockQueue( pxQueue ); - ( void ) xTaskResumeAll(); - - if( prvIsQueueEmpty( pxQueue ) != pdFALSE ) - { - traceQUEUE_PEEK_FAILED( pxQueue ); - return errQUEUE_EMPTY; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } /*lint -restore */ + return xReturn; } /*-----------------------------------------------------------*/ -BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, BaseType_t * const pxHigherPriorityTaskWoken ) -{ -BaseType_t xReturn; -UBaseType_t uxSavedInterruptStatus; -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueGiveFromISR(QueueHandle_t xQueue, BaseType_t *const pxHigherPriorityTaskWoken) { + BaseType_t xReturn; + UBaseType_t uxSavedInterruptStatus; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); + /* Similar to xQueueGenericSendFromISR() but used with semaphores where the + item size is 0. Don't directly wake a task that was blocked on a queue + read, instead return a flag to say whether a context switch is required or + not (i.e. has a task with a higher priority than us been woken by this + post). */ - /* RTOS ports that support interrupt nesting have the concept of a maximum - system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are kept permanently enabled, even - when the RTOS kernel is in a critical section, but cannot make any calls to - FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h - then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion - failure if a FreeRTOS API function is called from an interrupt that has been - assigned a priority above the configured maximum system call priority. - Only FreeRTOS functions that end in FromISR can be called from interrupts - that have been assigned a priority at or (logically) below the maximum - system call interrupt priority. FreeRTOS maintains a separate interrupt - safe API to ensure interrupt entry is as fast and as simple as possible. - More information (albeit Cortex-M specific) is provided on the following - link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ - portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); + configASSERT(pxQueue); - uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - { - const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; + /* xQueueGenericSendFromISR() should be used instead of xQueueGiveFromISR() + if the item size is not 0. */ + configASSERT(pxQueue->uxItemSize == 0); - /* Cannot block in an ISR, so check there is data available. */ - if( uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - const int8_t cRxLock = pxQueue->cRxLock; + /* Normally a mutex would not be given from an interrupt, especially if + there is a mutex holder, as priority inheritance makes no sense for an + interrupts, only tasks. */ + configASSERT(!((pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) && (pxQueue->u.xSemaphore.xMutexHolder != NULL))); - traceQUEUE_RECEIVE_FROM_ISR( pxQueue ); + /* RTOS ports that support interrupt nesting have the concept of a maximum + system call (or maximum API call) interrupt priority. Interrupts that are + above the maximum system call priority are kept permanently enabled, even + when the RTOS kernel is in a critical section, but cannot make any calls to + FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h + then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion + failure if a FreeRTOS API function is called from an interrupt that has been + assigned a priority above the configured maximum system call priority. + Only FreeRTOS functions that end in FromISR can be called from interrupts + that have been assigned a priority at or (logically) below the maximum + system call interrupt priority. FreeRTOS maintains a separate interrupt + safe API to ensure interrupt entry is as fast and as simple as possible. + More information (albeit Cortex-M specific) is provided on the following + link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ + portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); - prvCopyDataFromQueue( pxQueue, pvBuffer ); - pxQueue->uxMessagesWaiting = uxMessagesWaiting - ( UBaseType_t ) 1; + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); + { + const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; - /* If the queue is locked the event list will not be modified. - Instead update the lock count so the task that unlocks the queue - will know that an ISR has removed data while the queue was - locked. */ - if( cRxLock == queueUNLOCKED ) - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - /* The task waiting has a higher priority than us so - force a context switch. */ - if( pxHigherPriorityTaskWoken != NULL ) - { - *pxHigherPriorityTaskWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* Increment the lock count so the task that unlocks the queue - knows that data was removed while it was locked. */ - pxQueue->cRxLock = ( int8_t ) ( cRxLock + 1 ); - } + /* When the queue is used to implement a semaphore no data is ever + moved through the queue but it is still valid to see if the queue 'has + space'. */ + if (uxMessagesWaiting < pxQueue->uxLength) { + const int8_t cTxLock = pxQueue->cTxLock; - xReturn = pdPASS; - } - else - { - xReturn = pdFAIL; - traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ); - } - } - portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); + traceQUEUE_SEND_FROM_ISR(pxQueue); - return xReturn; + /* A task can only have an inherited priority if it is a mutex + holder - and if there is a mutex holder then the mutex cannot be + given from an ISR. As this is the ISR version of the function it + can be assumed there is no mutex holder and no need to determine if + priority disinheritance is needed. Simply increase the count of + messages (semaphores) available. */ + pxQueue->uxMessagesWaiting = uxMessagesWaiting + (UBaseType_t)1; + + /* The event list is not altered if the queue is locked. This will + be done when the queue is unlocked later. */ + if (cTxLock == queueUNLOCKED) { +#if (configUSE_QUEUE_SETS == 1) + { + if (pxQueue->pxQueueSetContainer != NULL) { + if (prvNotifyQueueSetContainer(pxQueue) != pdFALSE) { + /* The semaphore is a member of a queue set, and + posting to the queue set caused a higher priority + task to unblock. A context switch is required. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority so + record that a context switch is required. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + } +#else /* configUSE_QUEUE_SETS */ + { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority so record that a + context switch is required. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +#endif /* configUSE_QUEUE_SETS */ + } else { + /* Increment the lock count so the task that unlocks the queue + knows that data was posted while it was locked. */ + pxQueue->cTxLock = (int8_t)(cTxLock + 1); + } + + xReturn = pdPASS; + } else { + traceQUEUE_SEND_FROM_ISR_FAILED(pxQueue); + xReturn = errQUEUE_FULL; + } + } + portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedInterruptStatus); + + return xReturn; } /*-----------------------------------------------------------*/ -BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ) -{ -BaseType_t xReturn; -UBaseType_t uxSavedInterruptStatus; -int8_t *pcOriginalReadPosition; -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueReceive(QueueHandle_t xQueue, void *const pvBuffer, TickType_t xTicksToWait) { + BaseType_t xEntryTimeSet = pdFALSE; + TimeOut_t xTimeOut; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); - configASSERT( pxQueue->uxItemSize != 0 ); /* Can't peek a semaphore. */ + /* Check the pointer is not NULL. */ + configASSERT((pxQueue)); - /* RTOS ports that support interrupt nesting have the concept of a maximum - system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are kept permanently enabled, even - when the RTOS kernel is in a critical section, but cannot make any calls to - FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h - then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion - failure if a FreeRTOS API function is called from an interrupt that has been - assigned a priority above the configured maximum system call priority. - Only FreeRTOS functions that end in FromISR can be called from interrupts - that have been assigned a priority at or (logically) below the maximum - system call interrupt priority. FreeRTOS maintains a separate interrupt - safe API to ensure interrupt entry is as fast and as simple as possible. - More information (albeit Cortex-M specific) is provided on the following - link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ - portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); + /* The buffer into which data is received can only be NULL if the data size + is zero (so no data is copied into the buffer. */ + configASSERT(!(((pvBuffer) == NULL) && ((pxQueue)->uxItemSize != (UBaseType_t)0U))); - uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); - { - /* Cannot block in an ISR, so check there is data available. */ - if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - traceQUEUE_PEEK_FROM_ISR( pxQueue ); +/* Cannot block if the scheduler is suspended. */ +#if ((INCLUDE_xTaskGetSchedulerState == 1) || (configUSE_TIMERS == 1)) + { configASSERT(!((xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) && (xTicksToWait != 0))); } +#endif - /* Remember the read position so it can be reset as nothing is - actually being removed from the queue. */ - pcOriginalReadPosition = pxQueue->u.xQueue.pcReadFrom; - prvCopyDataFromQueue( pxQueue, pvBuffer ); - pxQueue->u.xQueue.pcReadFrom = pcOriginalReadPosition; + /*lint -save -e904 This function relaxes the coding standard somewhat to + allow return statements within the function itself. This is done in the + interest of execution time efficiency. */ + for (;;) { + taskENTER_CRITICAL(); + { + const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; - xReturn = pdPASS; - } - else - { - xReturn = pdFAIL; - traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue ); - } - } - portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); + /* Is there data in the queue now? To be running the calling task + must be the highest priority task wanting to access the queue. */ + if (uxMessagesWaiting > (UBaseType_t)0) { + /* Data available, remove one item. */ + prvCopyDataFromQueue(pxQueue, pvBuffer); + traceQUEUE_RECEIVE(pxQueue); + pxQueue->uxMessagesWaiting = uxMessagesWaiting - (UBaseType_t)1; - return xReturn; + /* There is now space in the queue, were any tasks waiting to + post to the queue? If so, unblock the highest priority waiting + task. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + + taskEXIT_CRITICAL(); + return pdPASS; + } else { + if (xTicksToWait == (TickType_t)0) { + /* The queue was empty and no block time is specified (or + the block time has expired) so leave now. */ + taskEXIT_CRITICAL(); + traceQUEUE_RECEIVE_FAILED(pxQueue); + return errQUEUE_EMPTY; + } else if (xEntryTimeSet == pdFALSE) { + /* The queue was empty and a block time was specified so + configure the timeout structure. */ + vTaskInternalSetTimeOutState(&xTimeOut); + xEntryTimeSet = pdTRUE; + } else { + /* Entry time was already set. */ + mtCOVERAGE_TEST_MARKER(); + } + } + } + taskEXIT_CRITICAL(); + + /* Interrupts and other tasks can send to and receive from the queue + now the critical section has been exited. */ + + vTaskSuspendAll(); + prvLockQueue(pxQueue); + + /* Update the timeout state to see if it has expired yet. */ + if (xTaskCheckForTimeOut(&xTimeOut, &xTicksToWait) == pdFALSE) { + /* The timeout has not expired. If the queue is still empty place + the task on the list of tasks waiting to receive from the queue. */ + if (prvIsQueueEmpty(pxQueue) != pdFALSE) { + traceBLOCKING_ON_QUEUE_RECEIVE(pxQueue); + vTaskPlaceOnEventList(&(pxQueue->xTasksWaitingToReceive), xTicksToWait); + prvUnlockQueue(pxQueue); + if (xTaskResumeAll() == pdFALSE) { + portYIELD_WITHIN_API(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* The queue contains data again. Loop back to try and read the + data. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + } + } else { + /* Timed out. If there is no data in the queue exit, otherwise loop + back and attempt to read the data. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + + if (prvIsQueueEmpty(pxQueue) != pdFALSE) { + traceQUEUE_RECEIVE_FAILED(pxQueue); + return errQUEUE_EMPTY; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + } /*lint -restore */ } /*-----------------------------------------------------------*/ -UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue ) -{ -UBaseType_t uxReturn; +BaseType_t xQueueSemaphoreTake(QueueHandle_t xQueue, TickType_t xTicksToWait) { + BaseType_t xEntryTimeSet = pdFALSE; + TimeOut_t xTimeOut; + Queue_t *const pxQueue = xQueue; - configASSERT( xQueue ); +#if (configUSE_MUTEXES == 1) + BaseType_t xInheritanceOccurred = pdFALSE; +#endif - taskENTER_CRITICAL(); - { - uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting; - } - taskEXIT_CRITICAL(); + /* Check the queue pointer is not NULL. */ + configASSERT((pxQueue)); - return uxReturn; + /* Check this really is a semaphore, in which case the item size will be + 0. */ + configASSERT(pxQueue->uxItemSize == 0); + +/* Cannot block if the scheduler is suspended. */ +#if ((INCLUDE_xTaskGetSchedulerState == 1) || (configUSE_TIMERS == 1)) + { configASSERT(!((xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) && (xTicksToWait != 0))); } +#endif + + /*lint -save -e904 This function relaxes the coding standard somewhat to allow return + statements within the function itself. This is done in the interest + of execution time efficiency. */ + for (;;) { + taskENTER_CRITICAL(); + { + /* Semaphores are queues with an item size of 0, and where the + number of messages in the queue is the semaphore's count value. */ + const UBaseType_t uxSemaphoreCount = pxQueue->uxMessagesWaiting; + + /* Is there data in the queue now? To be running the calling task + must be the highest priority task wanting to access the queue. */ + if (uxSemaphoreCount > (UBaseType_t)0) { + traceQUEUE_RECEIVE(pxQueue); + + /* Semaphores are queues with a data size of zero and where the + messages waiting is the semaphore's count. Reduce the count. */ + pxQueue->uxMessagesWaiting = uxSemaphoreCount - (UBaseType_t)1; + +#if (configUSE_MUTEXES == 1) + { + if (pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) { + /* Record the information required to implement + priority inheritance should it become necessary. */ + pxQueue->u.xSemaphore.xMutexHolder = pvTaskIncrementMutexHeldCount(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +#endif /* configUSE_MUTEXES */ + + /* Check to see if other tasks are blocked waiting to give the + semaphore, and if so, unblock the highest priority such task. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + + taskEXIT_CRITICAL(); + return pdPASS; + } else { + if (xTicksToWait == (TickType_t)0) { +/* For inheritance to have occurred there must have been an +initial timeout, and an adjusted timeout cannot become 0, as +if it were 0 the function would have exited. */ +#if (configUSE_MUTEXES == 1) + { configASSERT(xInheritanceOccurred == pdFALSE); } +#endif /* configUSE_MUTEXES */ + + /* The semaphore count was 0 and no block time is specified + (or the block time has expired) so exit now. */ + taskEXIT_CRITICAL(); + traceQUEUE_RECEIVE_FAILED(pxQueue); + return errQUEUE_EMPTY; + } else if (xEntryTimeSet == pdFALSE) { + /* The semaphore count was 0 and a block time was specified + so configure the timeout structure ready to block. */ + vTaskInternalSetTimeOutState(&xTimeOut); + xEntryTimeSet = pdTRUE; + } else { + /* Entry time was already set. */ + mtCOVERAGE_TEST_MARKER(); + } + } + } + taskEXIT_CRITICAL(); + + /* Interrupts and other tasks can give to and take from the semaphore + now the critical section has been exited. */ + + vTaskSuspendAll(); + prvLockQueue(pxQueue); + + /* Update the timeout state to see if it has expired yet. */ + if (xTaskCheckForTimeOut(&xTimeOut, &xTicksToWait) == pdFALSE) { + /* A block time is specified and not expired. If the semaphore + count is 0 then enter the Blocked state to wait for a semaphore to + become available. As semaphores are implemented with queues the + queue being empty is equivalent to the semaphore count being 0. */ + if (prvIsQueueEmpty(pxQueue) != pdFALSE) { + traceBLOCKING_ON_QUEUE_RECEIVE(pxQueue); + +#if (configUSE_MUTEXES == 1) + { + if (pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) { + taskENTER_CRITICAL(); + { xInheritanceOccurred = xTaskPriorityInherit(pxQueue->u.xSemaphore.xMutexHolder); } + taskEXIT_CRITICAL(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +#endif + + vTaskPlaceOnEventList(&(pxQueue->xTasksWaitingToReceive), xTicksToWait); + prvUnlockQueue(pxQueue); + if (xTaskResumeAll() == pdFALSE) { + portYIELD_WITHIN_API(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* There was no timeout and the semaphore count was not 0, so + attempt to take the semaphore again. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + } + } else { + /* Timed out. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + + /* If the semaphore count is 0 exit now as the timeout has + expired. Otherwise return to attempt to take the semaphore that is + known to be available. As semaphores are implemented by queues the + queue being empty is equivalent to the semaphore count being 0. */ + if (prvIsQueueEmpty(pxQueue) != pdFALSE) { +#if (configUSE_MUTEXES == 1) + { + /* xInheritanceOccurred could only have be set if + pxQueue->uxQueueType == queueQUEUE_IS_MUTEX so no need to + test the mutex type again to check it is actually a mutex. */ + if (xInheritanceOccurred != pdFALSE) { + taskENTER_CRITICAL(); + { + UBaseType_t uxHighestWaitingPriority; + + /* This task blocking on the mutex caused another + task to inherit this task's priority. Now this task + has timed out the priority should be disinherited + again, but only as low as the next highest priority + task that is waiting for the same mutex. */ + uxHighestWaitingPriority = prvGetDisinheritPriorityAfterTimeout(pxQueue); + vTaskPriorityDisinheritAfterTimeout(pxQueue->u.xSemaphore.xMutexHolder, uxHighestWaitingPriority); + } + taskEXIT_CRITICAL(); + } + } +#endif /* configUSE_MUTEXES */ + + traceQUEUE_RECEIVE_FAILED(pxQueue); + return errQUEUE_EMPTY; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + } /*lint -restore */ +} +/*-----------------------------------------------------------*/ + +BaseType_t xQueuePeek(QueueHandle_t xQueue, void *const pvBuffer, TickType_t xTicksToWait) { + BaseType_t xEntryTimeSet = pdFALSE; + TimeOut_t xTimeOut; + int8_t *pcOriginalReadPosition; + Queue_t *const pxQueue = xQueue; + + /* Check the pointer is not NULL. */ + configASSERT((pxQueue)); + + /* The buffer into which data is received can only be NULL if the data size + is zero (so no data is copied into the buffer. */ + configASSERT(!(((pvBuffer) == NULL) && ((pxQueue)->uxItemSize != (UBaseType_t)0U))); + +/* Cannot block if the scheduler is suspended. */ +#if ((INCLUDE_xTaskGetSchedulerState == 1) || (configUSE_TIMERS == 1)) + { configASSERT(!((xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) && (xTicksToWait != 0))); } +#endif + + /*lint -save -e904 This function relaxes the coding standard somewhat to + allow return statements within the function itself. This is done in the + interest of execution time efficiency. */ + for (;;) { + taskENTER_CRITICAL(); + { + const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; + + /* Is there data in the queue now? To be running the calling task + must be the highest priority task wanting to access the queue. */ + if (uxMessagesWaiting > (UBaseType_t)0) { + /* Remember the read position so it can be reset after the data + is read from the queue as this function is only peeking the + data, not removing it. */ + pcOriginalReadPosition = pxQueue->u.xQueue.pcReadFrom; + + prvCopyDataFromQueue(pxQueue, pvBuffer); + traceQUEUE_PEEK(pxQueue); + + /* The data is not being removed, so reset the read pointer. */ + pxQueue->u.xQueue.pcReadFrom = pcOriginalReadPosition; + + /* The data is being left in the queue, so see if there are + any other tasks waiting for the data. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority than this task. */ + queueYIELD_IF_USING_PREEMPTION(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + + taskEXIT_CRITICAL(); + return pdPASS; + } else { + if (xTicksToWait == (TickType_t)0) { + /* The queue was empty and no block time is specified (or + the block time has expired) so leave now. */ + taskEXIT_CRITICAL(); + traceQUEUE_PEEK_FAILED(pxQueue); + return errQUEUE_EMPTY; + } else if (xEntryTimeSet == pdFALSE) { + /* The queue was empty and a block time was specified so + configure the timeout structure ready to enter the blocked + state. */ + vTaskInternalSetTimeOutState(&xTimeOut); + xEntryTimeSet = pdTRUE; + } else { + /* Entry time was already set. */ + mtCOVERAGE_TEST_MARKER(); + } + } + } + taskEXIT_CRITICAL(); + + /* Interrupts and other tasks can send to and receive from the queue + now the critical section has been exited. */ + + vTaskSuspendAll(); + prvLockQueue(pxQueue); + + /* Update the timeout state to see if it has expired yet. */ + if (xTaskCheckForTimeOut(&xTimeOut, &xTicksToWait) == pdFALSE) { + /* Timeout has not expired yet, check to see if there is data in the + queue now, and if not enter the Blocked state to wait for data. */ + if (prvIsQueueEmpty(pxQueue) != pdFALSE) { + traceBLOCKING_ON_QUEUE_PEEK(pxQueue); + vTaskPlaceOnEventList(&(pxQueue->xTasksWaitingToReceive), xTicksToWait); + prvUnlockQueue(pxQueue); + if (xTaskResumeAll() == pdFALSE) { + portYIELD_WITHIN_API(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* There is data in the queue now, so don't enter the blocked + state, instead return to try and obtain the data. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + } + } else { + /* The timeout has expired. If there is still no data in the queue + exit, otherwise go back and try to read the data again. */ + prvUnlockQueue(pxQueue); + (void)xTaskResumeAll(); + + if (prvIsQueueEmpty(pxQueue) != pdFALSE) { + traceQUEUE_PEEK_FAILED(pxQueue); + return errQUEUE_EMPTY; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + } /*lint -restore */ +} +/*-----------------------------------------------------------*/ + +BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *const pvBuffer, BaseType_t *const pxHigherPriorityTaskWoken) { + BaseType_t xReturn; + UBaseType_t uxSavedInterruptStatus; + Queue_t *const pxQueue = xQueue; + + configASSERT(pxQueue); + configASSERT(!((pvBuffer == NULL) && (pxQueue->uxItemSize != (UBaseType_t)0U))); + + /* RTOS ports that support interrupt nesting have the concept of a maximum + system call (or maximum API call) interrupt priority. Interrupts that are + above the maximum system call priority are kept permanently enabled, even + when the RTOS kernel is in a critical section, but cannot make any calls to + FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h + then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion + failure if a FreeRTOS API function is called from an interrupt that has been + assigned a priority above the configured maximum system call priority. + Only FreeRTOS functions that end in FromISR can be called from interrupts + that have been assigned a priority at or (logically) below the maximum + system call interrupt priority. FreeRTOS maintains a separate interrupt + safe API to ensure interrupt entry is as fast and as simple as possible. + More information (albeit Cortex-M specific) is provided on the following + link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ + portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); + + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); + { + const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting; + + /* Cannot block in an ISR, so check there is data available. */ + if (uxMessagesWaiting > (UBaseType_t)0) { + const int8_t cRxLock = pxQueue->cRxLock; + + traceQUEUE_RECEIVE_FROM_ISR(pxQueue); + + prvCopyDataFromQueue(pxQueue, pvBuffer); + pxQueue->uxMessagesWaiting = uxMessagesWaiting - (UBaseType_t)1; + + /* If the queue is locked the event list will not be modified. + Instead update the lock count so the task that unlocks the queue + will know that an ISR has removed data while the queue was + locked. */ + if (cRxLock == queueUNLOCKED) { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + /* The task waiting has a higher priority than us so + force a context switch. */ + if (pxHigherPriorityTaskWoken != NULL) { + *pxHigherPriorityTaskWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* Increment the lock count so the task that unlocks the queue + knows that data was removed while it was locked. */ + pxQueue->cRxLock = (int8_t)(cRxLock + 1); + } + + xReturn = pdPASS; + } else { + xReturn = pdFAIL; + traceQUEUE_RECEIVE_FROM_ISR_FAILED(pxQueue); + } + } + portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedInterruptStatus); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +BaseType_t xQueuePeekFromISR(QueueHandle_t xQueue, void *const pvBuffer) { + BaseType_t xReturn; + UBaseType_t uxSavedInterruptStatus; + int8_t *pcOriginalReadPosition; + Queue_t *const pxQueue = xQueue; + + configASSERT(pxQueue); + configASSERT(!((pvBuffer == NULL) && (pxQueue->uxItemSize != (UBaseType_t)0U))); + configASSERT(pxQueue->uxItemSize != 0); /* Can't peek a semaphore. */ + + /* RTOS ports that support interrupt nesting have the concept of a maximum + system call (or maximum API call) interrupt priority. Interrupts that are + above the maximum system call priority are kept permanently enabled, even + when the RTOS kernel is in a critical section, but cannot make any calls to + FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h + then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion + failure if a FreeRTOS API function is called from an interrupt that has been + assigned a priority above the configured maximum system call priority. + Only FreeRTOS functions that end in FromISR can be called from interrupts + that have been assigned a priority at or (logically) below the maximum + system call interrupt priority. FreeRTOS maintains a separate interrupt + safe API to ensure interrupt entry is as fast and as simple as possible. + More information (albeit Cortex-M specific) is provided on the following + link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */ + portASSERT_IF_INTERRUPT_PRIORITY_INVALID(); + + uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); + { + /* Cannot block in an ISR, so check there is data available. */ + if (pxQueue->uxMessagesWaiting > (UBaseType_t)0) { + traceQUEUE_PEEK_FROM_ISR(pxQueue); + + /* Remember the read position so it can be reset as nothing is + actually being removed from the queue. */ + pcOriginalReadPosition = pxQueue->u.xQueue.pcReadFrom; + prvCopyDataFromQueue(pxQueue, pvBuffer); + pxQueue->u.xQueue.pcReadFrom = pcOriginalReadPosition; + + xReturn = pdPASS; + } else { + xReturn = pdFAIL; + traceQUEUE_PEEK_FROM_ISR_FAILED(pxQueue); + } + } + portCLEAR_INTERRUPT_MASK_FROM_ISR(uxSavedInterruptStatus); + + return xReturn; +} +/*-----------------------------------------------------------*/ + +UBaseType_t uxQueueMessagesWaiting(const QueueHandle_t xQueue) { + UBaseType_t uxReturn; + + configASSERT(xQueue); + + taskENTER_CRITICAL(); + { uxReturn = ((Queue_t *)xQueue)->uxMessagesWaiting; } + taskEXIT_CRITICAL(); + + return uxReturn; } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ /*-----------------------------------------------------------*/ -UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue ) -{ -UBaseType_t uxReturn; -Queue_t * const pxQueue = xQueue; +UBaseType_t uxQueueSpacesAvailable(const QueueHandle_t xQueue) { + UBaseType_t uxReturn; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); + configASSERT(pxQueue); - taskENTER_CRITICAL(); - { - uxReturn = pxQueue->uxLength - pxQueue->uxMessagesWaiting; - } - taskEXIT_CRITICAL(); + taskENTER_CRITICAL(); + { uxReturn = pxQueue->uxLength - pxQueue->uxMessagesWaiting; } + taskEXIT_CRITICAL(); - return uxReturn; + return uxReturn; } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ /*-----------------------------------------------------------*/ -UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) -{ -UBaseType_t uxReturn; -Queue_t * const pxQueue = xQueue; +UBaseType_t uxQueueMessagesWaitingFromISR(const QueueHandle_t xQueue) { + UBaseType_t uxReturn; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - uxReturn = pxQueue->uxMessagesWaiting; + configASSERT(pxQueue); + uxReturn = pxQueue->uxMessagesWaiting; - return uxReturn; + return uxReturn; } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */ /*-----------------------------------------------------------*/ -void vQueueDelete( QueueHandle_t xQueue ) -{ -Queue_t * const pxQueue = xQueue; +void vQueueDelete(QueueHandle_t xQueue) { + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - traceQUEUE_DELETE( pxQueue ); + configASSERT(pxQueue); + traceQUEUE_DELETE(pxQueue); - #if ( configQUEUE_REGISTRY_SIZE > 0 ) - { - vQueueUnregisterQueue( pxQueue ); - } - #endif +#if (configQUEUE_REGISTRY_SIZE > 0) + { vQueueUnregisterQueue(pxQueue); } +#endif - #if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) ) - { - /* The queue can only have been allocated dynamically - free it - again. */ - vPortFree( pxQueue ); - } - #elif( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) - { - /* The queue could have been allocated statically or dynamically, so - check before attempting to free the memory. */ - if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdFALSE ) - { - vPortFree( pxQueue ); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #else - { - /* The queue must have been statically allocated, so is not going to be - deleted. Avoid compiler warnings about the unused parameter. */ - ( void ) pxQueue; - } - #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ +#if ((configSUPPORT_DYNAMIC_ALLOCATION == 1) && (configSUPPORT_STATIC_ALLOCATION == 0)) + { + /* The queue can only have been allocated dynamically - free it + again. */ + vPortFree(pxQueue); + } +#elif ((configSUPPORT_DYNAMIC_ALLOCATION == 1) && (configSUPPORT_STATIC_ALLOCATION == 1)) + { + /* The queue could have been allocated statically or dynamically, so + check before attempting to free the memory. */ + if (pxQueue->ucStaticallyAllocated == (uint8_t)pdFALSE) { + vPortFree(pxQueue); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +#else + { + /* The queue must have been statically allocated, so is not going to be + deleted. Avoid compiler warnings about the unused parameter. */ + (void)pxQueue; + } +#endif /* configSUPPORT_DYNAMIC_ALLOCATION */ } /*-----------------------------------------------------------*/ -#if ( configUSE_TRACE_FACILITY == 1 ) +#if (configUSE_TRACE_FACILITY == 1) - UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) - { - return ( ( Queue_t * ) xQueue )->uxQueueNumber; - } +UBaseType_t uxQueueGetQueueNumber(QueueHandle_t xQueue) { return ((Queue_t *)xQueue)->uxQueueNumber; } #endif /* configUSE_TRACE_FACILITY */ /*-----------------------------------------------------------*/ -#if ( configUSE_TRACE_FACILITY == 1 ) +#if (configUSE_TRACE_FACILITY == 1) - void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) - { - ( ( Queue_t * ) xQueue )->uxQueueNumber = uxQueueNumber; - } +void vQueueSetQueueNumber(QueueHandle_t xQueue, UBaseType_t uxQueueNumber) { ((Queue_t *)xQueue)->uxQueueNumber = uxQueueNumber; } #endif /* configUSE_TRACE_FACILITY */ /*-----------------------------------------------------------*/ -#if ( configUSE_TRACE_FACILITY == 1 ) +#if (configUSE_TRACE_FACILITY == 1) - uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) - { - return ( ( Queue_t * ) xQueue )->ucQueueType; - } +uint8_t ucQueueGetQueueType(QueueHandle_t xQueue) { return ((Queue_t *)xQueue)->ucQueueType; } #endif /* configUSE_TRACE_FACILITY */ /*-----------------------------------------------------------*/ -#if( configUSE_MUTEXES == 1 ) +#if (configUSE_MUTEXES == 1) - static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue ) - { - UBaseType_t uxHighestPriorityOfWaitingTasks; +static UBaseType_t prvGetDisinheritPriorityAfterTimeout(const Queue_t *const pxQueue) { + UBaseType_t uxHighestPriorityOfWaitingTasks; - /* If a task waiting for a mutex causes the mutex holder to inherit a - priority, but the waiting task times out, then the holder should - disinherit the priority - but only down to the highest priority of any - other tasks that are waiting for the same mutex. For this purpose, - return the priority of the highest priority task that is waiting for the - mutex. */ - if( listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0U ) - { - uxHighestPriorityOfWaitingTasks = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) listGET_ITEM_VALUE_OF_HEAD_ENTRY( &( pxQueue->xTasksWaitingToReceive ) ); - } - else - { - uxHighestPriorityOfWaitingTasks = tskIDLE_PRIORITY; - } + /* If a task waiting for a mutex causes the mutex holder to inherit a + priority, but the waiting task times out, then the holder should + disinherit the priority - but only down to the highest priority of any + other tasks that are waiting for the same mutex. For this purpose, + return the priority of the highest priority task that is waiting for the + mutex. */ + if (listCURRENT_LIST_LENGTH(&(pxQueue->xTasksWaitingToReceive)) > 0U) { + uxHighestPriorityOfWaitingTasks = (UBaseType_t)configMAX_PRIORITIES - (UBaseType_t)listGET_ITEM_VALUE_OF_HEAD_ENTRY(&(pxQueue->xTasksWaitingToReceive)); + } else { + uxHighestPriorityOfWaitingTasks = tskIDLE_PRIORITY; + } - return uxHighestPriorityOfWaitingTasks; - } + return uxHighestPriorityOfWaitingTasks; +} #endif /* configUSE_MUTEXES */ /*-----------------------------------------------------------*/ -static BaseType_t prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition ) -{ -BaseType_t xReturn = pdFALSE; -UBaseType_t uxMessagesWaiting; +static BaseType_t prvCopyDataToQueue(Queue_t *const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition) { + BaseType_t xReturn = pdFALSE; + UBaseType_t uxMessagesWaiting; - /* This function is called from a critical section. */ + /* This function is called from a critical section. */ - uxMessagesWaiting = pxQueue->uxMessagesWaiting; + uxMessagesWaiting = pxQueue->uxMessagesWaiting; - if( pxQueue->uxItemSize == ( UBaseType_t ) 0 ) - { - #if ( configUSE_MUTEXES == 1 ) - { - if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) - { - /* The mutex is no longer being held. */ - xReturn = xTaskPriorityDisinherit( pxQueue->u.xSemaphore.xMutexHolder ); - pxQueue->u.xSemaphore.xMutexHolder = NULL; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - #endif /* configUSE_MUTEXES */ - } - else if( xPosition == queueSEND_TO_BACK ) - { - ( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */ - pxQueue->pcWriteTo += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */ - if( pxQueue->pcWriteTo >= pxQueue->u.xQueue.pcTail ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */ - { - pxQueue->pcWriteTo = pxQueue->pcHead; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - ( void ) memcpy( ( void * ) pxQueue->u.xQueue.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e9087 !e418 MISRA exception as the casts are only redundant for some ports. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. Assert checks null pointer only used when length is 0. */ - pxQueue->u.xQueue.pcReadFrom -= pxQueue->uxItemSize; - if( pxQueue->u.xQueue.pcReadFrom < pxQueue->pcHead ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */ - { - pxQueue->u.xQueue.pcReadFrom = ( pxQueue->u.xQueue.pcTail - pxQueue->uxItemSize ); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + if (pxQueue->uxItemSize == (UBaseType_t)0) { +#if (configUSE_MUTEXES == 1) + { + if (pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) { + /* The mutex is no longer being held. */ + xReturn = xTaskPriorityDisinherit(pxQueue->u.xSemaphore.xMutexHolder); + pxQueue->u.xSemaphore.xMutexHolder = NULL; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +#endif /* configUSE_MUTEXES */ + } else if (xPosition == queueSEND_TO_BACK) { + if (pvItemToQueue) { + (void)memcpy( + (void *)pxQueue->pcWriteTo, pvItemToQueue, + (size_t)pxQueue->uxItemSize); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to + memcpy() if the copy size is 0. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */ + } + pxQueue->pcWriteTo += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */ + if (pxQueue->pcWriteTo >= pxQueue->u.xQueue.pcTail) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */ + { + pxQueue->pcWriteTo = pxQueue->pcHead; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + (void)memcpy((void *)pxQueue->u.xQueue.pcReadFrom, pvItemToQueue, + (size_t)pxQueue->uxItemSize); /*lint !e961 !e9087 !e418 MISRA exception as the casts are only redundant for some ports. Cast to void required by function signature and safe as no + alignment requirement and copy length specified in bytes. Assert checks null pointer only used when length is 0. */ + pxQueue->u.xQueue.pcReadFrom -= pxQueue->uxItemSize; + if (pxQueue->u.xQueue.pcReadFrom < pxQueue->pcHead) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */ + { + pxQueue->u.xQueue.pcReadFrom = (pxQueue->u.xQueue.pcTail - pxQueue->uxItemSize); + } else { + mtCOVERAGE_TEST_MARKER(); + } - if( xPosition == queueOVERWRITE ) - { - if( uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - /* An item is not being added but overwritten, so subtract - one from the recorded number of items in the queue so when - one is added again below the number of recorded items remains - correct. */ - --uxMessagesWaiting; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } + if (xPosition == queueOVERWRITE) { + if (uxMessagesWaiting > (UBaseType_t)0) { + /* An item is not being added but overwritten, so subtract + one from the recorded number of items in the queue so when + one is added again below the number of recorded items remains + correct. */ + --uxMessagesWaiting; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } - pxQueue->uxMessagesWaiting = uxMessagesWaiting + ( UBaseType_t ) 1; + pxQueue->uxMessagesWaiting = uxMessagesWaiting + (UBaseType_t)1; - return xReturn; + return xReturn; } /*-----------------------------------------------------------*/ -static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ) -{ - if( pxQueue->uxItemSize != ( UBaseType_t ) 0 ) - { - pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */ - if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail ) /*lint !e946 MISRA exception justified as use of the relational operator is the cleanest solutions. */ - { - pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports. Also previous logic ensures a null pointer can only be passed to memcpy() when the count is 0. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */ - } +static void prvCopyDataFromQueue(Queue_t *const pxQueue, void *const pvBuffer) { + if (pxQueue->uxItemSize != (UBaseType_t)0) { + pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */ + if (pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail) /*lint !e946 MISRA exception justified as use of the relational operator is the cleanest solutions. */ + { + pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; + } else { + mtCOVERAGE_TEST_MARKER(); + } + (void)memcpy( + (void *)pvBuffer, (void *)pxQueue->u.xQueue.pcReadFrom, + (size_t)pxQueue->uxItemSize); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports. Also previous logic ensures a null pointer can only be passed to + memcpy() when the count is 0. Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */ + } } /*-----------------------------------------------------------*/ -static void prvUnlockQueue( Queue_t * const pxQueue ) -{ - /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */ +static void prvUnlockQueue(Queue_t *const pxQueue) { + /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. */ - /* The lock counts contains the number of extra data items placed or - removed from the queue while the queue was locked. When a queue is - locked items can be added or removed, but the event lists cannot be - updated. */ - taskENTER_CRITICAL(); - { - int8_t cTxLock = pxQueue->cTxLock; + /* The lock counts contains the number of extra data items placed or + removed from the queue while the queue was locked. When a queue is + locked items can be added or removed, but the event lists cannot be + updated. */ + taskENTER_CRITICAL(); + { + int8_t cTxLock = pxQueue->cTxLock; - /* See if data was added to the queue while it was locked. */ - while( cTxLock > queueLOCKED_UNMODIFIED ) - { - /* Data was posted while the queue was locked. Are any tasks - blocked waiting for data to become available? */ - #if ( configUSE_QUEUE_SETS == 1 ) - { - if( pxQueue->pxQueueSetContainer != NULL ) - { - if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) - { - /* The queue is a member of a queue set, and posting to - the queue set caused a higher priority task to unblock. - A context switch is required. */ - vTaskMissedYield(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - /* Tasks that are removed from the event list will get - added to the pending ready list as the scheduler is still - suspended. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so record that a - context switch is required. */ - vTaskMissedYield(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - break; - } - } - } - #else /* configUSE_QUEUE_SETS */ - { - /* Tasks that are removed from the event list will get added to - the pending ready list as the scheduler is still suspended. */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority so record that - a context switch is required. */ - vTaskMissedYield(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - break; - } - } - #endif /* configUSE_QUEUE_SETS */ + /* See if data was added to the queue while it was locked. */ + while (cTxLock > queueLOCKED_UNMODIFIED) { +/* Data was posted while the queue was locked. Are any tasks +blocked waiting for data to become available? */ +#if (configUSE_QUEUE_SETS == 1) + { + if (pxQueue->pxQueueSetContainer != NULL) { + if (prvNotifyQueueSetContainer(pxQueue) != pdFALSE) { + /* The queue is a member of a queue set, and posting to + the queue set caused a higher priority task to unblock. + A context switch is required. */ + vTaskMissedYield(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + /* Tasks that are removed from the event list will get + added to the pending ready list as the scheduler is still + suspended. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority so record that a + context switch is required. */ + vTaskMissedYield(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + break; + } + } + } +#else /* configUSE_QUEUE_SETS */ + { + /* Tasks that are removed from the event list will get added to + the pending ready list as the scheduler is still suspended. */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority so record that + a context switch is required. */ + vTaskMissedYield(); + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + break; + } + } +#endif /* configUSE_QUEUE_SETS */ - --cTxLock; - } + --cTxLock; + } - pxQueue->cTxLock = queueUNLOCKED; - } - taskEXIT_CRITICAL(); + pxQueue->cTxLock = queueUNLOCKED; + } + taskEXIT_CRITICAL(); - /* Do the same for the Rx lock. */ - taskENTER_CRITICAL(); - { - int8_t cRxLock = pxQueue->cRxLock; + /* Do the same for the Rx lock. */ + taskENTER_CRITICAL(); + { + int8_t cRxLock = pxQueue->cRxLock; - while( cRxLock > queueLOCKED_UNMODIFIED ) - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - vTaskMissedYield(); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + while (cRxLock > queueLOCKED_UNMODIFIED) { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + vTaskMissedYield(); + } else { + mtCOVERAGE_TEST_MARKER(); + } - --cRxLock; - } - else - { - break; - } - } + --cRxLock; + } else { + break; + } + } - pxQueue->cRxLock = queueUNLOCKED; - } - taskEXIT_CRITICAL(); + pxQueue->cRxLock = queueUNLOCKED; + } + taskEXIT_CRITICAL(); } /*-----------------------------------------------------------*/ -static BaseType_t prvIsQueueEmpty( const Queue_t *pxQueue ) -{ -BaseType_t xReturn; +static BaseType_t prvIsQueueEmpty(const Queue_t *pxQueue) { + BaseType_t xReturn; - taskENTER_CRITICAL(); - { - if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 ) - { - xReturn = pdTRUE; - } - else - { - xReturn = pdFALSE; - } - } - taskEXIT_CRITICAL(); + taskENTER_CRITICAL(); + { + if (pxQueue->uxMessagesWaiting == (UBaseType_t)0) { + xReturn = pdTRUE; + } else { + xReturn = pdFALSE; + } + } + taskEXIT_CRITICAL(); - return xReturn; + return xReturn; } /*-----------------------------------------------------------*/ -BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) -{ -BaseType_t xReturn; -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueIsQueueEmptyFromISR(const QueueHandle_t xQueue) { + BaseType_t xReturn; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 ) - { - xReturn = pdTRUE; - } - else - { - xReturn = pdFALSE; - } + configASSERT(pxQueue); + if (pxQueue->uxMessagesWaiting == (UBaseType_t)0) { + xReturn = pdTRUE; + } else { + xReturn = pdFALSE; + } - return xReturn; + return xReturn; } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ /*-----------------------------------------------------------*/ -static BaseType_t prvIsQueueFull( const Queue_t *pxQueue ) -{ -BaseType_t xReturn; +static BaseType_t prvIsQueueFull(const Queue_t *pxQueue) { + BaseType_t xReturn; - taskENTER_CRITICAL(); - { - if( pxQueue->uxMessagesWaiting == pxQueue->uxLength ) - { - xReturn = pdTRUE; - } - else - { - xReturn = pdFALSE; - } - } - taskEXIT_CRITICAL(); + taskENTER_CRITICAL(); + { + if (pxQueue->uxMessagesWaiting == pxQueue->uxLength) { + xReturn = pdTRUE; + } else { + xReturn = pdFALSE; + } + } + taskEXIT_CRITICAL(); - return xReturn; + return xReturn; } /*-----------------------------------------------------------*/ -BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) -{ -BaseType_t xReturn; -Queue_t * const pxQueue = xQueue; +BaseType_t xQueueIsQueueFullFromISR(const QueueHandle_t xQueue) { + BaseType_t xReturn; + Queue_t *const pxQueue = xQueue; - configASSERT( pxQueue ); - if( pxQueue->uxMessagesWaiting == pxQueue->uxLength ) - { - xReturn = pdTRUE; - } - else - { - xReturn = pdFALSE; - } + configASSERT(pxQueue); + if (pxQueue->uxMessagesWaiting == pxQueue->uxLength) { + xReturn = pdTRUE; + } else { + xReturn = pdFALSE; + } - return xReturn; + return xReturn; } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ /*-----------------------------------------------------------*/ -#if ( configUSE_CO_ROUTINES == 1 ) +#if (configUSE_CO_ROUTINES == 1) - BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait ) - { - BaseType_t xReturn; - Queue_t * const pxQueue = xQueue; +BaseType_t xQueueCRSend(QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait) { + BaseType_t xReturn; + Queue_t *const pxQueue = xQueue; - /* If the queue is already full we may have to block. A critical section - is required to prevent an interrupt removing something from the queue - between the check to see if the queue is full and blocking on the queue. */ - portDISABLE_INTERRUPTS(); - { - if( prvIsQueueFull( pxQueue ) != pdFALSE ) - { - /* The queue is full - do we want to block or just leave without - posting? */ - if( xTicksToWait > ( TickType_t ) 0 ) - { - /* As this is called from a coroutine we cannot block directly, but - return indicating that we need to block. */ - vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToSend ) ); - portENABLE_INTERRUPTS(); - return errQUEUE_BLOCKED; - } - else - { - portENABLE_INTERRUPTS(); - return errQUEUE_FULL; - } - } - } - portENABLE_INTERRUPTS(); + /* If the queue is already full we may have to block. A critical section + is required to prevent an interrupt removing something from the queue + between the check to see if the queue is full and blocking on the queue. */ + portDISABLE_INTERRUPTS(); + { + if (prvIsQueueFull(pxQueue) != pdFALSE) { + /* The queue is full - do we want to block or just leave without + posting? */ + if (xTicksToWait > (TickType_t)0) { + /* As this is called from a coroutine we cannot block directly, but + return indicating that we need to block. */ + vCoRoutineAddToDelayedList(xTicksToWait, &(pxQueue->xTasksWaitingToSend)); + portENABLE_INTERRUPTS(); + return errQUEUE_BLOCKED; + } else { + portENABLE_INTERRUPTS(); + return errQUEUE_FULL; + } + } + } + portENABLE_INTERRUPTS(); - portDISABLE_INTERRUPTS(); - { - if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) - { - /* There is room in the queue, copy the data into the queue. */ - prvCopyDataToQueue( pxQueue, pvItemToQueue, queueSEND_TO_BACK ); - xReturn = pdPASS; + portDISABLE_INTERRUPTS(); + { + if (pxQueue->uxMessagesWaiting < pxQueue->uxLength) { + /* There is room in the queue, copy the data into the queue. */ + prvCopyDataToQueue(pxQueue, pvItemToQueue, queueSEND_TO_BACK); + xReturn = pdPASS; - /* Were any co-routines waiting for data to become available? */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - /* In this instance the co-routine could be placed directly - into the ready list as we are within a critical section. - Instead the same pending ready list mechanism is used as if - the event were caused from within an interrupt. */ - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The co-routine waiting has a higher priority so record - that a yield might be appropriate. */ - xReturn = errQUEUE_YIELD; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - xReturn = errQUEUE_FULL; - } - } - portENABLE_INTERRUPTS(); + /* Were any co-routines waiting for data to become available? */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + /* In this instance the co-routine could be placed directly + into the ready list as we are within a critical section. + Instead the same pending ready list mechanism is used as if + the event were caused from within an interrupt. */ + if (xCoRoutineRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + /* The co-routine waiting has a higher priority so record + that a yield might be appropriate. */ + xReturn = errQUEUE_YIELD; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + xReturn = errQUEUE_FULL; + } + } + portENABLE_INTERRUPTS(); - return xReturn; - } + return xReturn; +} #endif /* configUSE_CO_ROUTINES */ /*-----------------------------------------------------------*/ -#if ( configUSE_CO_ROUTINES == 1 ) +#if (configUSE_CO_ROUTINES == 1) - BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait ) - { - BaseType_t xReturn; - Queue_t * const pxQueue = xQueue; +BaseType_t xQueueCRReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait) { + BaseType_t xReturn; + Queue_t *const pxQueue = xQueue; - /* If the queue is already empty we may have to block. A critical section - is required to prevent an interrupt adding something to the queue - between the check to see if the queue is empty and blocking on the queue. */ - portDISABLE_INTERRUPTS(); - { - if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 ) - { - /* There are no messages in the queue, do we want to block or just - leave with nothing? */ - if( xTicksToWait > ( TickType_t ) 0 ) - { - /* As this is a co-routine we cannot block directly, but return - indicating that we need to block. */ - vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToReceive ) ); - portENABLE_INTERRUPTS(); - return errQUEUE_BLOCKED; - } - else - { - portENABLE_INTERRUPTS(); - return errQUEUE_FULL; - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - portENABLE_INTERRUPTS(); + /* If the queue is already empty we may have to block. A critical section + is required to prevent an interrupt adding something to the queue + between the check to see if the queue is empty and blocking on the queue. */ + portDISABLE_INTERRUPTS(); + { + if (pxQueue->uxMessagesWaiting == (UBaseType_t)0) { + /* There are no messages in the queue, do we want to block or just + leave with nothing? */ + if (xTicksToWait > (TickType_t)0) { + /* As this is a co-routine we cannot block directly, but return + indicating that we need to block. */ + vCoRoutineAddToDelayedList(xTicksToWait, &(pxQueue->xTasksWaitingToReceive)); + portENABLE_INTERRUPTS(); + return errQUEUE_BLOCKED; + } else { + portENABLE_INTERRUPTS(); + return errQUEUE_FULL; + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } + portENABLE_INTERRUPTS(); - portDISABLE_INTERRUPTS(); - { - if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - /* Data is available from the queue. */ - pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; - if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail ) - { - pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - --( pxQueue->uxMessagesWaiting ); - ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( unsigned ) pxQueue->uxItemSize ); + portDISABLE_INTERRUPTS(); + { + if (pxQueue->uxMessagesWaiting > (UBaseType_t)0) { + /* Data is available from the queue. */ + pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; + if (pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail) { + pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; + } else { + mtCOVERAGE_TEST_MARKER(); + } + --(pxQueue->uxMessagesWaiting); + (void)memcpy((void *)pvBuffer, (void *)pxQueue->u.xQueue.pcReadFrom, (unsigned)pxQueue->uxItemSize); - xReturn = pdPASS; + xReturn = pdPASS; - /* Were any co-routines waiting for space to become available? */ - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - /* In this instance the co-routine could be placed directly - into the ready list as we are within a critical section. - Instead the same pending ready list mechanism is used as if - the event were caused from within an interrupt. */ - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - xReturn = errQUEUE_YIELD; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - xReturn = pdFAIL; - } - } - portENABLE_INTERRUPTS(); + /* Were any co-routines waiting for space to become available? */ + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + /* In this instance the co-routine could be placed directly + into the ready list as we are within a critical section. + Instead the same pending ready list mechanism is used as if + the event were caused from within an interrupt. */ + if (xCoRoutineRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + xReturn = errQUEUE_YIELD; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + xReturn = pdFAIL; + } + } + portENABLE_INTERRUPTS(); - return xReturn; - } + return xReturn; +} #endif /* configUSE_CO_ROUTINES */ /*-----------------------------------------------------------*/ -#if ( configUSE_CO_ROUTINES == 1 ) +#if (configUSE_CO_ROUTINES == 1) - BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken ) - { - Queue_t * const pxQueue = xQueue; +BaseType_t xQueueCRSendFromISR(QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken) { + Queue_t *const pxQueue = xQueue; - /* Cannot block within an ISR so if there is no space on the queue then - exit without doing anything. */ - if( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) - { - prvCopyDataToQueue( pxQueue, pvItemToQueue, queueSEND_TO_BACK ); + /* Cannot block within an ISR so if there is no space on the queue then + exit without doing anything. */ + if (pxQueue->uxMessagesWaiting < pxQueue->uxLength) { + prvCopyDataToQueue(pxQueue, pvItemToQueue, queueSEND_TO_BACK); - /* We only want to wake one co-routine per ISR, so check that a - co-routine has not already been woken. */ - if( xCoRoutinePreviouslyWoken == pdFALSE ) - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE ) - { - return pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + /* We only want to wake one co-routine per ISR, so check that a + co-routine has not already been woken. */ + if (xCoRoutinePreviouslyWoken == pdFALSE) { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToReceive)) == pdFALSE) { + if (xCoRoutineRemoveFromEventList(&(pxQueue->xTasksWaitingToReceive)) != pdFALSE) { + return pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } - return xCoRoutinePreviouslyWoken; - } + return xCoRoutinePreviouslyWoken; +} #endif /* configUSE_CO_ROUTINES */ /*-----------------------------------------------------------*/ -#if ( configUSE_CO_ROUTINES == 1 ) +#if (configUSE_CO_ROUTINES == 1) - BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxCoRoutineWoken ) - { - BaseType_t xReturn; - Queue_t * const pxQueue = xQueue; +BaseType_t xQueueCRReceiveFromISR(QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxCoRoutineWoken) { + BaseType_t xReturn; + Queue_t *const pxQueue = xQueue; - /* We cannot block from an ISR, so check there is data available. If - not then just leave without doing anything. */ - if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 ) - { - /* Copy the data from the queue. */ - pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; - if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail ) - { - pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - --( pxQueue->uxMessagesWaiting ); - ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( unsigned ) pxQueue->uxItemSize ); + /* We cannot block from an ISR, so check there is data available. If + not then just leave without doing anything. */ + if (pxQueue->uxMessagesWaiting > (UBaseType_t)0) { + /* Copy the data from the queue. */ + pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize; + if (pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail) { + pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead; + } else { + mtCOVERAGE_TEST_MARKER(); + } + --(pxQueue->uxMessagesWaiting); + (void)memcpy((void *)pvBuffer, (void *)pxQueue->u.xQueue.pcReadFrom, (unsigned)pxQueue->uxItemSize); - if( ( *pxCoRoutineWoken ) == pdFALSE ) - { - if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE ) - { - if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE ) - { - *pxCoRoutineWoken = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + if ((*pxCoRoutineWoken) == pdFALSE) { + if (listLIST_IS_EMPTY(&(pxQueue->xTasksWaitingToSend)) == pdFALSE) { + if (xCoRoutineRemoveFromEventList(&(pxQueue->xTasksWaitingToSend)) != pdFALSE) { + *pxCoRoutineWoken = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } - xReturn = pdPASS; - } - else - { - xReturn = pdFAIL; - } + xReturn = pdPASS; + } else { + xReturn = pdFAIL; + } - return xReturn; - } + return xReturn; +} #endif /* configUSE_CO_ROUTINES */ /*-----------------------------------------------------------*/ -#if ( configQUEUE_REGISTRY_SIZE > 0 ) +#if (configQUEUE_REGISTRY_SIZE > 0) - void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcQueueName ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - { - UBaseType_t ux; +void vQueueAddToRegistry(QueueHandle_t xQueue, const char *pcQueueName) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +{ + UBaseType_t ux; - /* See if there is an empty space in the registry. A NULL name denotes - a free slot. */ - for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) - { - if( xQueueRegistry[ ux ].pcQueueName == NULL ) - { - /* Store the information on this queue. */ - xQueueRegistry[ ux ].pcQueueName = pcQueueName; - xQueueRegistry[ ux ].xHandle = xQueue; + /* See if there is an empty space in the registry. A NULL name denotes + a free slot. */ + for (ux = (UBaseType_t)0U; ux < (UBaseType_t)configQUEUE_REGISTRY_SIZE; ux++) { + if (xQueueRegistry[ux].pcQueueName == NULL) { + /* Store the information on this queue. */ + xQueueRegistry[ux].pcQueueName = pcQueueName; + xQueueRegistry[ux].xHandle = xQueue; - traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName ); - break; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - } + traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName); + break; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } +} #endif /* configQUEUE_REGISTRY_SIZE */ /*-----------------------------------------------------------*/ -#if ( configQUEUE_REGISTRY_SIZE > 0 ) +#if (configQUEUE_REGISTRY_SIZE > 0) - const char *pcQueueGetName( QueueHandle_t xQueue ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - { - UBaseType_t ux; - const char *pcReturn = NULL; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +const char *pcQueueGetName(QueueHandle_t xQueue) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ +{ + UBaseType_t ux; + const char *pcReturn = NULL; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */ - /* Note there is nothing here to protect against another task adding or - removing entries from the registry while it is being searched. */ - for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) - { - if( xQueueRegistry[ ux ].xHandle == xQueue ) - { - pcReturn = xQueueRegistry[ ux ].pcQueueName; - break; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } + /* Note there is nothing here to protect against another task adding or + removing entries from the registry while it is being searched. */ + for (ux = (UBaseType_t)0U; ux < (UBaseType_t)configQUEUE_REGISTRY_SIZE; ux++) { + if (xQueueRegistry[ux].xHandle == xQueue) { + pcReturn = xQueueRegistry[ux].pcQueueName; + break; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } - return pcReturn; - } /*lint !e818 xQueue cannot be a pointer to const because it is a typedef. */ + return pcReturn; +} /*lint !e818 xQueue cannot be a pointer to const because it is a typedef. */ #endif /* configQUEUE_REGISTRY_SIZE */ /*-----------------------------------------------------------*/ -#if ( configQUEUE_REGISTRY_SIZE > 0 ) +#if (configQUEUE_REGISTRY_SIZE > 0) - void vQueueUnregisterQueue( QueueHandle_t xQueue ) - { - UBaseType_t ux; +void vQueueUnregisterQueue(QueueHandle_t xQueue) { + UBaseType_t ux; - /* See if the handle of the queue being unregistered in actually in the - registry. */ - for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ ) - { - if( xQueueRegistry[ ux ].xHandle == xQueue ) - { - /* Set the name to NULL to show that this slot if free again. */ - xQueueRegistry[ ux ].pcQueueName = NULL; + /* See if the handle of the queue being unregistered in actually in the + registry. */ + for (ux = (UBaseType_t)0U; ux < (UBaseType_t)configQUEUE_REGISTRY_SIZE; ux++) { + if (xQueueRegistry[ux].xHandle == xQueue) { + /* Set the name to NULL to show that this slot if free again. */ + xQueueRegistry[ux].pcQueueName = NULL; - /* Set the handle to NULL to ensure the same queue handle cannot - appear in the registry twice if it is added, removed, then - added again. */ - xQueueRegistry[ ux ].xHandle = ( QueueHandle_t ) 0; - break; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } + /* Set the handle to NULL to ensure the same queue handle cannot + appear in the registry twice if it is added, removed, then + added again. */ + xQueueRegistry[ux].xHandle = (QueueHandle_t)0; + break; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } - } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ +} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */ #endif /* configQUEUE_REGISTRY_SIZE */ /*-----------------------------------------------------------*/ -#if ( configUSE_TIMERS == 1 ) +#if (configUSE_TIMERS == 1) - void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) - { - Queue_t * const pxQueue = xQueue; +void vQueueWaitForMessageRestricted(QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely) { + Queue_t *const pxQueue = xQueue; - /* This function should not be called by application code hence the - 'Restricted' in its name. It is not part of the public API. It is - designed for use by kernel code, and has special calling requirements. - It can result in vListInsert() being called on a list that can only - possibly ever have one item in it, so the list will be fast, but even - so it should be called with the scheduler locked and not from a critical - section. */ + /* This function should not be called by application code hence the + 'Restricted' in its name. It is not part of the public API. It is + designed for use by kernel code, and has special calling requirements. + It can result in vListInsert() being called on a list that can only + possibly ever have one item in it, so the list will be fast, but even + so it should be called with the scheduler locked and not from a critical + section. */ - /* Only do anything if there are no messages in the queue. This function - will not actually cause the task to block, just place it on a blocked - list. It will not block until the scheduler is unlocked - at which - time a yield will be performed. If an item is added to the queue while - the queue is locked, and the calling task blocks on the queue, then the - calling task will be immediately unblocked when the queue is unlocked. */ - prvLockQueue( pxQueue ); - if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0U ) - { - /* There is nothing in the queue, block for the specified period. */ - vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait, xWaitIndefinitely ); - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - prvUnlockQueue( pxQueue ); - } + /* Only do anything if there are no messages in the queue. This function + will not actually cause the task to block, just place it on a blocked + list. It will not block until the scheduler is unlocked - at which + time a yield will be performed. If an item is added to the queue while + the queue is locked, and the calling task blocks on the queue, then the + calling task will be immediately unblocked when the queue is unlocked. */ + prvLockQueue(pxQueue); + if (pxQueue->uxMessagesWaiting == (UBaseType_t)0U) { + /* There is nothing in the queue, block for the specified period. */ + vTaskPlaceOnEventListRestricted(&(pxQueue->xTasksWaitingToReceive), xTicksToWait, xWaitIndefinitely); + } else { + mtCOVERAGE_TEST_MARKER(); + } + prvUnlockQueue(pxQueue); +} #endif /* configUSE_TIMERS */ /*-----------------------------------------------------------*/ -#if( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) +#if ((configUSE_QUEUE_SETS == 1) && (configSUPPORT_DYNAMIC_ALLOCATION == 1)) - QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength ) - { - QueueSetHandle_t pxQueue; +QueueSetHandle_t xQueueCreateSet(const UBaseType_t uxEventQueueLength) { + QueueSetHandle_t pxQueue; - pxQueue = xQueueGenericCreate( uxEventQueueLength, ( UBaseType_t ) sizeof( Queue_t * ), queueQUEUE_TYPE_SET ); + pxQueue = xQueueGenericCreate(uxEventQueueLength, (UBaseType_t)sizeof(Queue_t *), queueQUEUE_TYPE_SET); - return pxQueue; - } + return pxQueue; +} #endif /* configUSE_QUEUE_SETS */ /*-----------------------------------------------------------*/ -#if ( configUSE_QUEUE_SETS == 1 ) +#if (configUSE_QUEUE_SETS == 1) - BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) - { - BaseType_t xReturn; +BaseType_t xQueueAddToSet(QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet) { + BaseType_t xReturn; - taskENTER_CRITICAL(); - { - if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL ) - { - /* Cannot add a queue/semaphore to more than one queue set. */ - xReturn = pdFAIL; - } - else if( ( ( Queue_t * ) xQueueOrSemaphore )->uxMessagesWaiting != ( UBaseType_t ) 0 ) - { - /* Cannot add a queue/semaphore to a queue set if there are already - items in the queue/semaphore. */ - xReturn = pdFAIL; - } - else - { - ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer = xQueueSet; - xReturn = pdPASS; - } - } - taskEXIT_CRITICAL(); + taskENTER_CRITICAL(); + { + if (((Queue_t *)xQueueOrSemaphore)->pxQueueSetContainer != NULL) { + /* Cannot add a queue/semaphore to more than one queue set. */ + xReturn = pdFAIL; + } else if (((Queue_t *)xQueueOrSemaphore)->uxMessagesWaiting != (UBaseType_t)0) { + /* Cannot add a queue/semaphore to a queue set if there are already + items in the queue/semaphore. */ + xReturn = pdFAIL; + } else { + ((Queue_t *)xQueueOrSemaphore)->pxQueueSetContainer = xQueueSet; + xReturn = pdPASS; + } + } + taskEXIT_CRITICAL(); - return xReturn; - } + return xReturn; +} #endif /* configUSE_QUEUE_SETS */ /*-----------------------------------------------------------*/ -#if ( configUSE_QUEUE_SETS == 1 ) +#if (configUSE_QUEUE_SETS == 1) - BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ) - { - BaseType_t xReturn; - Queue_t * const pxQueueOrSemaphore = ( Queue_t * ) xQueueOrSemaphore; +BaseType_t xQueueRemoveFromSet(QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet) { + BaseType_t xReturn; + Queue_t *const pxQueueOrSemaphore = (Queue_t *)xQueueOrSemaphore; - if( pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet ) - { - /* The queue was not a member of the set. */ - xReturn = pdFAIL; - } - else if( pxQueueOrSemaphore->uxMessagesWaiting != ( UBaseType_t ) 0 ) - { - /* It is dangerous to remove a queue from a set when the queue is - not empty because the queue set will still hold pending events for - the queue. */ - xReturn = pdFAIL; - } - else - { - taskENTER_CRITICAL(); - { - /* The queue is no longer contained in the set. */ - pxQueueOrSemaphore->pxQueueSetContainer = NULL; - } - taskEXIT_CRITICAL(); - xReturn = pdPASS; - } + if (pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet) { + /* The queue was not a member of the set. */ + xReturn = pdFAIL; + } else if (pxQueueOrSemaphore->uxMessagesWaiting != (UBaseType_t)0) { + /* It is dangerous to remove a queue from a set when the queue is + not empty because the queue set will still hold pending events for + the queue. */ + xReturn = pdFAIL; + } else { + taskENTER_CRITICAL(); + { + /* The queue is no longer contained in the set. */ + pxQueueOrSemaphore->pxQueueSetContainer = NULL; + } + taskEXIT_CRITICAL(); + xReturn = pdPASS; + } - return xReturn; - } /*lint !e818 xQueueSet could not be declared as pointing to const as it is a typedef. */ + return xReturn; +} /*lint !e818 xQueueSet could not be declared as pointing to const as it is a typedef. */ #endif /* configUSE_QUEUE_SETS */ /*-----------------------------------------------------------*/ -#if ( configUSE_QUEUE_SETS == 1 ) +#if (configUSE_QUEUE_SETS == 1) - QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t const xTicksToWait ) - { - QueueSetMemberHandle_t xReturn = NULL; +QueueSetMemberHandle_t xQueueSelectFromSet(QueueSetHandle_t xQueueSet, TickType_t const xTicksToWait) { + QueueSetMemberHandle_t xReturn = NULL; - ( void ) xQueueReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait ); /*lint !e961 Casting from one typedef to another is not redundant. */ - return xReturn; - } + (void)xQueueReceive((QueueHandle_t)xQueueSet, &xReturn, xTicksToWait); /*lint !e961 Casting from one typedef to another is not redundant. */ + return xReturn; +} #endif /* configUSE_QUEUE_SETS */ /*-----------------------------------------------------------*/ -#if ( configUSE_QUEUE_SETS == 1 ) +#if (configUSE_QUEUE_SETS == 1) - QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) - { - QueueSetMemberHandle_t xReturn = NULL; +QueueSetMemberHandle_t xQueueSelectFromSetFromISR(QueueSetHandle_t xQueueSet) { + QueueSetMemberHandle_t xReturn = NULL; - ( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */ - return xReturn; - } + (void)xQueueReceiveFromISR((QueueHandle_t)xQueueSet, &xReturn, NULL); /*lint !e961 Casting from one typedef to another is not redundant. */ + return xReturn; +} #endif /* configUSE_QUEUE_SETS */ /*-----------------------------------------------------------*/ -#if ( configUSE_QUEUE_SETS == 1 ) +#if (configUSE_QUEUE_SETS == 1) - static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue ) - { - Queue_t *pxQueueSetContainer = pxQueue->pxQueueSetContainer; - BaseType_t xReturn = pdFALSE; +static BaseType_t prvNotifyQueueSetContainer(const Queue_t *const pxQueue) { + Queue_t *pxQueueSetContainer = pxQueue->pxQueueSetContainer; + BaseType_t xReturn = pdFALSE; - /* This function must be called form a critical section. */ + /* This function must be called form a critical section. */ - configASSERT( pxQueueSetContainer ); - configASSERT( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength ); + configASSERT(pxQueueSetContainer); + configASSERT(pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength); - if( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength ) - { - const int8_t cTxLock = pxQueueSetContainer->cTxLock; + if (pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength) { + const int8_t cTxLock = pxQueueSetContainer->cTxLock; - traceQUEUE_SEND( pxQueueSetContainer ); + traceQUEUE_SEND(pxQueueSetContainer); - /* The data copied is the handle of the queue that contains data. */ - xReturn = prvCopyDataToQueue( pxQueueSetContainer, &pxQueue, queueSEND_TO_BACK ); + /* The data copied is the handle of the queue that contains data. */ + xReturn = prvCopyDataToQueue(pxQueueSetContainer, &pxQueue, queueSEND_TO_BACK); - if( cTxLock == queueUNLOCKED ) - { - if( listLIST_IS_EMPTY( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) == pdFALSE ) - { - if( xTaskRemoveFromEventList( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) != pdFALSE ) - { - /* The task waiting has a higher priority. */ - xReturn = pdTRUE; - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } - } - else - { - pxQueueSetContainer->cTxLock = ( int8_t ) ( cTxLock + 1 ); - } - } - else - { - mtCOVERAGE_TEST_MARKER(); - } + if (cTxLock == queueUNLOCKED) { + if (listLIST_IS_EMPTY(&(pxQueueSetContainer->xTasksWaitingToReceive)) == pdFALSE) { + if (xTaskRemoveFromEventList(&(pxQueueSetContainer->xTasksWaitingToReceive)) != pdFALSE) { + /* The task waiting has a higher priority. */ + xReturn = pdTRUE; + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } + } else { + pxQueueSetContainer->cTxLock = (int8_t)(cTxLock + 1); + } + } else { + mtCOVERAGE_TEST_MARKER(); + } - return xReturn; - } + return xReturn; +} #endif /* configUSE_QUEUE_SETS */ - - - - - - - - - - - - From a73f634cff5f6e6deb22faa65817e01264b0f279 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Sun, 3 Apr 2022 12:58:07 +1000 Subject: [PATCH 02/37] Pinecil pd tweaking (#1272) * Raise PD max to 21V * gui -> settingsGUI * VBus probe cache * Rough pass PD capabilities display * Cleanup build errors * PD Debug menu working * Update make_translation.py * settingsGUI * Update GUIThread.cpp * Nicer debug prints * Show VBus in PD debug * Update GUIThread.cpp * Update make_translation.py * Add docs * Build tweaks for TS80P :cry: * Show PPS ranges --- Documentation/DebugMenu.md | 22 +++-- Translations/make_translation.py | 5 ++ source/Core/BSP/Pine64/configuration.h | 4 +- source/Core/Drivers/Buttons.cpp | 2 +- source/Core/Drivers/USBPD.cpp | 18 +++- source/Core/Drivers/USBPD.h | 22 ++--- source/Core/Inc/Translation.h | 5 ++ source/Core/Inc/{gui.hpp => settingsGUI.hpp} | 2 +- source/Core/LangSupport/lang_multi.cpp | 8 +- source/Core/Src/{gui.cpp => settingsGUI.cpp} | 4 +- source/Core/Threads/GUIThread.cpp | 95 ++++++++++++++++++-- 11 files changed, 155 insertions(+), 32 deletions(-) rename source/Core/Inc/{gui.hpp => settingsGUI.hpp} (95%) rename source/Core/Src/{gui.cpp => settingsGUI.cpp} (99%) diff --git a/Documentation/DebugMenu.md b/Documentation/DebugMenu.md index 1e4297ac..a4e34826 100644 --- a/Documentation/DebugMenu.md +++ b/Documentation/DebugMenu.md @@ -40,7 +40,7 @@ This is the raw tip reading in μV. This can be used when assessing the calibrat ### CTip -This is the tip temperature in degrees Celsius. +This is the tip temperature in degrees Celsius. This can be used with RTip for assessing temperature processing performance. ### CHan @@ -48,11 +48,11 @@ This can be used with RTip for assessing temperature processing performance. This is the handle temperature in °C. This is used for cold junction compensation of the tip temperature. This is shown in degrees Celsius x10, so 200 == 20.0 °C -### Vin +### Vin The input voltage as read by the internal ADC. Can be used to sanity check its being read correctly. -### ACC +### ACC This indicates the accelerometer that is fitted inside the unit. @@ -64,7 +64,7 @@ This indicates the accelerometer that is fitted inside the unit. - None detected -> running in fallback without movement detection - Scanning -> Still searching I2C for one -### PWR +### PWR This indicates the current power source for the iron. This may change during power up as the sources are negotiated in turn. @@ -76,13 +76,23 @@ This may change during power up as the sources are negotiated in turn. - If you successfully modified the Pinecil to support 24 V by cutting the trace line to Vbus, then 'PD No VBus' displays on screen. - Connect to any PD USB power to check Vbus status. It will not show any PD message when Pinecil is powered by DC port, QC, or USB 5 V (non PD). -### Max +### Max This indicates the max temperature in degrees Celsius that the system estimates it can measure the tip reliably to. This is dependant on a few factors including the handle temperature so it can move around during use. - ### Hall This appears if your device is capable of having a magnetic hall effect sensor installed (Pinecil). This shows the current field strength reading from the sensor. It can be used to check if the sensor is operational, and measure how strong the magnetic field is for diagnostics and optimal placement of magnets on a stand. + +# PD Debug menu + +On the Pinecil; if the iron is booted up while holding the front button (+); it will show an extra menu for inspecting USB-PD power adapters. + +The menu navigates like the debug menu, where pressing (+) cycles through elements, and (-) will exit the menu. + +First page shows the PD negotiation stage number; which can be used for diagnosing if PD is not working. +After a few seconds or after PD negotiates (state above 5) it will show "No VBus" if the VBus mod is performed or "VBus" if the mod has not been done. + +Once negotiation is complete; the other screens will show the advertised readings for voltage and current of the proposals. diff --git a/Translations/make_translation.py b/Translations/make_translation.py index e6be313a..af12a56e 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -106,9 +106,14 @@ def get_constants(build_version: str) -> List[Tuple[str, str]]: ("SymbolSeconds", "S"), ("SymbolWatts", "W"), ("SymbolVolts", "V"), + ("SymbolAmps", "A"), ("SymbolDC", "DC"), ("SymbolCellCount", "S"), ("SymbolVersionNumber", build_version), + ("SymbolPDDebug", "PD Debug"), + ("SymbolState", "State"), + ("SymbolNoVBus", "No VBus"), + ("SymbolVBus", "VBus"), ] diff --git a/source/Core/BSP/Pine64/configuration.h b/source/Core/BSP/Pine64/configuration.h index 9fc1959b..09033126 100644 --- a/source/Core/BSP/Pine64/configuration.h +++ b/source/Core/BSP/Pine64/configuration.h @@ -124,7 +124,7 @@ #define POWER_LIMIT_STEPS 5 // #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses TS100 resistors #define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table -#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate +#define USB_PD_VMAX 21 // Maximum voltage for PD to negotiate #define PID_TIM_HZ (8) // Tick rate of the PID loop #define MAX_TEMP_C 450 // Max soldering temp selectable °C #define MAX_TEMP_F 850 // Max soldering temp selectable °F @@ -153,3 +153,5 @@ #endif #define FLASH_LOGOADDR (0x08000000 + (126 * 1024)) + +#define HAS_POWER_DEBUG_MENU diff --git a/source/Core/Drivers/Buttons.cpp b/source/Core/Drivers/Buttons.cpp index 935478e6..3875ed96 100644 --- a/source/Core/Drivers/Buttons.cpp +++ b/source/Core/Drivers/Buttons.cpp @@ -5,7 +5,7 @@ * Author: Ralim */ #include "FreeRTOS.h" -#include "gui.hpp" +#include "settingsGUI.hpp" #include "task.h" #include uint32_t lastButtonTime = 0; diff --git a/source/Core/Drivers/USBPD.cpp b/source/Core/Drivers/USBPD.cpp index d1093dde..4d01e055 100644 --- a/source/Core/Drivers/USBPD.cpp +++ b/source/Core/Drivers/USBPD.cpp @@ -67,10 +67,24 @@ bool USBPowerDelivery::fusbPresent() { return detectionState == 1; } -bool USBPowerDelivery::isVBUSConnected() { return fusb.isVBUSConnected(); } +bool USBPowerDelivery::isVBUSConnected() { + static uint8_t state = 0; + if (state) { + return state == 1; + } + if (fusb.isVBUSConnected()) { + state = 1; + return true; + } else { + state = 2; + return false; + } +} +pd_msg lastCapabilities; +pd_msg *USBPowerDelivery::getLastSeenCapabilities() { return &lastCapabilities; } bool pdbs_dpm_evaluate_capability(const pd_msg *capabilities, pd_msg *request) { - + memcpy(&lastCapabilities, capabilities, sizeof(pd_msg)); /* Get the number of PDOs */ uint8_t numobj = PD_NUMOBJ_GET(capabilities); diff --git a/source/Core/Drivers/USBPD.h b/source/Core/Drivers/USBPD.h index 7e27dbea..50013e24 100644 --- a/source/Core/Drivers/USBPD.h +++ b/source/Core/Drivers/USBPD.h @@ -2,6 +2,7 @@ #ifndef DRIVERS_USBPD_H_ #define DRIVERS_USBPD_H_ #include "configuration.h" +#include "pdb_msg.h" #include #include @@ -9,16 +10,17 @@ #if POW_PD class USBPowerDelivery { public: - static bool start(); // Start the PD stack - static bool negotiationComplete(); // Has negotiation completed to a voltage > 5v - static bool negotiationInProgress(); // Is negotiation ongoing - static bool fusbPresent(); // Is the FUSB302 present on the bus - static void PPSTimerCallback(); // PPS Timer - static void IRQOccured(); // Thread callback that an irq occured - static void step(); // Iterate the step machine - static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract) - static uint8_t getStateNumber(); // Debugging - Get the internal state number - static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302 + static bool start(); // Start the PD stack + static bool negotiationComplete(); // Has negotiation completed to a voltage > 5v + static bool negotiationInProgress(); // Is negotiation ongoing + static bool fusbPresent(); // Is the FUSB302 present on the bus + static void PPSTimerCallback(); // PPS Timer + static void IRQOccured(); // Thread callback that an irq occured + static void step(); // Iterate the step machine + static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract) + static uint8_t getStateNumber(); // Debugging - Get the internal state number + static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302 + static pd_msg *getLastSeenCapabilities(); // returns pointer to the last seen capabilities from the powersource private: // static int detectionState; diff --git a/source/Core/Inc/Translation.h b/source/Core/Inc/Translation.h index 58c99ca7..cf90ead3 100644 --- a/source/Core/Inc/Translation.h +++ b/source/Core/Inc/Translation.h @@ -14,6 +14,7 @@ extern const bool HasFahrenheit; extern const char *SymbolPlus; extern const char *SymbolMinus; extern const char *SymbolSpace; +extern const char *SymbolAmps; extern const char *SymbolDot; extern const char *SymbolDegC; extern const char *SymbolDegF; @@ -24,6 +25,10 @@ extern const char *SymbolVolts; extern const char *SymbolDC; extern const char *SymbolCellCount; extern const char *SymbolVersionNumber; +extern const char *SymbolPDDebug; +extern const char *SymbolState; +extern const char *SymbolNoVBus; +extern const char *SymbolVBus; extern const char *DebugMenu[]; extern const char *AccelTypeNames[]; diff --git a/source/Core/Inc/gui.hpp b/source/Core/Inc/settingsGUI.hpp similarity index 95% rename from source/Core/Inc/gui.hpp rename to source/Core/Inc/settingsGUI.hpp index 2d9f8b05..9905973f 100644 --- a/source/Core/Inc/gui.hpp +++ b/source/Core/Inc/settingsGUI.hpp @@ -1,5 +1,5 @@ /* - * gui.h + * settingsGUI.h * * Created on: 3Sep.,2017 * Author: Ben V. Brown diff --git a/source/Core/LangSupport/lang_multi.cpp b/source/Core/LangSupport/lang_multi.cpp index fb3fbb41..60548529 100644 --- a/source/Core/LangSupport/lang_multi.cpp +++ b/source/Core/LangSupport/lang_multi.cpp @@ -3,10 +3,10 @@ #include "Translation_multi.h" #include "brieflz.h" #include "configuration.h" -#include "gui.hpp" +#include "settingsGUI.hpp" const TranslationIndexTable *Tr = nullptr; -const char * TranslationStrings = nullptr; +const char *TranslationStrings = nullptr; static uint8_t selectedLangIndex = 255; @@ -38,7 +38,7 @@ void prepareTranslations() { const TranslationData *translationData; uint16_t buffer_remaining_size = translation_data_out_buffer_size; - uint8_t * buffer_next_ptr = translation_data_out_buffer; + uint8_t *buffer_next_ptr = translation_data_out_buffer; if (langMeta.translation_is_compressed) { unsigned int outsize; outsize = blz_depack_srcsize(langMeta.translation_data, buffer_next_ptr, langMeta.translation_size); @@ -55,7 +55,7 @@ void prepareTranslations() { memset(DynamicFontSections, 0, FontSectionsCount * sizeof(DynamicFontSections[0])); for (int i = 0; i < FontSectionDataCount; i++) { const auto &fontSectionDataInfo = FontSectionDataInfos[i]; - auto & fontSection = DynamicFontSections[i]; + auto &fontSection = DynamicFontSections[i]; fontSection.symbol_start = fontSectionDataInfo.symbol_start; fontSection.symbol_end = fontSection.symbol_start + fontSectionDataInfo.symbol_count; const uint16_t font12_size = fontSectionDataInfo.symbol_count * (12 * 16 / 8); diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/settingsGUI.cpp similarity index 99% rename from source/Core/Src/gui.cpp rename to source/Core/Src/settingsGUI.cpp index 31ae0c88..adde3014 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/settingsGUI.cpp @@ -1,11 +1,11 @@ /* - * gui.cpp + * settingsGUI.cpp * * Created on: 3Sep.,2017 * Author: Ben V. Brown */ -#include "gui.hpp" +#include "settingsGUI.hpp" #include "Buttons.hpp" #include "ScrollMessage.hpp" #include "TipThermoModel.h" diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index 88c11ce5..d53cd303 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -11,20 +11,22 @@ extern "C" { #include "Buttons.hpp" #include "I2CBB.hpp" #include "LIS2DH12.hpp" +#include "MMA8652FC.hpp" +#include "OLED.hpp" #include "Settings.h" #include "TipThermoModel.h" #include "Translation.h" #include "cmsis_os.h" #include "configuration.h" +#include "history.hpp" #include "main.hpp" +#include "power.hpp" +#include "settingsGUI.hpp" #include "stdlib.h" #include "string.h" -#include -#include -#include -#include #if POW_PD #include "USBPD.h" +#include "pd.h" #endif // File local variables extern uint32_t currentTempTargetDegC; @@ -797,6 +799,82 @@ void showDebugMenu(void) { } } +#if POW_PD +#ifdef HAS_POWER_DEBUG_MENU +static void showPDDebug(void) { + // Print out the USB-PD state + // Basically this is like the Debug menu, but instead we want to print out the PD status + uint8_t screen = 0; + ButtonState b; + for (;;) { + OLED::clearScreen(); // Ensure the buffer starts clean + OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left) + OLED::print(SymbolPDDebug, FontStyle::SMALL); // Print Title + OLED::setCursor(0, 8); // second line + if (screen == 0) { + // Print the PD state machine + OLED::print(SymbolState, FontStyle::SMALL); + OLED::print(SymbolSpace, FontStyle::SMALL); + OLED::printNumber(USBPowerDelivery::getStateNumber(), 2, FontStyle::SMALL, true); + OLED::print(SymbolSpace, FontStyle::SMALL); + // Also print vbus mod status + if (USBPowerDelivery::fusbPresent()) { + if (USBPowerDelivery::negotiationComplete() || (xTaskGetTickCount() > (TICKS_SECOND * 10))) { + if (!USBPowerDelivery::isVBUSConnected()) { + OLED::print(SymbolNoVBus, FontStyle::SMALL); + } else { + OLED::print(SymbolVBus, FontStyle::SMALL); + } + } + } + } else { + // Print out the Proposed power options one by one + auto lastCaps = USBPowerDelivery::getLastSeenCapabilities(); + uint8_t numobj = PD_NUMOBJ_GET(lastCaps); + if ((screen - 1) < numobj) { + int voltage_mv = 0; + int min_voltage = 0; + int current_a_x100 = 0; + if ((lastCaps->obj[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_FIXED) { + voltage_mv = PD_PDV2MV(PD_PDO_SRC_FIXED_VOLTAGE_GET(lastCaps->obj[screen - 1])); // voltage in mV units + current_a_x100 = PD_PDO_SRC_FIXED_CURRENT_GET(lastCaps->obj[screen - 1]); // current in 10mA units + } else { + voltage_mv = PD_PAV2MV(PD_APDO_PPS_MAX_VOLTAGE_GET(lastCaps->obj[screen - 1])); + min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCaps->obj[screen - 1])); + current_a_x100 = PD_PAI2CA(PD_APDO_PPS_CURRENT_GET(lastCaps->obj[screen - 1])); // max current in 10mA units + } + // print out this entry of the proposal + OLED::printNumber(screen, 1, FontStyle::SMALL, true); // print the entry number + OLED::print(SymbolSpace, FontStyle::SMALL); + if (min_voltage > 0) { + OLED::printNumber(min_voltage / 1000, 2, FontStyle::SMALL, true); // print the voltage + OLED::print(SymbolMinus, FontStyle::SMALL); + } + OLED::printNumber(voltage_mv / 1000, 2, FontStyle::SMALL, true); // print the voltage + OLED::print(SymbolVolts, FontStyle::SMALL); + OLED::print(SymbolSpace, FontStyle::SMALL); + OLED::printNumber(current_a_x100 / 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res + OLED::print(SymbolDot, FontStyle::SMALL); + OLED::printNumber(current_a_x100 % 10, 1, FontStyle::SMALL, true); // print the current in 0.1A res + OLED::print(SymbolAmps, FontStyle::SMALL); + + } else { + screen = 0; + } + } + + OLED::refresh(); + b = getButtonState(); + if (b == BUTTON_B_SHORT) + return; + else if (b == BUTTON_F_SHORT) { + screen++; + } + GUIDelay(); + } +} +#endif +#endif void showWarnings() { // Display alert if settings were reset if (settingsWereReset) { @@ -860,7 +938,14 @@ void startGUITask(void const *argument) { } getTipRawTemp(1); // reset filter OLED::setRotation(getSettingValue(SettingsOptions::OrientationMode) & 1); - + // If the front button is held down, on supported devices, show PD debugging metrics +#if POW_PD +#ifdef HAS_POWER_DEBUG_MENU + if (getButtonA()) { + showPDDebug(); + } +#endif +#endif BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); showWarnings(); From 943d6bf0bd85e6631cdb7b471893c1432f462866 Mon Sep 17 00:00:00 2001 From: Federico Di Lorenzo <68966053+federicodilo@users.noreply.github.com> Date: Sun, 3 Apr 2022 12:04:59 +0200 Subject: [PATCH 03/37] Symbols change (#1274) * Costants change Changing to lowercase for two reasons: - Disambiguation with LiPos options - In the SI the symbol for seconds is s (while for minutes is min but doesn't really matter) * Update translation_BE.json * Update translation_BG.json * Update translation_CS.json * Update translation_DA.json * Update translation_DE.json * Update translation_EL.json * Update translation_EN.json * Update translation_ES.json * Update translation_FI.json * Update translation_FR.json * Update translation_HR.json * Update translation_HU.json * Update translation_IT.json * Update translation_JA_JP.json * Update translation_LT.json * Update translation_NL.json * Update translation_NL_BE.json * Update translation_NO.json * Update translation_PL.json * Update translation_PT.json * Update translation_RO.json * Update translation_RU.json * Update translation_SK.json * Update translation_SL.json * Update translation_SR_CYRL.json * Update translation_SR_LATN.json * Update translation_SV.json * Update translation_TR.json * Update translation_UK.json * Update translation_VI.json * Update translation_YUE_HK.json * Update translation_ZH_CN.json * Update translation_ZH_TW.json --- Translations/make_translation.py | 4 ++-- Translations/translation_BE.json | 2 +- Translations/translation_BG.json | 2 +- Translations/translation_CS.json | 2 +- Translations/translation_DA.json | 2 +- Translations/translation_DE.json | 6 +++--- Translations/translation_EL.json | 2 +- Translations/translation_EN.json | 6 +++--- Translations/translation_ES.json | 2 +- Translations/translation_FI.json | 6 +++--- Translations/translation_FR.json | 6 +++--- Translations/translation_HR.json | 2 +- Translations/translation_HU.json | 2 +- Translations/translation_IT.json | 2 +- Translations/translation_JA_JP.json | 6 +++--- Translations/translation_LT.json | 2 +- Translations/translation_NL.json | 2 +- Translations/translation_NL_BE.json | 2 +- Translations/translation_NO.json | 2 +- Translations/translation_PL.json | 2 +- Translations/translation_PT.json | 2 +- Translations/translation_RO.json | 6 +++--- Translations/translation_RU.json | 2 +- Translations/translation_SK.json | 4 ++-- Translations/translation_SL.json | 6 +++--- Translations/translation_SR_CYRL.json | 6 +++--- Translations/translation_SR_LATN.json | 6 +++--- Translations/translation_SV.json | 4 ++-- Translations/translation_TR.json | 2 +- Translations/translation_UK.json | 2 +- Translations/translation_VI.json | 6 +++--- Translations/translation_YUE_HK.json | 6 +++--- Translations/translation_ZH_CN.json | 6 +++--- Translations/translation_ZH_TW.json | 6 +++--- 34 files changed, 63 insertions(+), 63 deletions(-) diff --git a/Translations/make_translation.py b/Translations/make_translation.py index af12a56e..c2c61590 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -102,8 +102,8 @@ def get_constants(build_version: str) -> List[Tuple[str, str]]: ("SymbolDot", "."), ("SymbolDegC", "C"), ("SymbolDegF", "F"), - ("SymbolMinutes", "M"), - ("SymbolSeconds", "S"), + ("SymbolMinutes", "m"), + ("SymbolSeconds", "s"), ("SymbolWatts", "W"), ("SymbolVolts", "V"), ("SymbolAmps", "A"), diff --git a/Translations/translation_BE.json b/Translations/translation_BE.json index 1217b99b..0270833a 100644 --- a/Translations/translation_BE.json +++ b/Translations/translation_BE.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_BG.json b/Translations/translation_BG.json index 501c3aca..5e3380e5 100644 --- a/Translations/translation_BG.json +++ b/Translations/translation_BG.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_CS.json b/Translations/translation_CS.json index 087cd479..4f5a53be 100644 --- a/Translations/translation_CS.json +++ b/Translations/translation_CS.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_DA.json b/Translations/translation_DA.json index 7f1b8c5c..8a42e907 100644 --- a/Translations/translation_DA.json +++ b/Translations/translation_DA.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index 2aada270..7f175344 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Ruhever-", "zögerung"], - "desc": "Dauer vor Übergang in den Ruhemodus (S=Sekunden | M=Minuten)" + "desc": "Dauer vor Übergang in den Ruhemodus (s=Sekunden | m=Minuten)" }, "ShutdownTimeout": { "text2": ["Abschalt-", "verzög."], - "desc": "Dauer vor automatischer Abschaltung (M=Minuten)" + "desc": "Dauer vor automatischer Abschaltung (m=Minuten)" }, "MotionSensitivity": { "text2": ["Bewegungs-", "empfindlichk."], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Startlogo-", "dauer"], - "desc": "Legt die Dauer der Anzeige des Startlogos fest (S=Sekunden)" + "desc": "Legt die Dauer der Anzeige des Startlogos fest (s=Sekunden)" } } } diff --git a/Translations/translation_EL.json b/Translations/translation_EL.json index 66fcb3e6..88c64366 100644 --- a/Translations/translation_EL.json +++ b/Translations/translation_EL.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_EN.json b/Translations/translation_EN.json index a5554111..8e570a5f 100644 --- a/Translations/translation_EN.json +++ b/Translations/translation_EN.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Sleep", "timeout"], - "desc": "Interval before \"sleep mode\" kicks in (S=seconds | M=minutes)" + "desc": "Interval before \"sleep mode\" kicks in (s=seconds | m=minutes)" }, "ShutdownTimeout": { "text2": ["Shutdown", "timeout"], - "desc": "Interval before the iron shuts down (M=minutes)" + "desc": "Interval before the iron shuts down (m=minutes)" }, "MotionSensitivity": { "text2": ["Motion", "sensitivity"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_ES.json b/Translations/translation_ES.json index e959479a..448865ad 100644 --- a/Translations/translation_ES.json +++ b/Translations/translation_ES.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_FI.json b/Translations/translation_FI.json index 51ea7e83..32f9a413 100644 --- a/Translations/translation_FI.json +++ b/Translations/translation_FI.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Lepotilan", "viive"], - "desc": "\"Lepotilan\" ajastus (S=sekuntia | M=minuuttia)" + "desc": "\"Lepotilan\" ajastus (s=sekuntia | m=minuuttia)" }, "ShutdownTimeout": { "text2": ["Sammutus", "viive"], - "desc": "Automaattisen sammutuksen ajastus (M=minuuttia)" + "desc": "Automaattisen sammutuksen ajastus (m=minuuttia)" }, "MotionSensitivity": { "text2": ["Liikkeen", "herkkyys"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_FR.json b/Translations/translation_FR.json index d40c0c3e..37c7d0e3 100644 --- a/Translations/translation_FR.json +++ b/Translations/translation_FR.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Délai", "veille"], - "desc": "Délai avant mise en veille (S=secondes | M=minutes)" + "desc": "Délai avant mise en veille (s=secondes | m=minutes)" }, "ShutdownTimeout": { "text2": ["Délai", "extinction"], - "desc": "Délai avant extinction (M=minutes)" + "desc": "Délai avant extinction (m=minutes)" }, "MotionSensitivity": { "text2": ["Sensibilité", "au mouvement"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_HR.json b/Translations/translation_HR.json index 6971723c..8756579f 100644 --- a/Translations/translation_HR.json +++ b/Translations/translation_HR.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_HU.json b/Translations/translation_HU.json index e4dcaef2..43d3b5af 100644 --- a/Translations/translation_HU.json +++ b/Translations/translation_HU.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index 58a04493..12edf605 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -77,7 +77,7 @@ }, "SleepTimeout": { "text2": ["Timer", "riposo"], - "desc": "Imposta il timer per entrare in modalità Riposo [minuti/secondi]" + "desc": "Imposta il timer per entrare in modalità Riposo [secondi/minuti]" }, "ShutdownTimeout": { "text2": ["Timer", "spegnimento"], diff --git a/Translations/translation_JA_JP.json b/Translations/translation_JA_JP.json index ad07bda5..ce1f9b9c 100755 --- a/Translations/translation_JA_JP.json +++ b/Translations/translation_JA_JP.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": "待機遅延", - "desc": "スタンバイモードに入るまでの待機時間 " + "desc": "スタンバイモードに入るまでの待機時間 " }, "ShutdownTimeout": { "text2": "自動オフ", - "desc": "自動電源オフまでの待機時間 " + "desc": "自動電源オフまでの待機時間 " }, "MotionSensitivity": { "text2": "動きの感度", @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_LT.json b/Translations/translation_LT.json index c7fe020d..f1548cc9 100644 --- a/Translations/translation_LT.json +++ b/Translations/translation_LT.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index bc9172cd..2538ac49 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_NL_BE.json b/Translations/translation_NL_BE.json index c8a3aa57..40c878ab 100644 --- a/Translations/translation_NL_BE.json +++ b/Translations/translation_NL_BE.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_NO.json b/Translations/translation_NO.json index 5da114a5..a4e2d705 100644 --- a/Translations/translation_NO.json +++ b/Translations/translation_NO.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_PL.json b/Translations/translation_PL.json index ad55b4cc..8ad1deb6 100644 --- a/Translations/translation_PL.json +++ b/Translations/translation_PL.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_PT.json b/Translations/translation_PT.json index d898e02d..56050947 100644 --- a/Translations/translation_PT.json +++ b/Translations/translation_PT.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_RO.json b/Translations/translation_RO.json index 5d4dd1f8..ea7f3e40 100644 --- a/Translations/translation_RO.json +++ b/Translations/translation_RO.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Expirare", "repaus"], - "desc": "Interval înainte de lansarea \"modului de repaus\" în (S=secunde | M=minute)" + "desc": "Interval înainte de lansarea \"modului de repaus\" în (s=secunde | m=minute)" }, "ShutdownTimeout": { "text2": ["Expirare", "oprire"], - "desc": "Interval înainte ca letconul să se oprească (M=minute)" + "desc": "Interval înainte ca letconul să se oprească (m=minute)" }, "MotionSensitivity": { "text2": ["Sensibilitate", "la mişcare"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index c205bdef..1d418689 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_SK.json b/Translations/translation_SK.json index 2baf818f..5e1c02a0 100644 --- a/Translations/translation_SK.json +++ b/Translations/translation_SK.json @@ -77,7 +77,7 @@ }, "SleepTimeout": { "text2": ["Pokojový", "režim po"], - "desc": "Pokojový režim po (S=sekundách | M=minútach)" + "desc": "Pokojový režim po (s=sekundách | m=minútach)" }, "ShutdownTimeout": { "text2": ["Vypnutie", "po"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_SL.json b/Translations/translation_SL.json index 9320b62f..c8403612 100644 --- a/Translations/translation_SL.json +++ b/Translations/translation_SL.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Čas do", "spanja"], - "desc": "Čas pred spanjem (S=sekunde | M=minute)" + "desc": "Čas pred spanjem (s=sekunde | m=minute)" }, "ShutdownTimeout": { "text2": ["Čas do", "izklopa"], - "desc": "Čas do izklopa (M=minute)" + "desc": "Čas do izklopa (m=minute)" }, "MotionSensitivity": { "text2": ["Občutljivost", "premikanja"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_SR_CYRL.json b/Translations/translation_SR_CYRL.json index d50c7f54..61fb34f9 100644 --- a/Translations/translation_SR_CYRL.json +++ b/Translations/translation_SR_CYRL.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Време до", "спавања"], - "desc": "Време мировања након кога лемилица спушта температуру. (M=минути | S=секунде)" + "desc": "Време мировања након кога лемилица спушта температуру. (m=минути | s=секунде)" }, "ShutdownTimeout": { "text2": ["Време до", "гашења"], - "desc": "Време мировања након кога се лемилица гаси. (M=минути)" + "desc": "Време мировања након кога се лемилица гаси. (m=минути)" }, "MotionSensitivity": { "text2": ["Осетљивост", "на покрет"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_SR_LATN.json b/Translations/translation_SR_LATN.json index cef6a788..64660bd7 100644 --- a/Translations/translation_SR_LATN.json +++ b/Translations/translation_SR_LATN.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Vreme do", "spavanja"], - "desc": "Vreme mirovanja nakon koga lemilica spušta temperaturu. (M=minuti | S=sekunde)" + "desc": "Vreme mirovanja nakon koga lemilica spušta temperaturu. (m=minuti | s=sekunde)" }, "ShutdownTimeout": { "text2": ["Vreme do", "gašenja"], - "desc": "Vreme mirovanja nakon koga se lemilica gasi. (M=minuti)" + "desc": "Vreme mirovanja nakon koga se lemilica gasi. (m=minuti)" }, "MotionSensitivity": { "text2": ["Osetljivost", "na pokret"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_SV.json b/Translations/translation_SV.json index e22c4734..dbbb0c9e 100644 --- a/Translations/translation_SV.json +++ b/Translations/translation_SV.json @@ -77,7 +77,7 @@ }, "SleepTimeout": { "text2": ["Vilo-", "timeout"], - "desc": "Vilo-timeout (M=Minuter | S=Sekunder)" + "desc": "Vilo-timeout (m=Minuter | s=Sekunder)" }, "ShutdownTimeout": { "text2": ["Avstängn.", "timeout"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_TR.json b/Translations/translation_TR.json index 2d65ae7d..2e49b4fe 100644 --- a/Translations/translation_TR.json +++ b/Translations/translation_TR.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_UK.json b/Translations/translation_UK.json index a476a527..6e516937 100644 --- a/Translations/translation_UK.json +++ b/Translations/translation_UK.json @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_VI.json b/Translations/translation_VI.json index 0b4c530c..dae2e8dd 100644 --- a/Translations/translation_VI.json +++ b/Translations/translation_VI.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": ["Ngu", "sau"], - "desc": "- thoi gian truoc khi \"Che đo ngu\" bat đau (S=giây | M=phút)" + "desc": "- thoi gian truoc khi \"Che đo ngu\" bat đau (s=giây | m=phút)" }, "ShutdownTimeout": { "text2": ["Tat", "sau"], - "desc": "- khoang thoi gian truoc khi tay hàn tat (M=phút)" + "desc": "- khoang thoi gian truoc khi tay hàn tat (m=phút)" }, "MotionSensitivity": { "text2": ["Cam bien", "cu đong"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_YUE_HK.json b/Translations/translation_YUE_HK.json index faee8327..30f5c267 100644 --- a/Translations/translation_YUE_HK.json +++ b/Translations/translation_YUE_HK.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": "待機延時", - "desc": "自動進入待機模式前嘅閒置等候時間 " + "desc": "自動進入待機模式前嘅閒置等候時間 " }, "ShutdownTimeout": { "text2": "自動熄機", - "desc": "自動熄機前嘅閒置等候時間 " + "desc": "自動熄機前嘅閒置等候時間 " }, "MotionSensitivity": { "text2": "動作敏感度", @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_ZH_CN.json b/Translations/translation_ZH_CN.json index 3d4edc2c..2b378f17 100644 --- a/Translations/translation_ZH_CN.json +++ b/Translations/translation_ZH_CN.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": "待机超时", - "desc": "自动进入待机模式前的等候时间 " + "desc": "自动进入待机模式前的等候时间 " }, "ShutdownTimeout": { "text2": "自动关机", - "desc": "自动关机前的等候时间 " + "desc": "自动关机前的等候时间 " }, "MotionSensitivity": { "text2": "动作灵敏度", @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } diff --git a/Translations/translation_ZH_TW.json b/Translations/translation_ZH_TW.json index 167d89df..20219857 100644 --- a/Translations/translation_ZH_TW.json +++ b/Translations/translation_ZH_TW.json @@ -77,11 +77,11 @@ }, "SleepTimeout": { "text2": "待機延時", - "desc": "自動進入待機模式前的閒置等候時間 " + "desc": "自動進入待機模式前的閒置等候時間 " }, "ShutdownTimeout": { "text2": "自動關機", - "desc": "自動關機前的閒置等候時間 " + "desc": "自動關機前的閒置等候時間 " }, "MotionSensitivity": { "text2": "動作敏感度", @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (S=seconds)" + "desc": "Sets the duration for the boot logo (s=seconds)" } } } From d1d403376f796fbf3077e4752435be147ddb68a5 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Mon, 4 Apr 2022 13:05:18 +1000 Subject: [PATCH 04/37] Fix typo in PD info screen --- source/Core/Threads/GUIThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index d53cd303..822b34b6 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -855,7 +855,7 @@ static void showPDDebug(void) { OLED::print(SymbolSpace, FontStyle::SMALL); OLED::printNumber(current_a_x100 / 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res OLED::print(SymbolDot, FontStyle::SMALL); - OLED::printNumber(current_a_x100 % 10, 1, FontStyle::SMALL, true); // print the current in 0.1A res + OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res OLED::print(SymbolAmps, FontStyle::SMALL); } else { From 55903020e978c477f4f1696b771075fc154b12d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 12:09:38 +0000 Subject: [PATCH 05/37] chore(deps): bump actions/upload-artifact from 2 to 3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index af740198..7aa18e65 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -32,7 +32,7 @@ jobs: cp LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md - name: Archive ${{ matrix.model }} artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ matrix.model }} path: | @@ -46,7 +46,7 @@ jobs: run: cd source && python3 metadata.py ${{ matrix.model }}.json - name: Archive ${{ matrix.model }} index file - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: metadata path: source/Hexfile/${{ matrix.model }}.json @@ -79,7 +79,7 @@ jobs: cp LICENSE_RELEASE.md source/Hexfile/LICENSE_RELEASE.md - name: Archive ${{ matrix.model }} artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ matrix.model }}_multi-lang path: | @@ -93,7 +93,7 @@ jobs: run: cd source && python3 metadata.py Pinecil_multi-lang.json - name: Archive ${{ matrix.model }} index file - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: metadata path: source/Hexfile/Pinecil_multi-lang.json From 1b562c646697cd9ab4d59ffa955db5caac0ccd1d Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Tue, 19 Apr 2022 09:20:53 +1000 Subject: [PATCH 06/37] Update version.h --- source/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/version.h b/source/version.h index 1165ac64..2d4e10b1 100644 --- a/source/version.h +++ b/source/version.h @@ -4,4 +4,4 @@ * i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4' */ -#define BUILD_VERSION "v2.17" +#define BUILD_VERSION "v2.18" From 70565de2e528d9c0ef2e1a5e1045d22ae6304693 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Tue, 19 Apr 2022 09:24:40 +1000 Subject: [PATCH 07/37] Update push for git permissions https://github.com/actions/checkout/issues/760 --- .github/workflows/push.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 7aa18e65..9c1eb85b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -22,6 +22,9 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + + - name: Git ownership exception + run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE" - name: build ${{ matrix.model }} run: cd source && ./build.sh -m ${{ matrix.model }} @@ -69,7 +72,10 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - + + - name: Git ownership exception + run: git config --global --add safe.directory /__w/IronOS/IronOS && git config --global safe.directory "$GITHUB_WORKSPACE" + - name: build ${{ matrix.model }} run: cd source && make -j$(nproc) model="${{ matrix.model }}" firmware-multi_compressed_European firmware-multi_compressed_Bulgarian+Russian+Serbian+Ukrainian firmware-multi_Chinese+Japanese From 9b66f60b255f3914b0c2b6a78707c7eb6cf564a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:23:15 +0200 Subject: [PATCH 08/37] Update docs with new Miniware DFU bootloader --- Documentation/Flashing.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Documentation/Flashing.md b/Documentation/Flashing.md index de27e56c..21d0e1bc 100644 --- a/Documentation/Flashing.md +++ b/Documentation/Flashing.md @@ -226,7 +226,6 @@ If you are on Windows, it's often best to try another computer (friends, work, p If you are an advanced user, and you have used `usb-dfu` tools before, or you would like to learn; there is an alternative bootloader for these irons. This will **NOT** show up as a USB storage drive, but instead show up using a standard DFU protocol device. You can then use dfu tools or GUI's to upgrade the iron using the `.bin` files that are posted to the releases page. -To change to dapboot based alternative bootloader, you need to flash the hex file from [here](https://github.com/eDesignOSS/ts100-bl-flasher/releases). -`ts100-stockbl.hex` will reflash the stock bootloader, `ts100-dapboot.hex` will flash the new dapboot based usb bootloader. +To install this alternative bootloader, follow the instructions [here](https://github.com/Ralim/IronOS-dfu/blob/mainline/docs/Bootloader.md). Note that this is only recommended for users who know what they are doing. If you don't understand how this works, please don't flash this. From 3f98b2d1111b3c4923d8406273ea71266788a12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:40:23 +0200 Subject: [PATCH 09/37] Typo fixes Flashing.md --- Documentation/Flashing.md | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Documentation/Flashing.md b/Documentation/Flashing.md index de27e56c..40b81794 100644 --- a/Documentation/Flashing.md +++ b/Documentation/Flashing.md @@ -11,7 +11,7 @@ These are built on every change and can be found on the Actions tab (see below). ### Main release Main releases are made to the [releases page](https://github.com/Ralim/IronOS/releases). -Download the zip file that matches your model of soldering iron, and extract it. +Download the zip file that matches your model of soldering iron and extract it. Select the appropriate file type for your unit, in general Miniware devices need `.hex` and Pinecil needs `.dfu`. Flash according to details below @@ -31,7 +31,7 @@ This is completely safe, but if it goes wrong just put the `.hex` file from the Officially the bootloader on the devices only works under Windows (use the built-in File Explorer, as alternative file managers or copy handlers like Teracopy will fail). However, users have reported that it does work under Mac, and can be made to work under Linux _sometimes_. Details over on the [wiki page](https://github.com/Ralim/ts100/wiki/Upgrading-Firmware). 1. Hold the button closest to the tip (MHP30 the left button on the back), and plug in the USB to the computer. -2. The unit will appear as a USB drive. ( Screen will say `DFU` on it.) +2. The unit will appear as a USB drive. (Screen will say `DFU` on it.) 3. Drag the `.hex` file onto the USB drive. 4. The unit will disconnect and reconnect. 5. The filename will have changed to end in *.RDY* or *.ERR* @@ -90,11 +90,11 @@ Check the extension of your firmware, it should be `.RDY` now. # Pinecil (Pine64) - The MCU used in Pinecil supports usb-dfu. Reference [Pinecil Wiki](https://wiki.pine64.org/wiki/Pinecil). -- Recommended Updater: the [Pine64 Updater](https://github.com/pine64/pinecil-firmware-updater/releases), is an easy-to-use GUI app. It is fast and works in several types of OS, i.e. Windows/Mac. It will automatically fetch the newest stable version of IronOS from Github. +- Recommended Updater: the [Pine64 Updater](https://github.com/pine64/pinecil-firmware-updater/releases), is an easy-to-use GUI app. It is fast and works in several types of OS, i.e. Windows/Mac. It will automatically fetch the newest stable version of IronOS from GitHub. - Troubleshooting: if you have issues using the Pine64 Updater or your install fails, please go to troubleshooting tips below. - Community chat: if troubleshooting doesn't work, then join the Pine64 > Pinecil channel. There are knowledgeable members in Discord/Telegram/Matrix. Discord has a bridge bot connection to Telegram and Matrix so that all pine volunteers/members can see advice for Pinecil and related items or just get tips on which Power supply to purchase. -- One advantage of Pinecil is that you can not permanently damage it doing a firmware update (because DFU is in ROM); an update could render Pinecil temporarily inoperable if you flash an invalid firmware. But no worries, simply re-flashing with a working firmware copy will fix everything. -- USB-C cable is required to do an update. Generally, all USB controllers work, but some hubs have issues so it is preferred to avoid USB hubs for updates. +- One advantage of Pinecil is that you cannot permanently damage it doing a firmware update (because DFU is in ROM); an update could render Pinecil temporarily inoperable if you flash an invalid firmware. But no worries, simply re-flashing with a working firmware copy will fix everything. +- USB-C cable is required to do an update. Generally, all USB controllers work, but some hubs have issues, so it is preferred to avoid USB hubs for updates. - Alternate Update Methods: if your OS is not currently supported by the [Updater](https://github.com/pine64/pinecil-firmware-updater/releases) or it does not meet your needs, i.e., you want to install a beta version, the below manual methods may be used. ## Linux and Mac @@ -103,7 +103,7 @@ Check the extension of your firmware, it should be `.RDY` now. ⛔ Do not use the DC power jack while updating firmware or you may destroy your PC. ⛔ -1. Download and extract the firmware package from Github [IronOS Releases](https://github.com/Ralim/IronOS/releases). +1. Download and extract the firmware package from GitHub [IronOS Releases](https://github.com/Ralim/IronOS/releases). 2. Highly recommend updating `dfu-util` to the newest version. 3. Enter DFU mode: press and hold (-) button at the back of the iron (do not release). 4. Connect USB to PC, and USB-C to back of Pinecil, keep holding (-) button down. @@ -115,7 +115,7 @@ Check the extension of your firmware, it should be `.RDY` now. dfu-util -D Pinecil_EN.dfu ``` -Choose the file name from the folder with the appropriate 2-letter country code for your chosen language (i.e, EN = English). +Choose the file name from the folder with the appropriate 2-letter country code for your chosen language (i.e., EN = English). ### Troubleshooting: - If you get a message stating that `More than one DFU capable USB device found!` when running the above command you probably have an old version of `dfu-util` installed. Might be worth updating. You can still install on the old version, but you will have to specify which DFU interface to flash to. Running the command `dfu-util -l` will show you if there are several DFU devices detected. Example: @@ -129,10 +129,10 @@ dfu-util -D Pinecil_EN.dfu -a 0 ``` - Note: if you use an older release of `dfu-util` and do not see `alt=0, name="@Internal Flash /0x08000000/128*001Kg"` when running `dfu-util -l` you likely will not be able to update without first updating 'dfu-util'. - If your update is crashing part-way into the update, there is sometimes an issue with older/fussy USB controllers (they can show up/disappear/then show up again) - - Try a direct connection to the USB port, do not use a USB hub, and use shorter cable. If possible pick a port connected to the main board. + - Try a direct connection to the USB port, do not use a USB hub, and use shorter cable. If possible, pick a port connected to the main board. - Switch to a different PC/Laptop and use different ports. USB-C ports are recommended but some have also reported having a fussy C port. - Hold down the (-) button for the entire firmware update, do not release until near the end. -- `DC Low` message: a pc/laptop can not fully power pinecil, it generally can only get 5 V (non-PD) to communicate for firmware updates and Pinecil will report 'DC Low'. This is normal. +- `DC Low` message: a pc/laptop cannot fully power Pinecil, it generally can only get 5 V (non-PD) to communicate for firmware updates and Pinecil will report 'DC Low'. This is normal. ## Windows @@ -147,7 +147,7 @@ Two Options for Windows 1. Using command line `dfu-util` is similar to above for Linux / Mac. 2. Highly recommend updating `dfu-util` to the newest version. -3. Download and extract the firmware package from Github [IronOS Releases](https://github.com/Ralim/IronOS/releases). +3. Download and extract the firmware package from GitHub [IronOS Releases](https://github.com/Ralim/IronOS/releases). 4. Enter DFU mode: press and hold (-) button at the back of the iron (do not release). 5. Connect USB to PC, and USB-C to the back of Pinecil, keep holding (-) button down. 6. Screen will stay **black/off** to indicate the Pinecil is in DFU mode. This is normal. @@ -162,14 +162,14 @@ dfu-util -D Pinecil_EN.dfu - If you have errors, see Troubleshooting [above](/Documentation/Flashing.md#troubleshooting). -### Option 2: use the gui tool from chip vendor +### Option 2: use the GUI tool from chip vendor ### Steps ⛔ Do not use the DC power jack while updating firmware or you may destroy your PC. ⛔ -1. If you are uncomfortable with the command line, then this chip vendor supplied gui tool/drivers is an option. -2. Download and extract the firmware package from Github [IronOS Releases](https://github.com/Ralim/IronOS/releases). +1. If you are uncomfortable with the command line, then this chip vendor supplied GUI tool/drivers is an option. +2. Download and extract the firmware package from GitHub [IronOS Releases](https://github.com/Ralim/IronOS/releases). 3. Download both the `GD32 MCU DFU TOOL` and the `GD32 Dfu Drivers`. - GD32 DFU Tool [here](http://www.gd32mcu.com/en/download?kw=GD32+MCU+Dfu+Tool&lan=en). If the link breaks, search for "GD32 MCU Dfu Tool" at this [link](http://www.gd32mcu.com/en/download/). - GD32 DFU Drivers [here](http://www.gd32mcu.com/en/download?kw=GD32+Dfu+Drivers&lan=en). If the link breaks, search for "GD32 Dfu Drivers" at this [link](http://www.gd32mcu.com/en/download/). @@ -179,15 +179,15 @@ dfu-util -D Pinecil_EN.dfu 6. Connect Pinecil to a PC via USB cable (do not release the (-) yet). 7. Screen will stay **black/off** to indicate the Pinecil is in DFU mode. This is normal. 8. You may hear a beep from Windows as it connects to Pinecil in DFU mode. -9. If you see windows notification that it `does not recognize Usb device`, then you didn't connect, repeat step 3-8. +9. If you see windows notification that it `does not recognize USB device`, then you didn't connect, repeat step 3-8. 10. Open the GD32 DFU Tool (ignore prompts to update tool). 11. At the top of the DFU tool, you should see `GD DFU DEVICE 1` appear if you successfully connected Pinecil. 12. If DFU Device box at top is blank, then Pinecil is not connected in DFU mode, repeat steps 3-11. 13. If it has been more than 10 seconds since you connected the USB cable, Release the (-) button. (don't use Upload from Device section) -14. Select `Download to device` > Open > Browse to folder dyou unziped in step 2. -15. Select the `hex` file for language. English is Pinecil_EN.hex , tick `Verify after download`. -16. Click `OK` at bottom. After a few minutes you will see 0-100%, Download successfully! Click `Leave DFU` at the top. -17. Disconnect pinecil cable from PC, plug it into a power supply. +14. Select `Download to device` > Open > Browse to folder you unzipped in step 2. +15. Select the `hex` file for language. English is Pinecil_EN.hex , tick `Verify after download`. +16. Click `OK` at bottom. After a few minutes you will see 0-100%, Download successfully! Click `Leave DFU` at the top. +17. Disconnect Pinecil cable from PC, plug it into a power supply. 18. Do not need to press any buttons, a new screen should appear. 19. To confirm upgrade, hold the minus (-) button down for a few seconds, it then shows new firmware version v2.xx.x....date @@ -213,18 +213,18 @@ First, try just copying the file a second time. If this fails and you are on Mac or Linux reading the wiki page about programming can help. There is also a very long issue thread going through all of the different attempts around this too. -If you are on Windows, it's often best to try another computer (friends, work, partners etc). +If you are on Windows, it's often best to try another computer (friends, work, partners etc.). #### [Miniware] Device randomly disconnects or does not show up in DFU mode -1. Check if the USB cable you are using has the data pins; test it on another device. There are a surprisingly large number of usb-micro cables that are power _only_. +1. Check if the USB cable you are using has the data pins; test it on another device. There are a surprisingly large number of micro-USB cables that are power _only_. -2. Try other USB ports. Often different USB controllers will interact with the units differently due to design quirks in the miniware design. +2. Try other USB ports. Often different USB controllers will interact with the units differently due to design quirks in the Miniware design. ### [Miniware] Alternative bootloader If you are an advanced user, and you have used `usb-dfu` tools before, or you would like to learn; there is an alternative bootloader for these irons. -This will **NOT** show up as a USB storage drive, but instead show up using a standard DFU protocol device. You can then use dfu tools or GUI's to upgrade the iron using the `.bin` files that are posted to the releases page. +This will **NOT** show up as a USB storage drive, but instead show up using a standard DFU protocol device. You can then use dfu tools or GUIs to upgrade the iron using the `.bin` files that are posted to the releases page. To change to dapboot based alternative bootloader, you need to flash the hex file from [here](https://github.com/eDesignOSS/ts100-bl-flasher/releases). `ts100-stockbl.hex` will reflash the stock bootloader, `ts100-dapboot.hex` will flash the new dapboot based usb bootloader. From c1ebc869ca3496c96fe238496a64062c5251cbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:43:38 +0200 Subject: [PATCH 10/37] Typo fixes in DebugMenu.md --- Documentation/DebugMenu.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/DebugMenu.md b/Documentation/DebugMenu.md index a4e34826..3408f26d 100644 --- a/Documentation/DebugMenu.md +++ b/Documentation/DebugMenu.md @@ -5,7 +5,7 @@ This is accessed by holding the rear (-/B) button on the iron while it is on the This menu is meant to be simple, so it has no fancy GUI animations. -To move through the menu use the front (+/A) button. +To move through the menu, use the front (+/A) button. To exit, use the rear (-/B) button again. ## Menu items @@ -31,8 +31,8 @@ This just shows how many deciseconds the unit has been powered for. ### Move -This is the last timestamp of movement. When the iron is moved this should update to match the time field (one before in the menu). -This can be used for checking performance of the movement dection code. +This is the last timestamp of movement. When the iron is moved, this should update to match the time field (one before in the menu). +This can be used for checking performance of the movement detection code. ### RTip @@ -74,12 +74,12 @@ This may change during power up as the sources are negotiated in turn. - **PD W. VBus** input (We used the PD subsystem to negotiate for the current supply); and VBus is connected to your input power source - **PD No VBus** input (We used the PD subsystem to negotiate for the current supply); and VBus is **NOT** connected to your input power source - If you successfully modified the Pinecil to support 24 V by cutting the trace line to Vbus, then 'PD No VBus' displays on screen. -- Connect to any PD USB power to check Vbus status. It will not show any PD message when Pinecil is powered by DC port, QC, or USB 5 V (non PD). +- Connect to any PD USB power to check Vbus status. It will not show any PD message when Pinecil is powered by DC port, QC, or USB 5 V (non-PD). ### Max This indicates the max temperature in degrees Celsius that the system estimates it can measure the tip reliably to. -This is dependant on a few factors including the handle temperature so it can move around during use. +This is dependent on a few factors including the handle temperature so it can move around during use. ### Hall From dafde85a4b56312d820d3672b83554d1009b01f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:45:44 +0200 Subject: [PATCH 11/37] Typo fixes in Development.md --- Documentation/Development.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Development.md b/Documentation/Development.md index 1a60f781..f59779cf 100644 --- a/Documentation/Development.md +++ b/Documentation/Development.md @@ -94,11 +94,11 @@ To build a release instead, run the `build.sh` script. This will update translat ## Updating languages To update the language translation files and their associated font maps, execute the `make_translation.py` code from the `Translations` directory. -If you edit the translation definitions or the english translation, please also run `gen_menu_docs.py` to update the settings menu documentation automatically. +If you edit the translation definitions or the English translation, please also run `gen_menu_docs.py` to update the settings menu documentation automatically. ## Building Pinecil I highly recommend using the command line tools and using Docker to run the compiler. -It's a bit more fussy on setup than the STM tooling, and this is by far the easiest way. +It's a bit fussier on setup than the STM tooling, and this is by far the easiest way. If you _need_ an IDE I have used [Nuclei's IDE](https://nucleisys.com/download.php). Follow the same idea as the STM Cube IDE notes above. From d5af6447e33ec583a6003021185abe4a07ccc121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:50:22 +0200 Subject: [PATCH 12/37] Typo fix in Hardware.md --- Documentation/Hardware.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Hardware.md b/Documentation/Hardware.md index 15454b31..7341eb5c 100644 --- a/Documentation/Hardware.md +++ b/Documentation/Hardware.md @@ -5,4 +5,4 @@ - Accelerometer is the MSA301, this is mounted roughly in the middle of the unit - USB-PD is using the FUSB302 - The hardware I2C bus on PB6/7 is used for the MSA301 and FUSB302 -- The OLED is the same SSD1306 as everything else, but its on a bit-banged bus +- The OLED is the same SSD1306 as everything else, but it’s on a bit-banged bus From 38eec2f8e28d5090993cc76971959587425744e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:53:35 +0200 Subject: [PATCH 13/37] Typo fixes in HardwareIssues.md --- Documentation/HardwareIssues.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/HardwareIssues.md b/Documentation/HardwareIssues.md index b59bb0a5..13909381 100644 --- a/Documentation/HardwareIssues.md +++ b/Documentation/HardwareIssues.md @@ -16,7 +16,7 @@ If your iron is new, there is a slim chance your accelerometer may be DOA and ne ## No USB-PD IC detected -Generally, this means either something went very awry in the firmware or the chip is not answering as would normally be expected. Try rolling back to an earlier release to confirm if the issue still persists then the device may need repair. If you have some form of seller protection/support you most likely want to reach out to this to be safe. If you don't, you can always attempt to replace the IC yourself. As of writing both the TS80P and Pinecil use the FUSB302. +Generally, this means either something went very awry in the firmware, or the chip is not answering as would normally be expected. Try rolling back to an earlier release to confirm if the issue still persists then the device may need repair. If you have some form of seller protection/support, you most likely want to reach out to this to be safe. If you don't, you can always attempt to replace the IC yourself. As of writing both the TS80P and Pinecil use the FUSB302. **Note this warning will only be shown the first few times until settings are reset** From 5654ec0db2d7bbfebf32ad0f4e82a91ec6bd058d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 12:58:01 +0200 Subject: [PATCH 14/37] Typo fix in Menu.md --- Documentation/Menu.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/Menu.md b/Documentation/Menu.md index 92c70618..8bb02edd 100644 --- a/Documentation/Menu.md +++ b/Documentation/Menu.md @@ -14,7 +14,7 @@ Holding the button at the front of the iron will enter boost mode (if enabled). This menu allows you to cycle through all the options and set their values. The button near the USB cycles through the options, and the one near the tip changes the selected option. Note that settings are not saved until you exit the menu. -If you leave the unit alone (ie don't press any buttons) on a setting, after 3 seconds the screen will scroll a rough description of the setting. +If you leave the unit alone (i.e., don't press any buttons) on a setting, after 3 seconds the screen will scroll a rough description of the setting. The menu is arranged so that the most often used settings are first. With submenus being selected to enter using the front button (as if you were going to change the setting). @@ -41,7 +41,7 @@ To calibrate your iron: Some tips will have an offset on their readings, to calibrate this out perform the following steps: 1. Connect power to your iron -2. Make sure the tip is at room temperature (ie. wait for a fair while after using the iron before calibration) +2. Make sure the tip is at room temperature (i.e., wait for a fair while after using the iron before calibration) 3. Enter the settings menu 4. Scroll down to the advanced menu, and then the temperature calibration 5. Press the button to change the option (tip button) @@ -54,6 +54,6 @@ Some tips will have an offset on their readings, to calibrate this out perform t ### Boost mode -This allows you to change the front key (one near the tip) to become a boost button when you hold it for > 2 seconds. This allows you to set this button to change the soldering temperature for short periods. For example when soldering a big joint and you want to boost the temperature a bit. +This allows you to change the front key (one near the tip) to become a boost button when you hold it for > 2 seconds. This allows you to set this button to change the soldering temperature for short periods. For example, when soldering a big joint and you want to boost the temperature a bit. The boost temperature is set in the settings menu. From d808345b5bf355a5b611f3c5acf13ac7e3c27f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 13:00:41 +0200 Subject: [PATCH 15/37] Typo fix in Logo.md --- Documentation/Logo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Logo.md b/Documentation/Logo.md index f3daf487..66f8a688 100644 --- a/Documentation/Logo.md +++ b/Documentation/Logo.md @@ -1,7 +1,7 @@ # Startup Logos This firmware supports a user created bootup logo. -By default there is _not_ one included in the firmware, as this means that once flashed they generally stay. +By default, there is _not_ one included in the firmware, as this means that once flashed they generally stay. ## Generating the Logo files @@ -27,7 +27,7 @@ Run `python3 img2logo.py --help` to see available options. ### Miniware (TS100/TS80/TS80P) Upload the HEX file to the iron in DFU mode and, if the file's extension changes to .RDY, your custom splash screen should show up on startup. -You perform this the same way as if you were flashing a new firmware, and all of the existing notes around this apply. +You perform this the same way as if you were flashing a new firmware, and all the existing notes around this apply. If you have flashed the `IronOS-dfu` alternative bootloader, you should use the `.dfu` files instead From c68cedf8cfdff7e8270485ed73c4493a104b6eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 13:01:40 +0200 Subject: [PATCH 16/37] Fix in Power.md --- Documentation/Power.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Power.md b/Documentation/Power.md index bb542b33..28c1f973 100644 --- a/Documentation/Power.md +++ b/Documentation/Power.md @@ -13,7 +13,7 @@ Combining these two gives the common equation, power is `Volts (V) squared / Res The resistance of the tip is fixed, ~7.5 ohms for the TS100/Pinecil and ~4.5 ohms for the TS80(P). This means that for both irons, the power delivered to the soldering tip is proportional to the voltage used, squared. -This is why the TS100 performs poorly when run off 12 V power supplies. +Therefore the TS100 performs poorly when run off 12 V power supplies. ## Output Control & Regulation From 210f1a2ff044943dfb6d8c7c1ed3b91178d6fb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 13:07:12 +0200 Subject: [PATCH 17/37] Fix in Troubleshooting.md --- Documentation/Troubleshooting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Troubleshooting.md b/Documentation/Troubleshooting.md index 688d89c3..58b4af29 100644 --- a/Documentation/Troubleshooting.md +++ b/Documentation/Troubleshooting.md @@ -17,7 +17,7 @@ If you can open up your iron, give it a good look at all the connection points, If you are finding the tip is reading high; the first fields to check in the Debug menu are `RTip` and `CHan`. -- `RTip` is the raw tip reading in μV; at cool this should be around 700-1000 for Larger tips and ~1500 for smaller tips (TS80's) +- `RTip` is the raw tip reading in μV; at cool this should be around 700-1000 for larger tips and ~1500 for smaller tips (TS80's) - `CHan` is the temperature of the temperature sensor on the PCB in degrees Celsius \* 10. So 29 °C ambient should read as 290 ### RTip is out of spec From 0a00e3fee374048be8a71c982f3585d2dbd7c3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Tue, 19 Apr 2022 13:18:52 +0200 Subject: [PATCH 18/37] Update the upper part of the document --- Documentation/Flashing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Flashing.md b/Documentation/Flashing.md index 21d0e1bc..bbd01ba3 100644 --- a/Documentation/Flashing.md +++ b/Documentation/Flashing.md @@ -39,9 +39,9 @@ Officially the bootloader on the devices only works under Windows (use the built 7. If it didn't work the first time, try copying the file again without disconnecting the device, often it will work on the second shot. 8. Disconnect the USB and power up the device. You're good to go. -For the more adventurous out there, you can also load this firmware onto the device using an SWD programmer. +For the more adventurous out there, you can also load this firmware onto the device using an SWD programmer, for easier installation follow the guide at the end of this document. -On the bottom of the MCU riser PCB, there are 4 pads for programming. On v2.51A PCB revision `USB_D+` is shorted to `SWDIO` and `USB_D-` is shorted to `SWCLK` so debugging works without disassembly (attach while staying in the bootloader). Installing [dapboot from eDesignOSS](https://github.com/eDesignOSS/dapboot) (`make TARGET=TS100 -C src`) is recommended as it allows reliable flashing of binary files with [dfu-util](http://dfu-util.sourceforge.net/). +On the bottom of the MCU riser PCB, there are 4 pads for programming. On v2.51A PCB revision `USB_D+` is shorted to `SWDIO` and `USB_D-` is shorted to `SWCLK` so debugging works without disassembly (attach while staying in the bootloader). Installing [IronOS-dfu](https://github.com/Ralim/IronOS-dfu) is recommended as it allows reliable flashing of binary files with [dfu-util](http://dfu-util.sourceforge.net/). There is a complete device flash backup included in this repository. (Note this includes the bootloader, so will need an SWD programmer to load onto the unit). From 69f0f43c1a7fd43888730b0924138942d06db32d Mon Sep 17 00:00:00 2001 From: JugglerLKR Date: Tue, 19 Apr 2022 16:49:37 +0300 Subject: [PATCH 19/37] Update translation_RU.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit String "Invert screen can be longer", so now it says "Инвесрия" --- Translations/translation_RU.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 1d418689..9958d4be 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -196,7 +196,7 @@ "desc": "Настройки контраста/яркости OLED экрана" }, "ColourInversion": { - "text2": ["Инверт", "экрана"], + "text2": ["Инверсия", "экрана"], "desc": "Инвертировать цвета на OLED экране" }, "LOGOTime": { From 12729821fada14a2658e1630a2b69bb47a1eeb82 Mon Sep 17 00:00:00 2001 From: JugglerLKR Date: Tue, 19 Apr 2022 16:55:51 +0300 Subject: [PATCH 20/37] Update translation_RU.json LOGO time translation --- Translations/translation_RU.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 9958d4be..436b3def 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -200,8 +200,8 @@ "desc": "Инвертировать цвета на OLED экране" }, "LOGOTime": { - "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (s=seconds)" + "text2": ["Длительность", "показа логотипа"], + "desc": "Длительность отображения логотипа (в секундах)" } } } From baeb1091b8fddeada57cede706c6febaa0bee9a7 Mon Sep 17 00:00:00 2001 From: Alfredo Colas <57442104+LyricPants66133@users.noreply.github.com> Date: Tue, 19 Apr 2022 19:43:45 -0400 Subject: [PATCH 21/37] Minor Bootup Logo readme fix fixed incorrectly formatted file link in readme --- Bootup Logo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bootup Logo/README.md b/Bootup Logo/README.md index 55f7559f..b56b3457 100644 --- a/Bootup Logo/README.md +++ b/Bootup Logo/README.md @@ -4,4 +4,4 @@ IronOS supports both a bootup logo _AND_ bootup animations. However, they are no longer included in this repo. -(Please read the docs)[../Documentation/Logo.md] +[Please read the docs](../Documentation/Logo.md) From 665badd2270fd408404c5770b6b0e109f37ba503 Mon Sep 17 00:00:00 2001 From: dmitrygribenchuk Date: Thu, 21 Apr 2022 14:46:09 +0300 Subject: [PATCH 22/37] Update translation_BE.json --- Translations/translation_BE.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Translations/translation_BE.json b/Translations/translation_BE.json index 0270833a..94b3cb8a 100644 --- a/Translations/translation_BE.json +++ b/Translations/translation_BE.json @@ -200,8 +200,8 @@ "desc": "Інвертаваць колеры OLED-экрана" }, "LOGOTime": { - "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (s=seconds)" + "text2": ["Лагатып загрузкі", "працягласць"], + "desc": "Усталяваць працягласць лагатыпа загрузки (s=Секунды)" } } } From e37ecdcf751e7b9dba27fa3a2e7fcbce02bc579e Mon Sep 17 00:00:00 2001 From: River B <97197236+River-b@users.noreply.github.com> Date: Sat, 23 Apr 2022 06:09:26 -0700 Subject: [PATCH 23/37] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bafd2012..e8b1bbdf 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,9 @@ This project is considered feature complete for use as a soldering iron, _so ple _This firmware does **NOT** support the USB port while running for changing settings. This is done through the onscreen menu only. Logos are edited using the tool or python script and uploaded in DFU mode._ -To get started with this firmware, please jump over to [here](Documentation/GettingStarted.md). +## Getting Started + +To get started with IronOS firmware, please jump to [Getting Started Guide](Documentation/GettingStarted.md). But the [TL;DR](https://www.merriam-webster.com/dictionary/TL%3BDR) is to press the button near the front of the iron to heat up. Use the button near the back of the iron to enter the settings menu. Long hold the rear button in soldering mode to exit back to the start screen. From e8188f4caa6f515191ed3d333f5d1698a9c43d07 Mon Sep 17 00:00:00 2001 From: Ziuta Date: Sun, 24 Apr 2022 13:07:32 +0200 Subject: [PATCH 24/37] Update PL translation (v2.18) --- Translations/translation_PL.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Translations/translation_PL.json b/Translations/translation_PL.json index 8ad1deb6..1ab7c532 100644 --- a/Translations/translation_PL.json +++ b/Translations/translation_PL.json @@ -200,8 +200,8 @@ "desc": "Odwrócenie kolorów wyświetlacza OLED" }, "LOGOTime": { - "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (s=seconds)" + "text2": ["Długość wyś.", "loga"], + "desc": "Ustawia czas wyświetlania loga podczas uruchamiania (s=sekund)" } } } From 103599deca31c42328e3fa346f45bebb9ec94ee4 Mon Sep 17 00:00:00 2001 From: dmitrygribenchuk Date: Tue, 26 Apr 2022 15:48:57 +0300 Subject: [PATCH 25/37] Update translation_BE.json fix to correct form and fix "i" letter --- Translations/translation_BE.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Translations/translation_BE.json b/Translations/translation_BE.json index 94b3cb8a..4e820020 100644 --- a/Translations/translation_BE.json +++ b/Translations/translation_BE.json @@ -177,7 +177,7 @@ }, "AnimSpeed": { "text2": ["Хуткасць", "анімацыі"], - "desc": "Хуткасць анімацыі гузікаў у галоўным меню (Мілісекунды) (А=Адключана | Н=Нізкі | С=Сярэдні | В=Высокі)" + "desc": "Хуткасць анімацыі гузікаў у галоўным меню (Мілісекунды) (А=Адключана | Н=Нізкая | С=Сярэдняя | В=Высокая)" }, "PowerPulseWait": { "text2": ["Імпульс магутнасці", "час чакання"], @@ -201,7 +201,7 @@ }, "LOGOTime": { "text2": ["Лагатып загрузкі", "працягласць"], - "desc": "Усталяваць працягласць лагатыпа загрузки (s=Секунды)" + "desc": "Усталяваць працягласць лагатыпа загрузкі (s=Секунды)" } } } From 4dc2afb8b3a79b52f182acea108847caa5c3c855 Mon Sep 17 00:00:00 2001 From: Alex <61422689+onxblog@users.noreply.github.com> Date: Tue, 26 Apr 2022 17:01:42 +0300 Subject: [PATCH 26/37] Fix for slang expressions It was technically not a literary translation. --- Translations/translation_RU.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 436b3def..19261607 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -132,8 +132,8 @@ "desc": "Скорость прокрутки текста (М=медленно | Б=быстро)" }, "QCMaxVoltage": { - "text2": ["Максимальный", "вольтаж для QC"], - "desc": "Максимальный поддерживаемый QC вольтаж используемого источника питания" + "text2": ["Максимальное", "напряжение QC"], + "desc": "Максимальное напряжение для согласования с QC источником питания" }, "PDNegTimeout": { "text2": ["PD", "тайм-аут"], From cfa7258f006a88a6a9814ecd1922a4e74ad455c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20=C4=8Cern=C3=BD?= Date: Fri, 29 Apr 2022 19:28:03 +0200 Subject: [PATCH 27/37] Update Czech translation --- Translations/translation_CS.json | 544 +++++++++++++++++++------------ 1 file changed, 338 insertions(+), 206 deletions(-) diff --git a/Translations/translation_CS.json b/Translations/translation_CS.json index 4f5a53be..e7124fce 100644 --- a/Translations/translation_CS.json +++ b/Translations/translation_CS.json @@ -1,207 +1,339 @@ { - "languageCode": "CS", - "languageLocalName": "Český", - "fonts": ["ascii_basic", "latin_extended"], - "tempUnitFahrenheit": false, - "messages": { - "SettingsCalibrationWarning": "Ujistěte se, že hrot má pokojovou teplotu!", - "SettingsResetWarning": "Opravdu chcete resetovat zařízení do továrního nastavení?", - "UVLOWarningString": "Nízké DC", - "UndervoltageString": "! Nízké napětí !", - "InputVoltageString": "Napětí: ", - "SleepingSimpleString": "Zzz ", - "SleepingAdvancedString": "Režim spánku...", - "SleepingTipAdvancedString": "Hrot:", - "OffString": "Vyp" - }, - "messagesWarn": { - "ResetOKMessage": "Reset OK", - "SettingsResetMessage": ["Tov. nas. obnov.", ""], - "NoAccelerometerMessage": ["No accelerometer", "detected!"], - "NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"], - "LockingKeysString": "LOCKED", - "UnlockingKeysString": "UNLOCKED", - "WarningKeysLockedString": "!LOCKED!", - "WarningThermalRunaway": ["Thermal", "Runaway"] - }, - "characters": { - "SettingRightChar": "P", - "SettingLeftChar": "L", - "SettingAutoChar": "A", - "SettingOffChar": "O", - "SettingSlowChar": "P", - "SettingMediumChar": "M", - "SettingFastChar": "R", - "SettingStartNoneChar": "O", - "SettingStartSolderingChar": "P", - "SettingStartSleepChar": "S", - "SettingStartSleepOffChar": "M", - "SettingSensitivityOff": "O", - "SettingSensitivityLow": "L", - "SettingSensitivityMedium": "M", - "SettingSensitivityHigh": "H", - "SettingLockDisableChar": "D", - "SettingLockBoostChar": "B", - "SettingLockFullChar": "F" - }, - "menuGroups": { - "PowerMenu": { - "text2": ["Power", "settings"], - "desc": "Power settings" - }, - "SolderingMenu": { - "text2": ["Pájecí", "nastavení"], - "desc": "Nastavení pájení (boost, auto start...)." - }, - "PowerSavingMenu": { - "text2": ["Režim", "spánku"], - "desc": "Nastavení režimu spánku, automatického vypnutí..." - }, - "UIMenu": { - "text2": ["Uživatelské", "rozhraní"], - "desc": "Nastavení uživatelského rozhraní." - }, - "AdvancedMenu": { - "text2": ["Pokročilé", "volby"], - "desc": "Pokročilé volby (detailní obrazovky, kalibrace, tovární nastavení...)." - } - }, - "menuOptions": { - "DCInCutoff": { - "text2": ["Zdroj", "napájení"], - "desc": "Při nižším napětí ukončí pájení (DC=10V | ?S=?x3,3V pro LiPo, LiIon...)." - }, - "SleepTemperature": { - "text2": ["Teplota v", "r. spánku"], - "desc": "Teplota v režimu spánku." - }, - "SleepTimeout": { - "text2": ["Čas do", "r. spánku"], - "desc": "Čas do režimu spánku (Minut | Sekund)." - }, - "ShutdownTimeout": { - "text2": ["Čas do", "vypnutí"], - "desc": "Čas do automatického vypnutí (Minut)." - }, - "MotionSensitivity": { - "text2": ["Citlivost", "det. pohybu"], - "desc": "Citlivost detekce pohybu (0=Vyp | 1=Min | ... | 9=Max)." - }, - "TemperatureUnit": { - "text2": ["Jednotky", "teploty"], - "desc": "Jednotky měření teploty (C=Celsius | F=Fahrenheit)." - }, - "AdvancedIdle": { - "text2": ["Podrobnosti", "na vých. obr."], - "desc": "Zobrazit podrobnosti na výchozí obrazovce?" - }, - "DisplayRotation": { - "text2": ["Orientace", "obrazovky"], - "desc": "Orientace obrazovky (P=Pravák | L=Levák | A=Auto)." - }, - "BoostTemperature": { - "text2": ["Teplota v", "r. boost"], - "desc": "Teplota v režimu boost." - }, - "AutoStart": { - "text2": ["Automatický", "start"], - "desc": "Při startu ihned nahřát hrot? (O=Pryč | P=Pájení | S=Spát | M=Spát teplota místnosti)" - }, - "CooldownBlink": { - "text2": ["Blikáni při", "chladnutí"], - "desc": "Blikání teploty při chladnutí, dokud je hrot horký?" - }, - "TemperatureCalibration": { - "text2": ["Kalibrovat", "teplotu?"], - "desc": "Kalibrace měření teploty." - }, - "SettingsReset": { - "text2": ["Tovární", "nastavení?"], - "desc": "Obnovení továrního nastavení." - }, - "VoltageCalibration": { - "text2": ["Kalibrovat", "vstupní napětí?"], - "desc": "Kalibrace vstupního napětí. Tlačítky uprav, podržením potvrď." - }, - "AdvancedSoldering": { - "text2": ["Podrobnosti", "při pájení"], - "desc": "Zobrazit podrobnosti při pájení?" - }, - "ScrollingSpeed": { - "text2": ["Rychlost", "popisků"], - "desc": "Rychlost posuvu popisků podobných tomuto (P=Pomalu | R=Rychle)" - }, - "QCMaxVoltage": { - "text2": ["Výkon", "ve wattech"], - "desc": "Výkon použítého napájecího adaptéru ve wattech." - }, - "PDNegTimeout": { - "text2": ["PD", "timeout"], - "desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)" - }, - "PowerLimit": { - "text2": ["Omezení", "Výkonu"], - "desc": "Maximální příkon (Watty)" - }, - "ReverseButtonTempChange": { - "text2": ["Prohodit", "tl. +-?"], - "desc": "Prohodí tlačítka plus a minus pro změnu teploty hrotu." - }, - "TempChangeShortStep": { - "text2": ["Krok teploty", "krátký?"], - "desc": "Velikost skoku při změně teploty krátkým stiskem tlačítka!" - }, - "TempChangeLongStep": { - "text2": ["Krok teploty", "dlouhý?"], - "desc": "Velikost skoku při změně teploty dlouhým stiskem tlačítka!" - }, - "PowerPulsePower": { - "text2": ["Intenzita", "Výkon. pulsu"], - "desc": "Puls pro udržení zařízení v chodu (kvůli power bankám)." - }, - "HallEffSensitivity": { - "text2": ["Hall sensor", "sensitivity"], - "desc": "Sensitivity of the Hall effect sensor to detect sleep (0=Vyp | 1=Min | ... | 9=Max)" - }, - "LockingMode": { - "text2": ["Allow locking", "buttons"], - "desc": "While soldering, hold down both buttons to toggle locking them (D=disable | B=boost mode only | F=full locking)" - }, - "MinVolCell": { - "text2": ["Minimum", "voltage"], - "desc": "Minimum allowed voltage per cell (3S: 3 - 3,7V | 4-6S: 2,4 - 3,7V)" - }, - "AnimLoop": { - "text2": ["Anim.", "loop"], - "desc": "Loop icon animations in main menu" - }, - "AnimSpeed": { - "text2": ["Anim.", "speed"], - "desc": "Pace of icon animations in menu (O=off | P=slow | M=medium | R=fast)" - }, - "PowerPulseWait": { - "text2": ["Power pulse", "delay"], - "desc": "Delay before keep-awake-pulse is triggered (x 2,5s)" - }, - "PowerPulseDuration": { - "text2": ["Power pulse", "duration"], - "desc": "Keep-awake-pulse duration (x 250ms)" - }, - "LanguageSwitch": { - "text2": ["Řeč:", " CS Český"], - "desc": "" - }, - "Brightness": { - "text2": ["Screen", "brightness"], - "desc": "Adjust the brightness of the OLED screen" - }, - "ColourInversion": { - "text2": ["Invert", "screen"], - "desc": "Invert the colours of the OLED screen" - }, - "LOGOTime": { - "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (s=seconds)" - } - } -} + "languageCode": "CS", + "languageLocalName": "Český", + "fonts": [ + "ascii_basic", + "latin_extended" + ], + "tempUnitFahrenheit": false, + "messages": { + "SettingsCalibrationWarning": "Ujistěte se, že hrot má pokojovou teplotu!", + "SettingsResetWarning": "Opravdu chcete resetovat zařízení do továrního nastavení?", + "UVLOWarningString": "Nízké DC", + "UndervoltageString": "Nízké napětí", + "InputVoltageString": "Napětí: ", + "SleepingSimpleString": "Zzz ", + "SleepingAdvancedString": "Režim spánku...", + "SleepingTipAdvancedString": "Hrot:", + "OffString": "Vyp" + }, + "messagesWarn": { + "ResetOKMessage": "Reset OK", + "SettingsResetMessage": [ + "Nějaká nastavení", + "byla změněna!" + ], + "NoAccelerometerMessage": [ + "Akcelerometr", + "nebyl detekován!" + ], + "NoPowerDeliveryMessage": [ + "Žádný IO USB-PD", + "nebyl detekován!" + ], + "LockingKeysString": "ZAMČENO", + "UnlockingKeysString": "ODEMČENO", + "WarningKeysLockedString": "ZAMČENO!", + "WarningThermalRunaway": [ + "Teplotní", + "Ochrana" + ] + }, + "characters": { + "SettingRightChar": "P", + "SettingLeftChar": "L", + "SettingAutoChar": "A", + "SettingOffChar": "D", + "SettingSlowChar": "P", + "SettingMediumChar": "S", + "SettingFastChar": "R", + "SettingStartNoneChar": "V", + "SettingStartSolderingChar": "P", + "SettingStartSleepChar": "S", + "SettingStartSleepOffChar": "M", + "SettingSensitivityOff": "O", + "SettingSensitivityLow": "M", + "SettingSensitivityMedium": "S", + "SettingSensitivityHigh": "V", + "SettingLockDisableChar": "Z", + "SettingLockBoostChar": "B", + "SettingLockFullChar": "U" + }, + "menuGroups": { + "PowerMenu": { + "text2": [ + "Napájecí", + "nastavení" + ], + "desc": "Nastavení napájení" + }, + "SolderingMenu": { + "text2": [ + "Pájecí", + "nastavení" + ], + "desc": "Nastavení pájení" + }, + "PowerSavingMenu": { + "text2": [ + "Režim", + "spánku" + ], + "desc": "Nastavení úspory energie" + }, + "UIMenu": { + "text2": [ + "Uživatelské", + "rozhraní" + ], + "desc": "Nastavení uživatelského rozhraní" + }, + "AdvancedMenu": { + "text2": [ + "Pokročilá", + "nastavení" + ], + "desc": "Pokročilá nastavení" + } + }, + "menuOptions": { + "DCInCutoff": { + "text2": [ + "Zdroj", + "napájení" + ], + "desc": "Při nižším napětí ukončit pájení (DC 10V) (S 3,3V na článek, zakázat omezení napájení)." + }, + "SleepTemperature": { + "text2": [ + "Teplota", + "ve spánku" + ], + "desc": "Teplota hrotu v režimu spánku." + }, + "SleepTimeout": { + "text2": [ + "Čas", + "do spánku" + ], + "desc": "\"Režim spánku\" naběhne v (s=sekundách | m=minutách)" + }, + "ShutdownTimeout": { + "text2": [ + "Čas do", + "vypnutí" + ], + "desc": "Interval automatického vypnutí (m=minut)" + }, + "MotionSensitivity": { + "text2": [ + "Citlivost", + "na pohyb" + ], + "desc": "0=vyp | 1=nejméně citlivé | ... | 9=nejvíce citlivé" + }, + "TemperatureUnit": { + "text2": [ + "Jednotka", + "teploty" + ], + "desc": "C=Celsius | F=Fahrenheit" + }, + "AdvancedIdle": { + "text2": [ + "Podrobná obr.", + "nečinnosti" + ], + "desc": "Zobrazit detailní informace malým fontem na obrazovce nečinnosti" + }, + "DisplayRotation": { + "text2": [ + "Orientace", + "obrazovky" + ], + "desc": "P=pravák | L=levák | A=automaticky" + }, + "BoostTemperature": { + "text2": [ + "Teplota", + "boostu" + ], + "desc": "Teplota hrotu v \"režimu boost\"" + }, + "AutoStart": { + "text2": [ + "Chování", + "při startu" + ], + "desc": "V=vypnuto | P=pájecí teplota | S=spánková teplota | M=zahřát hrot po pohybu" + }, + "CooldownBlink": { + "text2": [ + "Blikáni při", + "chladnutí" + ], + "desc": "Blikat teplotou při chladnutí dokud je hrot horký" + }, + "TemperatureCalibration": { + "text2": [ + "Kalibrovat", + "teplotu?" + ], + "desc": "Začít kalibraci měření teploty hrotu" + }, + "SettingsReset": { + "text2": [ + "Obnovit tovární", + "nastavení?" + ], + "desc": "Obnovit všechna nastavení na výchozí" + }, + "VoltageCalibration": { + "text2": [ + "Kalibrovat", + "vstupní napětí?" + ], + "desc": "Začít kalibraci vstupního napětí (dlouhý stisk pro ukončení)" + }, + "AdvancedSoldering": { + "text2": [ + "Podrobná obr.", + "pájení" + ], + "desc": "Zobrazit detailní informace malým fontem na obrazovce pájení" + }, + "ScrollingSpeed": { + "text2": [ + "Rychlost", + "posouvání" + ], + "desc": "Rychlost posouvání popisků podobných tomuto (P=pomalu | R=rychle)" + }, + "QCMaxVoltage": { + "text2": [ + "Napětí", + "QC" + ], + "desc": "Maximální napětí QC pro jednání páječkou" + }, + "PDNegTimeout": { + "text2": [ + "PD", + "timeout" + ], + "desc": "Maximální prodleva při jednání PD ve 100ms krocích pro kompatibilitu s některými QC nabíječkami" + }, + "PowerLimit": { + "text2": [ + "Omezení", + "Výkonu" + ], + "desc": "Maximální příkon páječky (W=watt)" + }, + "ReverseButtonTempChange": { + "text2": [ + "Prohodit", + "tl. +-?" + ], + "desc": "Prohodit tlačítka pro změnu teploty" + }, + "TempChangeShortStep": { + "text2": [ + "Krok teploty", + "krátký?" + ], + "desc": "Velikost přídavku při změně teploty krátkým stiskem tlačítka" + }, + "TempChangeLongStep": { + "text2": [ + "Krok teploty", + "dlouhý?" + ], + "desc": "Velikost přídavku při změně teploty dlouhým stiskem tlačítka" + }, + "PowerPulsePower": { + "text2": [ + "Napájecí", + "pulz" + ], + "desc": "Intenzita výkonu pulzu pro udržení páječky vzhůru (watt)" + }, + "HallEffSensitivity": { + "text2": [ + "Citlivost", + "Hall. čidla" + ], + "desc": "Citlivost Hallova čidla pro detekci spánku (0=vypnuto | 1=nejméně citlivé | ... | 9=nejvíce citlivé)" + }, + "LockingMode": { + "text2": [ + "Povolit zamč.", + "tlačítek" + ], + "desc": "Při pájení podržte obě tlačítka pro jejich zamčení (Z=zakázáno | B=pouze v režimu boost | U=úplné zamčení)" + }, + "MinVolCell": { + "text2": [ + "Minimální", + "napětí" + ], + "desc": "Minimální dovolené napětí po článku (3S: 3 - 3,7V | 4-6S: 2,4 - 3,7V)" + }, + "AnimLoop": { + "text2": [ + "Anim.", + "smyčka" + ], + "desc": "Animovat ikony hlavního menu ve smyčce" + }, + "AnimSpeed": { + "text2": [ + "Anim.", + "rychlost" + ], + "desc": "Tempo animace ikon v menu (O=vypnuto | P=pomalu | S=středně | R=rychle)" + }, + "PowerPulseWait": { + "text2": [ + "Prodleva", + "napáj. pulzu" + ], + "desc": "Prodleva než je spuštěn pulz pro udržení páječky vzhůru pulzu pro udržení páječky vzhůru (x 2,5s)" + }, + "PowerPulseDuration": { + "text2": [ + "Délka", + "napáj. pulzu" + ], + "desc": "Délka pulzu pro udržení páječky vzhůru (x 250ms)" + }, + "LanguageSwitch": { + "text2": [ + "Jazyk:", + " CS Český" + ], + "desc": "Současný jazyk firmwaru" + }, + "Brightness": { + "text2": [ + "Jas", + "obrazovky" + ], + "desc": "Upravit jas OLED" + }, + "ColourInversion": { + "text2": [ + "Invertovat", + "obrazovku" + ], + "desc": "Invertovat barvy na OLED" + }, + "LOGOTime": { + "text2": [ + "Trvání", + "boot loga" + ], + "desc": "Nastavení doby trvání boot loga (s=sekundy)" + } + } +} \ No newline at end of file From e578e5a84491e4470927dc729e2ff45a74b209f7 Mon Sep 17 00:00:00 2001 From: dmitrygribenchuk Date: Mon, 2 May 2022 11:53:20 +0300 Subject: [PATCH 28/37] Update translation_BE.json --- Translations/translation_BE.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Translations/translation_BE.json b/Translations/translation_BE.json index 4e820020..b7674ff4 100644 --- a/Translations/translation_BE.json +++ b/Translations/translation_BE.json @@ -109,7 +109,7 @@ }, "CooldownBlink": { "text2": ["Мігценне t°", "пры астуджэнні"], - "desc": "Міргаць тэмпературай на экране астуджэння, пакуль джага яшчэ гарачае" + "desc": "Міргаць тэмпературай на экране астуджэння, пакуль джала яшчэ гарачае" }, "TemperatureCalibration": { "text2": ["Каліброўка", "тэмпературы"], @@ -157,7 +157,7 @@ }, "PowerPulsePower": { "text2": ["Сіла імп.", "сілкав. Вт"], - "desc": "Сіла імпульса щтрымливаючага ад сну павербанку ці іншай крыніцы сілкавання" + "desc": "Сіла імпульса ўтрымливаючага ад сну павербанку ці іншай крыніцы сілкавання" }, "HallEffSensitivity": { "text2": ["Эфект Хола", "адчувальнасць"], From 14eb587856da80f708cdb9c1cd91cc413ef6bf0e Mon Sep 17 00:00:00 2001 From: discip <53649486+discip@users.noreply.github.com> Date: Wed, 4 May 2022 00:10:44 +0200 Subject: [PATCH 29/37] Update Pins.h --- source/Core/BSP/Miniware/Pins.h | 184 +++++++++++++------------------- 1 file changed, 76 insertions(+), 108 deletions(-) diff --git a/source/Core/BSP/Miniware/Pins.h b/source/Core/BSP/Miniware/Pins.h index 079c9049..fd89dea3 100644 --- a/source/Core/BSP/Miniware/Pins.h +++ b/source/Core/BSP/Miniware/Pins.h @@ -6,119 +6,87 @@ */ #ifndef BSP_MINIWARE_PINS_H_ -#define BSP_MINIWARE_PINS_H_ -#include "configuration.h" + #define BSP_MINIWARE_PINS_H_ + #include "configuration.h" -#ifdef MODEL_TS100 + #ifdef MODEL_TS100 -#define KEY_B_Pin GPIO_PIN_6 -#define KEY_B_GPIO_Port GPIOA -#define TMP36_INPUT_Pin GPIO_PIN_7 -#define TMP36_INPUT_GPIO_Port GPIOA -#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7 -#define TMP36_ADC2_CHANNEL ADC_CHANNEL_7 -#define TIP_TEMP_Pin GPIO_PIN_0 -#define TIP_TEMP_GPIO_Port GPIOB -#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8 -#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8 -#define VIN_Pin GPIO_PIN_1 -#define VIN_GPIO_Port GPIOB -#define VIN_ADC1_CHANNEL ADC_CHANNEL_9 -#define VIN_ADC2_CHANNEL ADC_CHANNEL_9 -#define OLED_RESET_Pin GPIO_PIN_8 -#define OLED_RESET_GPIO_Port GPIOA -#define KEY_A_Pin GPIO_PIN_9 -#define KEY_A_GPIO_Port GPIOA -#define INT_Orientation_Pin GPIO_PIN_3 -#define INT_Orientation_GPIO_Port GPIOB -#define PWM_Out_Pin GPIO_PIN_4 -#define PWM_Out_GPIO_Port GPIOB -#define PWM_Out_CHANNEL TIM_CHANNEL_1 -#define PWM_Out_CCR -#define INT_Movement_Pin GPIO_PIN_5 -#define INT_Movement_GPIO_Port GPIOB -#define SCL_Pin GPIO_PIN_6 -#define SCL_GPIO_Port GPIOB -#define SDA_Pin GPIO_PIN_7 -#define SDA_GPIO_Port GPIOB -#endif -#ifdef MODEL_TS80 -// TS80 pin map -#define KEY_B_Pin GPIO_PIN_0 -#define KEY_B_GPIO_Port GPIOB -#define TMP36_INPUT_Pin GPIO_PIN_4 -#define TMP36_INPUT_GPIO_Port GPIOA -#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4 -#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4 -#define TIP_TEMP_Pin GPIO_PIN_3 -#define TIP_TEMP_GPIO_Port GPIOA -#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3 -#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3 + #define KEY_B_Pin GPIO_PIN_6 + #define KEY_B_GPIO_Port GPIOA + #define TMP36_INPUT_Pin GPIO_PIN_7 + #define TMP36_INPUT_GPIO_Port GPIOA + #define TMP36_ADC1_CHANNEL ADC_CHANNEL_7 + #define TMP36_ADC2_CHANNEL ADC_CHANNEL_7 + #define TIP_TEMP_Pin GPIO_PIN_0 + #define TIP_TEMP_GPIO_Port GPIOB + #define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8 + #define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8 + #define VIN_Pin GPIO_PIN_1 + #define VIN_GPIO_Port GPIOB + #define VIN_ADC1_CHANNEL ADC_CHANNEL_9 + #define VIN_ADC2_CHANNEL ADC_CHANNEL_9 + #define OLED_RESET_Pin GPIO_PIN_8 + #define OLED_RESET_GPIO_Port GPIOA + #define KEY_A_Pin GPIO_PIN_9 + #define KEY_A_GPIO_Port GPIOA + #define INT_Orientation_Pin GPIO_PIN_3 + #define INT_Orientation_GPIO_Port GPIOB + #define PWM_Out_Pin GPIO_PIN_4 + #define PWM_Out_GPIO_Port GPIOB + #define PWM_Out_CHANNEL TIM_CHANNEL_1 + #define PWM_Out_CCR + #define INT_Movement_Pin GPIO_PIN_5 + #define INT_Movement_GPIO_Port GPIOB + #define SCL_Pin GPIO_PIN_6 + #define SCL_GPIO_Port GPIOB + #define SDA_Pin GPIO_PIN_7 + #define SDA_GPIO_Port GPIOB + #endif -#define VIN_Pin GPIO_PIN_2 -#define VIN_GPIO_Port GPIOA -#define VIN_ADC1_CHANNEL ADC_CHANNEL_2 -#define VIN_ADC2_CHANNEL ADC_CHANNEL_2 -#define OLED_RESET_Pin GPIO_PIN_15 -#define OLED_RESET_GPIO_Port GPIOA -#define KEY_A_Pin GPIO_PIN_1 -#define KEY_A_GPIO_Port GPIOB -#define INT_Orientation_Pin GPIO_PIN_4 -#define INT_Orientation_GPIO_Port GPIOB -#define PWM_Out_Pin GPIO_PIN_6 -#define PWM_Out_GPIO_Port GPIOA -#define PWM_Out_CHANNEL TIM_CHANNEL_1 -#define INT_Movement_Pin GPIO_PIN_5 -#define INT_Movement_GPIO_Port GPIOB -#define SCL_Pin GPIO_PIN_6 -#define SCL_GPIO_Port GPIOB -#define SDA_Pin GPIO_PIN_7 -#define SDA_GPIO_Port GPIOB -#define SCL2_Pin GPIO_PIN_5 -#define SCL2_GPIO_Port GPIOA -#define SDA2_Pin GPIO_PIN_1 -#define SDA2_GPIO_Port GPIOA + #if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0 + // TS80 & TS80P pin map + #define KEY_B_Pin GPIO_PIN_0 + #define KEY_B_GPIO_Port GPIOB + #define TMP36_INPUT_Pin GPIO_PIN_4 + #define TMP36_INPUT_GPIO_Port GPIOA + #define TMP36_ADC1_CHANNEL ADC_CHANNEL_4 + #define TMP36_ADC2_CHANNEL ADC_CHANNEL_4 + #define TIP_TEMP_Pin GPIO_PIN_3 + #define TIP_TEMP_GPIO_Port GPIOA + #define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3 + #define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3 -#endif -#ifdef MODEL_TS80P -// TS80P pin map -#define KEY_B_Pin GPIO_PIN_0 -#define KEY_B_GPIO_Port GPIOB -#define TMP36_INPUT_Pin GPIO_PIN_4 -#define TMP36_INPUT_GPIO_Port GPIOA -#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4 -#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4 -#define TIP_TEMP_Pin GPIO_PIN_3 -#define TIP_TEMP_GPIO_Port GPIOA -#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3 -#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3 + #define VIN_Pin GPIO_PIN_2 + #define VIN_GPIO_Port GPIOA + #define VIN_ADC1_CHANNEL ADC_CHANNEL_2 + #define VIN_ADC2_CHANNEL ADC_CHANNEL_2 + #define OLED_RESET_Pin GPIO_PIN_15 + #define OLED_RESET_GPIO_Port GPIOA + #define KEY_A_Pin GPIO_PIN_1 + #define KEY_A_GPIO_Port GPIOB + #define INT_Orientation_Pin GPIO_PIN_4 + #define INT_Orientation_GPIO_Port GPIOB + #define PWM_Out_Pin GPIO_PIN_6 + #define PWM_Out_GPIO_Port GPIOA + #define PWM_Out_CHANNEL TIM_CHANNEL_1 + #define INT_Movement_Pin GPIO_PIN_5 + #define INT_Movement_GPIO_Port GPIOB + #define SCL_Pin GPIO_PIN_6 + #define SCL_GPIO_Port GPIOB + #define SDA_Pin GPIO_PIN_7 + #define SDA_GPIO_Port GPIOB + #define SCL2_Pin GPIO_PIN_5 + #define SCL2_GPIO_Port GPIOA + #define SDA2_Pin GPIO_PIN_1 + #define SDA2_GPIO_Port GPIOA -#define VIN_Pin GPIO_PIN_2 -#define VIN_GPIO_Port GPIOA -#define VIN_ADC1_CHANNEL ADC_CHANNEL_2 -#define VIN_ADC2_CHANNEL ADC_CHANNEL_2 -#define OLED_RESET_Pin GPIO_PIN_15 -#define OLED_RESET_GPIO_Port GPIOA -#define KEY_A_Pin GPIO_PIN_1 -#define KEY_A_GPIO_Port GPIOB -#define INT_Orientation_Pin GPIO_PIN_4 -#define INT_Orientation_GPIO_Port GPIOB -#define PWM_Out_Pin GPIO_PIN_6 -#define PWM_Out_GPIO_Port GPIOA -#define PWM_Out_CHANNEL TIM_CHANNEL_1 -#define INT_Movement_Pin GPIO_PIN_5 -#define INT_Movement_GPIO_Port GPIOB -#define SCL_Pin GPIO_PIN_6 -#define SCL_GPIO_Port GPIOB -#define SDA_Pin GPIO_PIN_7 -#define SDA_GPIO_Port GPIOB -#define SCL2_Pin GPIO_PIN_5 -#define SCL2_GPIO_Port GPIOA -#define SDA2_Pin GPIO_PIN_1 -#define SDA2_GPIO_Port GPIOA -#define INT_PD_Pin GPIO_PIN_9 -#define INT_PD_GPIO_Port GPIOA + #endif -#endif + #ifdef MODEL_TS80P + // TS80P pin map + #define INT_PD_Pin GPIO_PIN_9 + #define INT_PD_GPIO_Port GPIOA + + #endif #endif /* BSP_MINIWARE_PINS_H_ */ From a5975b3385a00c8385f7699151b6ccbc4c0acacd Mon Sep 17 00:00:00 2001 From: discip <53649486+discip@users.noreply.github.com> Date: Wed, 4 May 2022 00:13:46 +0200 Subject: [PATCH 30/37] Update Power.cpp --- source/Core/BSP/Miniware/Power.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source/Core/BSP/Miniware/Power.cpp b/source/Core/BSP/Miniware/Power.cpp index b72d984b..84772772 100644 --- a/source/Core/BSP/Miniware/Power.cpp +++ b/source/Core/BSP/Miniware/Power.cpp @@ -22,11 +22,7 @@ void power_check() { } bool getIsPoweredByDCIN() { -#ifdef MODEL_TS80 - return false; -#endif - -#ifdef MODEL_TS80P +#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0 return false; #endif From 9ec92298f35869ca3f5cb70be12caa448fad5cef Mon Sep 17 00:00:00 2001 From: discip <53649486+discip@users.noreply.github.com> Date: Wed, 4 May 2022 00:17:34 +0200 Subject: [PATCH 31/37] Update Font.h --- source/Core/Drivers/Font.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Core/Drivers/Font.h b/source/Core/Drivers/Font.h index 7c9cc247..d3fc1723 100644 --- a/source/Core/Drivers/Font.h +++ b/source/Core/Drivers/Font.h @@ -124,7 +124,7 @@ const uint8_t WarningBlock24[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x30, 0x0C, 0x02, 0xF1, 0xF1, 0xF1, 0x02, 0x0C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xB0, 0x8C, 0x83, 0x80, 0x80, 0x80, 0x80, 0xB3, 0xB3, 0xB3, 0x80, 0x80, 0x80, 0x80, 0x83, 0x8C, 0xB0, 0xC0, 0x00, 0x00}; -#if defined(MODEL_TS100) + defined(MODEL_Pinecil) >= 1 +#if defined(MODEL_TS100) + defined(MODEL_Pinecil) > 0 const uint8_t buttonA[] = { // width = 42 // height = 16 @@ -140,7 +140,7 @@ const uint8_t disconnectedTip[] = { 0x04, 0x31, 0x38, 0x1c, 0x0e, 0x04, 0x01, 0x03, 0x07, 0x0e, 0x1c, 0x39, 0x30, 0x01, 0x03, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x09, 0x0f, 0x00}; #endif -#if defined(MODEL_TS80) + defined(MODEL_TS80P) >= 1 +#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0 const uint8_t buttonA[] = { // width = 42 // height = 16 From 2ecf9c974262920fb68569f678adffebdaf7c083 Mon Sep 17 00:00:00 2001 From: FaBjE <5355001+FaBjE@users.noreply.github.com> Date: Sun, 8 May 2022 16:52:06 +0200 Subject: [PATCH 32/37] Update dutch translation --- Translations/translation_NL.json | 546 +++++++++++++++++++------------ 1 file changed, 339 insertions(+), 207 deletions(-) diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index 2538ac49..caf3216c 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -1,207 +1,339 @@ -{ - "languageCode": "NL", - "languageLocalName": "Nederlands", - "fonts": ["ascii_basic", "latin_extended"], - "tempUnitFahrenheit": false, - "messages": { - "SettingsCalibrationWarning": "Zorg ervoor dat te punt op kamertemperatuur is voor je verder gaat!", - "SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wil zetten?", - "UVLOWarningString": "DC Laag", - "UndervoltageString": "Onderspanning", - "InputVoltageString": "Input V: ", - "SleepingSimpleString": "Zzzz", - "SleepingAdvancedString": "Slaapstand...", - "SleepingTipAdvancedString": "Punt:", - "OffString": "Uit" - }, - "messagesWarn": { - "ResetOKMessage": "Reset OK", - "SettingsResetMessage": ["Instellingen", "zijn gereset!"], - "NoAccelerometerMessage": ["No accelerometer", "detected!"], - "NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"], - "LockingKeysString": " GEBLOKKEERD", - "UnlockingKeysString": "GEDEBLOKKEERD", - "WarningKeysLockedString": "!GEBLOKKEERD!", - "WarningThermalRunaway": ["Thermal", "Runaway"] - }, - "characters": { - "SettingRightChar": "R", - "SettingLeftChar": "L", - "SettingAutoChar": "A", - "SettingOffChar": "O", - "SettingSlowChar": "S", - "SettingMediumChar": "M", - "SettingFastChar": "F", - "SettingStartNoneChar": "F", - "SettingStartSolderingChar": "T", - "SettingStartSleepChar": "S", - "SettingStartSleepOffChar": "K", - "SettingSensitivityOff": "O", - "SettingSensitivityLow": "L", - "SettingSensitivityMedium": "M", - "SettingSensitivityHigh": "H", - "SettingLockDisableChar": "U", - "SettingLockBoostChar": "B", - "SettingLockFullChar": "V" - }, - "menuGroups": { - "PowerMenu": { - "text2": ["Power", "settings"], - "desc": "Power settings" - }, - "SolderingMenu": { - "text2": ["Soldeer", "Instellingen"], - "desc": "Soldeer instellingen" - }, - "PowerSavingMenu": { - "text2": ["Slaap", "Modes"], - "desc": "Stroom besparings instellingen" - }, - "UIMenu": { - "text2": ["Gebruikers-", "interface"], - "desc": "Gebruikers-interface instellingen" - }, - "AdvancedMenu": { - "text2": ["Geavanceerde", "Instellingen"], - "desc": "Geavanceerde Instellingen" - } - }, - "menuOptions": { - "DCInCutoff": { - "text2": ["Spannings-", "bron"], - "desc": "Spanningsbron. Stelt drempelspanning in. (DC 10V) (S 3.3V per cel)" - }, - "SleepTemperature": { - "text2": ["Slaap", "temp"], - "desc": "Temperatuur in slaapstand" - }, - "SleepTimeout": { - "text2": ["Slaap", "time-out"], - "desc": "Slaap time-out (Minuten | Seconden)" - }, - "ShutdownTimeout": { - "text2": ["Uitschakel", "time-out"], - "desc": "Automatisch afsluiten time-out (Minuten)" - }, - "MotionSensitivity": { - "text2": ["Bewegings-", "gevoeligheid"], - "desc": "Bewegingsgevoeligheid (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)" - }, - "TemperatureUnit": { - "text2": ["Temperatuur", "eenheid"], - "desc": "Temperatuureenheid (C=Celsius | F=Fahrenheit)" - }, - "AdvancedIdle": { - "text2": ["Gedetailleerd", "startscherm"], - "desc": "Gedetailleerde informatie weergeven in een kleiner lettertype op het startscherm." - }, - "DisplayRotation": { - "text2": ["Scherm-", "oriëntatie"], - "desc": "Schermoriëntatie (R=Rechtshandig | L=Linkshandig | A=Automatisch)" - }, - "BoostTemperature": { - "text2": ["Boost", "temp"], - "desc": "Temperatuur in boostmode" - }, - "AutoStart": { - "text2": ["Auto", "start"], - "desc": "Breng de soldeerbout direct op temperatuur bij het opstarten. (F=Uit | T=Soldeertemperatuur | S=Slaapstand-temperatuur | K=Slaapstand kamertemperatuur)" - }, - "CooldownBlink": { - "text2": ["Afkoel", "flikker"], - "desc": "Temperatuur laten flikkeren in het hoofdmenu als de soldeerpunt aan het afkoelen is." - }, - "TemperatureCalibration": { - "text2": ["Calibreer", "temperatuur?"], - "desc": "Temperatuursafwijking van de soldeerpunt calibreren." - }, - "SettingsReset": { - "text2": ["Instellingen", "resetten?"], - "desc": "Alle instellingen terugzetten." - }, - "VoltageCalibration": { - "text2": ["Calibreer", "input-voltage?"], - "desc": "VIN Calibreren. (druk lang om te sluiten)." - }, - "AdvancedSoldering": { - "text2": ["Gedetailleerd", "soldeerscherm"], - "desc": "Gedetailleerde informatie weergeven in een kleiner lettertype op het soldeerscherm." - }, - "ScrollingSpeed": { - "text2": ["Scroll", "snelheid"], - "desc": "Snelheid waarmee de tekst scrolt." - }, - "QCMaxVoltage": { - "text2": ["Power", "Wattage"], - "desc": "Wattage van de gebruikte voeding" - }, - "PDNegTimeout": { - "text2": ["PD", "timeout"], - "desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers (0: disabled)" - }, - "PowerLimit": { - "text2": ["Vermogen", "limiet"], - "desc": "Maximaal vermogen (Watts)" - }, - "ReverseButtonTempChange": { - "text2": ["Draai", "+ - knoppen om"], - "desc": "Keer de +- knoppen om de termperatuur van de punt te regelen om." - }, - "TempChangeShortStep": { - "text2": ["Temp veranderen", "kort"], - "desc": "Temperatuur verandering bij kort drukken" - }, - "TempChangeLongStep": { - "text2": ["Temp veranderen", "lang"], - "desc": "Temperatuur verandering bij lang drukken" - }, - "PowerPulsePower": { - "text2": ["Vermogen", "Puls W"], - "desc": "Vermogen van puls om soldeerbout aan te houden" - }, - "HallEffSensitivity": { - "text2": ["Hall sensor", "sensitivity"], - "desc": "Sensitivity of the Hall effect sensor to detect sleep (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)" - }, - "LockingMode": { - "text2": ["Blokkeer", "knoppen"], - "desc": "Tijdens solderen lang op beide knoppen drukken, blokkeert ze. (U=Uit | B=Alleen boost | V=Volledig blokkeren)" - }, - "MinVolCell": { - "text2": ["Minimum", "voltage"], - "desc": "Minimum allowed voltage per cell (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)" - }, - "AnimLoop": { - "text2": ["Anim.", "loop"], - "desc": "Loop icon animations in main menu" - }, - "AnimSpeed": { - "text2": ["Anim.", "speed"], - "desc": "Pace of icon animations in menu (O=off | S=slow | M=medium | F=fast)" - }, - "PowerPulseWait": { - "text2": ["Power pulse", "delay"], - "desc": "Delay before keep-awake-pulse is triggered (x 2.5s)" - }, - "PowerPulseDuration": { - "text2": ["Power pulse", "duration"], - "desc": "Keep-awake-pulse duration (x 250ms)" - }, - "LanguageSwitch": { - "text2": ["Spraak :", " NL Nederlands"], - "desc": "" - }, - "Brightness": { - "text2": ["Screen", "brightness"], - "desc": "Adjust the brightness of the OLED screen" - }, - "ColourInversion": { - "text2": ["Invert", "screen"], - "desc": "Invert the colours of the OLED screen" - }, - "LOGOTime": { - "text2": ["Boot logo", "duration"], - "desc": "Sets the duration for the boot logo (s=seconds)" - } - } -} +{ + "languageCode": "NL", + "languageLocalName": "Nederlands", + "fonts": [ + "ascii_basic", + "latin_extended" + ], + "tempUnitFahrenheit": false, + "messages": { + "SettingsCalibrationWarning": "Zorg ervoor dat te punt op kamertemperatuur is voor je verder gaat!", + "SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wil zetten?", + "UVLOWarningString": "DC Laag", + "UndervoltageString": "Onderspanning", + "InputVoltageString": "Voeding V: ", + "SleepingSimpleString": "Zzzz", + "SleepingAdvancedString": "Slaapstand...", + "SleepingTipAdvancedString": "Punt:", + "OffString": "Uit" + }, + "messagesWarn": { + "ResetOKMessage": "Reset OK", + "SettingsResetMessage": [ + "Instellingen", + "zijn gereset!" + ], + "NoAccelerometerMessage": [ + "Geen accelerometer", + "gedetecteerd!" + ], + "NoPowerDeliveryMessage": [ + "Geen USB-PD IC ", + "gedetecteerd!" + ], + "LockingKeysString": "GEBLOKKEERD", + "UnlockingKeysString": "GEDEBLOKKEERD", + "WarningKeysLockedString": "!GEBLOKKEERD!", + "WarningThermalRunaway": [ + "Verwarming", + "Oncontroleerbaar" + ] + }, + "characters": { + "SettingRightChar": "R", + "SettingLeftChar": "L", + "SettingAutoChar": "A", + "SettingOffChar": "U", + "SettingSlowChar": "L", + "SettingMediumChar": "G", + "SettingFastChar": "S", + "SettingStartNoneChar": "U", + "SettingStartSolderingChar": "G", + "SettingStartSleepChar": "S", + "SettingStartSleepOffChar": "B", + "SettingSensitivityOff": "U", + "SettingSensitivityLow": "L", + "SettingSensitivityMedium": "G", + "SettingSensitivityHigh": "H", + "SettingLockDisableChar": "U", + "SettingLockBoostChar": "B", + "SettingLockFullChar": "V" + }, + "menuGroups": { + "PowerMenu": { + "text2": [ + "Voeding", + "instellingen" + ], + "desc": "Voeding instellingen" + }, + "SolderingMenu": { + "text2": [ + "Soldeer", + "instellingen" + ], + "desc": "Soldeer instellingen" + }, + "PowerSavingMenu": { + "text2": [ + "Slaap", + "Modes" + ], + "desc": "Stroom besparings instellingen" + }, + "UIMenu": { + "text2": [ + "Weergave", + "instellingen" + ], + "desc": "Weergave instellingen" + }, + "AdvancedMenu": { + "text2": [ + "Geavanceerde", + "instellingen" + ], + "desc": "Geavanceerde instellingen" + } + }, + "menuOptions": { + "DCInCutoff": { + "text2": [ + "Spannings-", + "bron" + ], + "desc": "Spanningsbron. Stelt drempelspanning in. (DC 10V) (S 3.3V per cel)" + }, + "SleepTemperature": { + "text2": [ + "Slaap", + "temp" + ], + "desc": "Punt temperatuur in slaapstand" + }, + "SleepTimeout": { + "text2": [ + "Slaap", + "time-out" + ], + "desc": "Tijd voordat slaapmodus wordt geactiveerd (S=seconden | M=minuten)" + }, + "ShutdownTimeout": { + "text2": [ + "Uitschakel", + "time-out" + ], + "desc": "Tijd voordat soldeerbout automatisch uitschakelt (M=minuten)" + }, + "MotionSensitivity": { + "text2": [ + "Bewegings-", + "gevoeligheid" + ], + "desc": "Bewegingsgevoeligheid (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)" + }, + "TemperatureUnit": { + "text2": [ + "Temperatuur", + "eenheid" + ], + "desc": "Temperatuureenheid (C=Celsius | F=Fahrenheit)" + }, + "AdvancedIdle": { + "text2": [ + "Gedetailleerd", + "startscherm" + ], + "desc": "Gedetailleerde informatie weergeven in een kleine letters op het startscherm." + }, + "DisplayRotation": { + "text2": [ + "Scherm-", + "oriëntatie" + ], + "desc": "Schermoriëntatie (R=Rechtshandig | L=Linkshandig | A=Automatisch)" + }, + "BoostTemperature": { + "text2": [ + "Boost", + "temp" + ], + "desc": "Punt temperatuur in boostmode" + }, + "AutoStart": { + "text2": [ + "Opstart", + "gedrag" + ], + "desc": "Gedrag bij opstarten (U=Uit | G=Gebruiks-temperatuur | S=Slaapstand-temperatuur tot beweging | B=Uit tot beweging)" + }, + "CooldownBlink": { + "text2": [ + "Afkoel", + "flitsen" + ], + "desc": "Temperatuur laten flitsen in het hoofdmenu zo lang de punt nog warm is" + }, + "TemperatureCalibration": { + "text2": [ + "Kalibreer", + "temperatuur?" + ], + "desc": "Start punt temperatuur-kalibratie" + }, + "SettingsReset": { + "text2": [ + "Instellingen", + "resetten?" + ], + "desc": "Alle instellingen terugzetten naar fabrieksinstellingen" + }, + "VoltageCalibration": { + "text2": [ + "Kalibreer", + "input-voltage?" + ], + "desc": "Start VIN Kalibratie (druk lang om te sluiten)" + }, + "AdvancedSoldering": { + "text2": [ + "Gedetailleerd", + "soldeerscherm" + ], + "desc": "Gedetailleerde informatie weergeven in een kleiner lettertype op het soldeerscherm" + }, + "ScrollingSpeed": { + "text2": [ + "Scroll", + "snelheid" + ], + "desc": "Snelheid waarmee de tekst scrolt (S=Snel | L=Langzaam)" + }, + "QCMaxVoltage": { + "text2": [ + "QC", + "Voltage" + ], + "desc": "Maximaal QC voltage dat gevraagd mag worden" + }, + "PDNegTimeout": { + "text2": [ + "PD", + "timeout" + ], + "desc": "PD afstemmingsduur in stappen van 100ms (voor compatibiliteit met sommige QC laders)" + }, + "PowerLimit": { + "text2": [ + "Vermogen", + "limiet" + ], + "desc": "Maximaal vermogen (W=Watt)" + }, + "ReverseButtonTempChange": { + "text2": [ + "Draai", + "+ - knoppen om" + ], + "desc": "Keer de +- knoppen van de temperatuurregeling om" + }, + "TempChangeShortStep": { + "text2": [ + "Temp veranderen", + "kort" + ], + "desc": "Temperatuur verandering bij kort drukken" + }, + "TempChangeLongStep": { + "text2": [ + "Temp veranderen", + "lang" + ], + "desc": "Temperatuur verandering bij lang drukken" + }, + "PowerPulsePower": { + "text2": [ + "Stroom", + "Puls" + ], + "desc": "Intensiteit van stroompuls om voeding aan te houden (watt)" + }, + "HallEffSensitivity": { + "text2": [ + "Hall sensor", + "gevoeligheid" + ], + "desc": "Gevoeligheid van de Hall effect sensor om naar slaapmodus te gaan (0=uit | 1=minst gevoelig | ... | 9=meest gevoelig)" + }, + "LockingMode": { + "text2": [ + "Knopblokkering", + "inschakelen" + ], + "desc": "Tijdens solderen lang op beide knoppen drukken blokkeert de knoppen (U=Uit | B=Alleen boost mode | V=Volledig blokkeren)" + }, + "MinVolCell": { + "text2": [ + "Minimum", + "voltage" + ], + "desc": "Minimum toegestaan voltage per cell (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)" + }, + "AnimLoop": { + "text2": [ + "Animatie", + "herhaling" + ], + "desc": "Herhaal icoon animaties in hoofdmenu" + }, + "AnimSpeed": { + "text2": [ + "Animatie", + "snelheid" + ], + "desc": "Tempo van de icoon animaties in het hoofdmenu (U=uit | L=langzaam | G=gemiddeld | S=snel)" + }, + "PowerPulseWait": { + "text2": [ + "Stroompuls", + "interval" + ], + "desc": "Tijdsduur tussen voeding wakker-blijf-pulsen (x 2.5s)" + }, + "PowerPulseDuration": { + "text2": [ + "Power pulse", + "duur" + ], + "desc": "Duur van voeding-wakker-blijf-pulsen (x 250ms)" + }, + "LanguageSwitch": { + "text2": [ + "Taal:", + " NL Nederlands" + ], + "desc": "Huidige firmware taal" + }, + "Brightness": { + "text2": [ + "Scherm", + "helderheid" + ], + "desc": "Pas helderheid van het OLED scherm aan" + }, + "ColourInversion": { + "text2": [ + "Inverteer", + "scherm" + ], + "desc": "Inverteer de kleuren van het OLED scherm" + }, + "LOGOTime": { + "text2": [ + "Opstart logo", + "duur" + ], + "desc": "Stelt de weergaveduur van het opstartlogo in (s=seconden)" + } + } +} From f7d7f5cd07db9ed6f3ca57025b13d92ab3979b95 Mon Sep 17 00:00:00 2001 From: FaBjE <5355001+FaBjE@users.noreply.github.com> Date: Sat, 14 May 2022 13:33:23 +0200 Subject: [PATCH 33/37] Dutch translation: Fix typo --- Translations/translation_NL.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index caf3216c..a8c752f0 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -7,7 +7,7 @@ ], "tempUnitFahrenheit": false, "messages": { - "SettingsCalibrationWarning": "Zorg ervoor dat te punt op kamertemperatuur is voor je verder gaat!", + "SettingsCalibrationWarning": "Zorg ervoor dat de punt op kamertemperatuur is voor je verder gaat!", "SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wil zetten?", "UVLOWarningString": "DC Laag", "UndervoltageString": "Onderspanning", From 4e46676bec0ef139d7ec5e6c0d56a8268b826c0b Mon Sep 17 00:00:00 2001 From: FaBjE <5355001+FaBjE@users.noreply.github.com> Date: Sat, 14 May 2022 18:39:28 +0200 Subject: [PATCH 34/37] Dutch translation: Fix another typo --- Translations/translation_NL.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Translations/translation_NL.json b/Translations/translation_NL.json index a8c752f0..6b87d022 100644 --- a/Translations/translation_NL.json +++ b/Translations/translation_NL.json @@ -8,7 +8,7 @@ "tempUnitFahrenheit": false, "messages": { "SettingsCalibrationWarning": "Zorg ervoor dat de punt op kamertemperatuur is voor je verder gaat!", - "SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wil zetten?", + "SettingsResetWarning": "Weet je zeker dat je de fabrieksinstellingen terug wilt zetten?", "UVLOWarningString": "DC Laag", "UndervoltageString": "Onderspanning", "InputVoltageString": "Voeding V: ", From e562c3a9f1ce32bd8da9f2d537470c19308bc659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lange?= Date: Tue, 17 May 2022 20:22:15 +0200 Subject: [PATCH 35/37] Add USB autosuspend to troubleshooting for Pinecil --- Documentation/Flashing.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/Flashing.md b/Documentation/Flashing.md index f98e322b..761b9d7c 100644 --- a/Documentation/Flashing.md +++ b/Documentation/Flashing.md @@ -133,6 +133,30 @@ dfu-util -D Pinecil_EN.dfu -a 0 - Switch to a different PC/Laptop and use different ports. USB-C ports are recommended but some have also reported having a fussy C port. - Hold down the (-) button for the entire firmware update, do not release until near the end. - `DC Low` message: a pc/laptop cannot fully power Pinecil, it generally can only get 5 V (non-PD) to communicate for firmware updates and Pinecil will report 'DC Low'. This is normal. +- If `dfu-util` aborts with an error like + ``` + dfu-util: Cannot open DFU device 28e9:0189 found on devnum 42 (LIBUSB_ERROR_IO) + ``` + and `dmesg` reports USB errors like these + ``` + kernel: usb 1-1: reset full-speed USB device number 42 using xhci_hcd + kernel: usb 1-1: device descriptor read/64, error -71 + kernel: usb 1-1: device descriptor read/64, error -71 + kernel: usb 1-1: reset full-speed USB device number 42 using xhci_hcd + kernel: usb 1-1: device descriptor read/64, error -71 + kernel: usb 1-1: device descriptor read/64, error -71 + kernel: usb 1-1: reset full-speed USB device number 42 using xhci_hcd + kernel: usb 1-1: Device not responding to setup address. + kernel: usb 1-1: Device not responding to setup address. + kernel: usb 1-1: device not accepting address 42, error -71 + ``` + then try to disable USB autosuspend. + This can be done with a set of udev rules specifically for the Pinecil: + ```udev + SUBSYSTEM=="usb", ATTR{idVendor}=="28e9", ATTR{idProduct}=="0189", MODE:="0660" + SUBSYSTEM=="usb", ATTR{idVendor}=="28e9", ATTR{idProduct}=="0189", GROUP="plugdev" + SUBSYSTEM=="usb", ATTR{idVendor}=="28e9", ATTR{idProduct}=="0189", TEST=="power/control", ATTR{power/control}="on" + ``` ## Windows From 8da8960192c81dcb449bef46e5d85ce042c50bb5 Mon Sep 17 00:00:00 2001 From: JugglerLKR Date: Thu, 26 May 2022 20:01:45 +0300 Subject: [PATCH 36/37] Update translation_RU.json --- Translations/translation_RU.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Translations/translation_RU.json b/Translations/translation_RU.json index 19261607..085b182f 100644 --- a/Translations/translation_RU.json +++ b/Translations/translation_RU.json @@ -132,7 +132,7 @@ "desc": "Скорость прокрутки текста (М=медленно | Б=быстро)" }, "QCMaxVoltage": { - "text2": ["Максимальное", "напряжение QC"], + "text2": ["Ограничение", "напряжения QC"], "desc": "Максимальное напряжение для согласования с QC источником питания" }, "PDNegTimeout": { From e2eea84e36ac4ebb0e4baea86331e9fff73dd9e6 Mon Sep 17 00:00:00 2001 From: discip <53649486+discip@users.noreply.github.com> Date: Tue, 14 Jun 2022 07:12:20 +0200 Subject: [PATCH 37/37] removed some more redundant entries (#1312) --- source/Core/BSP/Miniware/configuration.h | 398 +++++++++++------------ 1 file changed, 185 insertions(+), 213 deletions(-) diff --git a/source/Core/BSP/Miniware/configuration.h b/source/Core/BSP/Miniware/configuration.h index 867810aa..f33952a0 100644 --- a/source/Core/BSP/Miniware/configuration.h +++ b/source/Core/BSP/Miniware/configuration.h @@ -1,236 +1,208 @@ #ifndef CONFIGURATION_H_ -#define CONFIGURATION_H_ -#include "Settings.h" -#include -/** - * Configuration.h - * Define here your default pre settings for TS80(P) or TS100 - * - */ + #define CONFIGURATION_H_ + #include "Settings.h" + #include + /** + * Configuration.h + * Define here your default pre settings for TS80(P) or TS100 + * + */ -//=========================================================================== -//============================= Default Settings ============================ -//=========================================================================== -/** - * Default soldering temp is 320.0 C - * Temperature the iron sleeps at - default 150.0 C - */ + //=========================================================================== + //============================= Default Settings ============================ + //=========================================================================== + /** + * Default soldering temp is 320.0 C + * Temperature the iron sleeps at - default 150.0 C + */ -#define SLEEP_TEMP 150 // Default sleep temperature -#define BOOST_TEMP 420 // Default boost temp. -#define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable + #define SLEEP_TEMP 150 // Default sleep temperature + #define BOOST_TEMP 420 // Default boost temp. + #define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable -/** - * Blink the temperature on the cooling screen when its > 50C - */ -#define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable + /** + * Blink the temperature on the cooling screen when its > 50C + */ + #define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable -/** - * How many seconds/minutes we wait until going to sleep/shutdown. - * Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds! - */ -#define SLEEP_TIME 5 // x10 Seconds -#define SHUTDOWN_TIME 10 // Minutes + /** + * How many seconds/minutes we wait until going to sleep/shutdown. + * Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds! + */ + #define SLEEP_TIME 5 // x10 Seconds + #define SHUTDOWN_TIME 10 // Minutes -/** - * Auto start off for safety. - * Pissible values are: - * 0 - none - * 1 - Soldering Temperature - * 2 - Sleep Temperature - * 3 - Sleep Off Temperature - */ -#define AUTO_START_MODE 0 // Default to none + /** + * Auto start off for safety. + * Pissible values are: + * 0 - none + * 1 - Soldering Temperature + * 2 - Sleep Temperature + * 3 - Sleep Off Temperature + */ + #define AUTO_START_MODE 0 // Default to none -/** - * Locking Mode - * When in soldering mode a long press on both keys toggle the lock of the buttons - * Possible values are: - * 0 - Desactivated - * 1 - Lock except boost - * 2 - Full lock - */ -#define LOCKING_MODE 0 // Default to desactivated for safety + /** + * Locking Mode + * When in soldering mode a long press on both keys toggle the lock of the buttons + * Possible values are: + * 0 - Desactivated + * 1 - Lock except boost + * 2 - Full lock + */ + #define LOCKING_MODE 0 // Default to desactivated for safety -/** - * OLED Orientation - * - */ -#define ORIENTATION_MODE 2 // 0: Right 1:Left 2:Automatic - Default Automatic -#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change + /** + * OLED Orientation + * + */ + #define ORIENTATION_MODE 2 // 0: Right 1:Left 2:Automatic - Default Automatic + #define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change -/** - * Temp change settings - */ -#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1 -#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10 -#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value -#define TEMP_CHANGE_LONG_STEP_MAX 90 // Temp change long step MAX value + /** + * Temp change settings + */ + #define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1 + #define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10 + #define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value + #define TEMP_CHANGE_LONG_STEP_MAX 90 // Temp change long step MAX value -/* Power pulse for keeping power banks awake*/ -#define POWER_PULSE_INCREMENT 1 -#define POWER_PULSE_MAX 100 // x10 max watts -#define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds -#define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds + /* Power pulse for keeping power banks awake*/ + #define POWER_PULSE_INCREMENT 1 + #define POWER_PULSE_MAX 100 // x10 max watts + #define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds + #define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds -#ifdef MODEL_TS100 -#define POWER_PULSE_DEFAULT 0 -#else -#define POWER_PULSE_DEFAULT 5 -#endif -#define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s -#define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms + #ifdef MODEL_TS100 + #define POWER_PULSE_DEFAULT 0 + #else + #define POWER_PULSE_DEFAULT 5 + #endif + #define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s + #define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms -/** - * OLED Orientation Sensitivity on Automatic mode! - * Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive> - */ -#define SENSITIVITY 7 // Default 7 + /** + * OLED Orientation Sensitivity on Automatic mode! + * Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive> + */ + #define SENSITIVITY 7 // Default 7 -/** - * Detailed soldering screen - * Detailed idle screen (off for first time users) - */ -#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 -#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 + /** + * Detailed soldering screen + * Detailed idle screen (off for first time users) + */ + #define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 + #define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 -#define THERMAL_RUNAWAY_TIME_SEC 20 -#define THERMAL_RUNAWAY_TEMP_C 10 + #define THERMAL_RUNAWAY_TIME_SEC 20 + #define THERMAL_RUNAWAY_TEMP_C 10 -#define CUT_OUT_SETTING 0 // default to no cut-off voltage -#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) -#define TEMPERATURE_INF 0 // default to 0 -#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow -#define ANIMATION_LOOP 1 // 0: off 1: on -#define ANIMATION_SPEED settingOffSpeed_t::MEDIUM + #define CUT_OUT_SETTING 0 // default to no cut-off voltage + #define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) + #define TEMPERATURE_INF 0 // default to 0 + #define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow + #define ANIMATION_LOOP 1 // 0: off 1: on + #define ANIMATION_SPEED settingOffSpeed_t::MEDIUM -#define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1 -#define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2 + #define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1 + #define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2 -#define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100)) + #define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100)) -#define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6 -#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3 + #define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6 + #define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3 -#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80)) + #define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80)) -// Deriving the Voltage div: -// Vin_max = (3.3*(r1+r2))/(r2) -// vdiv = (32768*4)/(vin_max*10) + // Deriving the Voltage div: + // Vin_max = (3.3*(r1+r2))/(r2) + // vdiv = (32768*4)/(vin_max*10) -#if defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) > 1 -#error "Multiple models defined!" -#elif defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) == 0 -#error "No model defined!" + #if defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) > 1 + #error "Multiple models defined!" + #elif defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) == 0 + #error "No model defined!" + #endif + + // Miniware is swapping IMU's around a bit now, so we turn them all on + + #define ACCEL_MMA + #define ACCEL_LIS + #define ACCEL_SC7 + #define ACCEL_MSA + #define ACCEL_BMA + + #define MIN_CALIBRATION_OFFSET 100 // Min value for calibration + #define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C + #define PID_TIM_HZ (8) // Tick rate of the PID loop + #define MAX_TEMP_C 450 // Max soldering temp selectable °C + #define MAX_TEMP_F 850 // Max soldering temp selectable °F + #define MIN_TEMP_C 10 // Min soldering temp selectable °C + #define MIN_TEMP_F 60 // Min soldering temp selectable °F + #define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C + #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F + + #ifdef MODEL_TS100 + #define VOLTAGE_DIV 467 // 467 - Default divider from schematic + #define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV + #define PID_POWER_LIMIT 70 // Sets the max pwm power limit + #define POWER_LIMIT 0 // 0 watts default limit + #define MAX_POWER_LIMIT 70 + #define POWER_LIMIT_STEPS 5 + #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 + #define TEMP_uV_LOOKUP_HAKKO + #define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate + + #define HARDWARE_MAX_WATTAGE_X10 750 + #define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second + #define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips + + #define POW_DC + #define POW_PD 0 + #define TEMP_TMP36 + #endif + + #if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0 + #define MAX_POWER_LIMIT 40 + #define POWER_LIMIT_STEPS 2 + #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 + #define TEMP_uV_LOOKUP_TS80 + #define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate + + #define TIP_THERMAL_MASS 40 + #define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips + + #define LIS_ORI_FLIP + #define OLED_FLIP + #endif + + #ifdef MODEL_TS80 + #define VOLTAGE_DIV 780 // Default divider from schematic + #define CALIBRATION_OFFSET 900 // the adc offset in uV + #define PID_POWER_LIMIT 24 // Sets the max pwm power limit + #define POWER_LIMIT 24 // 24 watts default power limit + + #define HARDWARE_MAX_WATTAGE_X10 180 + + #define POW_QC + #define POW_PD 0 + #define TEMP_TMP36 + #endif + + #ifdef MODEL_TS80P + #define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors + #define CALIBRATION_OFFSET 1500 // the adc offset in uV + #define PID_POWER_LIMIT 35 // Sets the max pwm power limit + #define POWER_LIMIT 30 // 30 watts default power limit + + #define HARDWARE_MAX_WATTAGE_X10 300 + + #define POW_PD 1 + #define POW_QC 1 + #define TEMP_NTC + #define I2C_SOFT + #define SC7_ORI_FLIP + #endif #endif -// Miniware is swapping IMU's around a bit now, so we turn them all on - -#define ACCEL_MMA -#define ACCEL_LIS -#define ACCEL_SC7 -#define ACCEL_MSA -#define ACCEL_BMA - -#ifdef MODEL_TS100 -#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C -#define VOLTAGE_DIV 467 // 467 - Default divider from schematic -#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV -#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration -#define PID_POWER_LIMIT 70 // Sets the max pwm power limit -#define POWER_LIMIT 0 // 0 watts default limit -#define MAX_POWER_LIMIT 70 // -#define POWER_LIMIT_STEPS 5 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 // -#define TEMP_uV_LOOKUP_HAKKO // -#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate -#define PID_TIM_HZ (8) // Tick rate of the PID loop -#define MAX_TEMP_C 450 // Max soldering temp selectable °C -#define MAX_TEMP_F 850 // Max soldering temp selectable °F -#define MIN_TEMP_C 10 // Min soldering temp selectable °C -#define MIN_TEMP_F 60 // Min soldering temp selectable °F -#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C -#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F -#define POW_DC - -#define POW_PD 0 - -#define TEMP_TMP36 -#endif - -#ifdef MODEL_TS80 -#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C -#define VOLTAGE_DIV 780 // Default divider from schematic -#define PID_POWER_LIMIT 24 // Sets the max pwm power limit -#define CALIBRATION_OFFSET 900 // the adc offset in uV -#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration -#define POWER_LIMIT 24 // 24 watts default power limit -#define MAX_POWER_LIMIT 40 // -#define POWER_LIMIT_STEPS 2 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 // -#define TEMP_uV_LOOKUP_TS80 // -#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate -#define PID_TIM_HZ (8) // Tick rate of the PID loop -#define MAX_TEMP_C 450 // Max soldering temp selectable °C -#define MAX_TEMP_F 850 // Max soldering temp selectable °F -#define MIN_TEMP_C 10 // Min soldering temp selectable °C -#define MIN_TEMP_F 60 // Min soldering temp selectable °F -#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C -#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F - -#define POW_QC -#define POW_PD 0 -#define TEMP_TMP36 -#define LIS_ORI_FLIP -#define OLED_FLIP -#endif - -#ifdef MODEL_TS80P -#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C -#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors -#define PID_POWER_LIMIT 35 // Sets the max pwm power limit -#define CALIBRATION_OFFSET 1500 // the adc offset in uV -#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration -#define POWER_LIMIT 30 // 30 watts default power limit -#define MAX_POWER_LIMIT 40 // -#define POWER_LIMIT_STEPS 2 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 // -#define TEMP_uV_LOOKUP_TS80 // -#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate -#define PID_TIM_HZ (8) // Tick rate of the PID loop -#define MAX_TEMP_C 450 // Max soldering temp selectable °C -#define MAX_TEMP_F 850 // Max soldering temp selectable °F -#define MIN_TEMP_C 10 // Min soldering temp selectable °C -#define MIN_TEMP_F 60 // Min soldering temp selectable °F -#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C -#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F - -#define POW_PD 1 -#define POW_QC 1 -#define TEMP_NTC -#define I2C_SOFT -#define LIS_ORI_FLIP -#define SC7_ORI_FLIP -#define OLED_FLIP -#endif - -#ifdef MODEL_TS100 -#define HARDWARE_MAX_WATTAGE_X10 750 -#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second -#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips -#endif - -#ifdef MODEL_TS80 -#define HARDWARE_MAX_WATTAGE_X10 180 -#define TIP_THERMAL_MASS 40 -#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips -#endif - -#ifdef MODEL_TS80P -#define HARDWARE_MAX_WATTAGE_X10 300 -#define TIP_THERMAL_MASS 40 -#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips -#endif -#endif - -#define FLASH_LOGOADDR (0x08000000 + (62 * 1024)) \ No newline at end of file +#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))