mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Merge branch 'dev' into pd-epr
This commit is contained in:
@@ -29,6 +29,9 @@ _This firmware does **NOT** support the USB port while running for changing sett
|
||||
| TS80 | ❌ | ✔️ | ❌ | ❌ |
|
||||
| TS80P | ❌ | ✔️ | ✔️ | ✔️ |
|
||||
|
||||
Please note that Miniware have started to ship TS100's using cloned STM32 Chips. While these do work with IronOS, their DFU bootloader works terribly and it is hard to get it to successfully flash larger firmware images like IronOS without timing out. THis is the main reason why the TS100 is _no longer reccomended_.
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
To get started with IronOS firmware, please jump to [Getting Started Guide](Documentation/GettingStarted.md).
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "projdefs.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -100,7 +100,7 @@ extern uint32_t SystemCoreClock;
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ (SystemCoreClock)
|
||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
#define configTICK_RATE_HZ (1000)
|
||||
#define configMAX_PRIORITIES (6)
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#ifndef PORTMACRO_H
|
||||
#define PORTMACRO_H
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include "projdefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -58,14 +58,9 @@ typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
typedef unsigned long UBaseType_t;
|
||||
|
||||
#if (configUSE_16_BIT_TICKS == 1)
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY (TickType_t)0xffff
|
||||
#else
|
||||
/* RISC-V TIMER is 64-bit long */
|
||||
typedef uint64_t TickType_t;
|
||||
#define portMAX_DELAY (TickType_t)0xFFFFFFFFFFFFFFFFULL
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "settingsGUI.hpp"
|
||||
#include "task.h"
|
||||
#include <Buttons.hpp>
|
||||
uint32_t lastButtonTime = 0;
|
||||
TickType_t lastButtonTime = 0;
|
||||
|
||||
ButtonState getButtonState() {
|
||||
/*
|
||||
@@ -23,8 +23,9 @@ ButtonState getButtonState() {
|
||||
* (downtime>filter)
|
||||
*/
|
||||
static uint8_t previousState = 0;
|
||||
static uint32_t previousStateChange = 0;
|
||||
const uint16_t timeout = TICKS_100MS * 4;
|
||||
static bool longPressed = false;
|
||||
static TickType_t previousStateChange = 0;
|
||||
const TickType_t timeout = TICKS_100MS * 4;
|
||||
uint8_t currentState;
|
||||
currentState = (getButtonA()) << 0;
|
||||
currentState |= (getButtonB()) << 1;
|
||||
@@ -34,9 +35,10 @@ ButtonState getButtonState() {
|
||||
if (currentState == previousState) {
|
||||
if (currentState == 0)
|
||||
return BUTTON_NONE;
|
||||
if ((xTaskGetTickCount() - previousStateChange) > timeout) {
|
||||
if ((xTaskGetTickCount() - previousStateChange) >= timeout) {
|
||||
// User has been holding the button down
|
||||
// We want to send a button is held message
|
||||
longPressed = true;
|
||||
if (currentState == 0x01)
|
||||
return BUTTON_F_LONG;
|
||||
else if (currentState == 0x02)
|
||||
@@ -50,19 +52,15 @@ ButtonState getButtonState() {
|
||||
ButtonState retVal = BUTTON_NONE;
|
||||
if (currentState) {
|
||||
// User has pressed a button down (nothing done on down)
|
||||
if (currentState != previousState) {
|
||||
// There has been a change in the button states
|
||||
// If there is a rising edge on one of the buttons from double press we
|
||||
// want to mask that out As users are having issues with not release
|
||||
// both at once
|
||||
if (previousState == 0x03)
|
||||
currentState = 0x03;
|
||||
}
|
||||
previousState |= currentState;
|
||||
} else {
|
||||
// User has released buttons
|
||||
// If they previously had the buttons down we want to check if they were <
|
||||
// long hold and trigger a press
|
||||
if ((xTaskGetTickCount() - previousStateChange) < timeout) {
|
||||
if (!longPressed) {
|
||||
// The user didn't hold the button for long
|
||||
// So we send button press
|
||||
|
||||
@@ -73,8 +71,9 @@ ButtonState getButtonState() {
|
||||
else
|
||||
retVal = BUTTON_BOTH; // Both being held case
|
||||
}
|
||||
previousState = 0;
|
||||
longPressed = false;
|
||||
}
|
||||
previousState = currentState;
|
||||
previousStateChange = xTaskGetTickCount();
|
||||
return retVal;
|
||||
}
|
||||
@@ -95,7 +94,7 @@ void waitForButtonPress() {
|
||||
}
|
||||
}
|
||||
|
||||
void waitForButtonPressOrTimeout(uint32_t timeout) {
|
||||
void waitForButtonPressOrTimeout(TickType_t timeout) {
|
||||
timeout += xTaskGetTickCount();
|
||||
// calculate the exit point
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include "BSP.h"
|
||||
#ifndef INC_BUTTONS_H_
|
||||
#define INC_BUTTONS_H_
|
||||
|
||||
extern uint32_t lastButtonTime;
|
||||
#include "portmacro.h"
|
||||
extern TickType_t lastButtonTime;
|
||||
|
||||
enum ButtonState {
|
||||
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
|
||||
@@ -29,7 +29,7 @@ enum ButtonState {
|
||||
// Returns what buttons are pressed (if any)
|
||||
ButtonState getButtonState();
|
||||
// Helpers
|
||||
void waitForButtonPressOrTimeout(uint32_t timeout);
|
||||
void waitForButtonPressOrTimeout(TickType_t timeout);
|
||||
void waitForButtonPress();
|
||||
|
||||
#endif /* INC_BUTTONS_H_ */
|
||||
|
||||
@@ -252,9 +252,9 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
|
||||
uint8_t *firstBackStripPtr = &secondFrameBuffer[0];
|
||||
uint8_t *secondBackStripPtr = &secondFrameBuffer[OLED_WIDTH];
|
||||
|
||||
uint32_t totalDuration = TICKS_100MS * 5; // 500ms
|
||||
uint32_t duration = 0;
|
||||
uint32_t start = xTaskGetTickCount();
|
||||
TickType_t totalDuration = TICKS_100MS * 5; // 500ms
|
||||
TickType_t duration = 0;
|
||||
TickType_t start = xTaskGetTickCount();
|
||||
uint8_t offset = 0;
|
||||
|
||||
while (duration <= totalDuration) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef SCROLL_MESSAGE_HPP_
|
||||
#define SCROLL_MESSAGE_HPP_
|
||||
|
||||
#include "portmacro.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* A helper class for showing a full-screen scrolling message.
|
||||
*/
|
||||
class ScrollMessage {
|
||||
uint32_t messageStart = 0;
|
||||
TickType_t messageStart = 0;
|
||||
int16_t lastOffset = -1;
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
* @param currentTick The current tick as returned by `xTaskGetTickCount()`.
|
||||
* @return Whether the OLED framebuffer has been modified.
|
||||
*/
|
||||
bool drawUpdate(const char *message, uint32_t currentTick);
|
||||
bool drawUpdate(const char *message, TickType_t currentTick);
|
||||
};
|
||||
|
||||
#endif /* SCROLL_MESSAGE_HPP_ */
|
||||
|
||||
@@ -30,7 +30,7 @@ static uint16_t str_display_len(const char *const str) {
|
||||
|
||||
uint16_t ScrollMessage::messageWidth(const char *message) { return FONT_12_WIDTH * str_display_len(message); }
|
||||
|
||||
bool ScrollMessage::drawUpdate(const char *message, uint32_t currentTick) {
|
||||
bool ScrollMessage::drawUpdate(const char *message, TickType_t currentTick) {
|
||||
bool lcdRefresh = false;
|
||||
|
||||
if (messageStart == 0) {
|
||||
|
||||
@@ -171,9 +171,9 @@ static void gui_drawBatteryIcon() {
|
||||
#endif
|
||||
}
|
||||
static void gui_solderingTempAdjust() {
|
||||
uint32_t lastChange = xTaskGetTickCount();
|
||||
TickType_t lastChange = xTaskGetTickCount();
|
||||
currentTempTargetDegC = 0; // Turn off header while adjusting temp
|
||||
uint32_t autoRepeatTimer = 0;
|
||||
TickType_t autoRepeatTimer = 0;
|
||||
uint8_t autoRepeatAcceleration = 0;
|
||||
bool waitForRelease = false;
|
||||
ButtonState buttons = getButtonState();
|
||||
@@ -370,7 +370,7 @@ static void display_countdown(int sleepThres) {
|
||||
* Print seconds or minutes (if > 99 seconds) until sleep
|
||||
* mode is triggered.
|
||||
*/
|
||||
int lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
|
||||
TickType_t lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
|
||||
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
|
||||
if (downCount > (99 * TICKS_SECOND)) {
|
||||
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
|
||||
|
||||
@@ -114,7 +114,7 @@ int32_t getPIDResultX10Watts(int32_t setpointDelta) {
|
||||
static TickType_t lastCall = 0;
|
||||
static Integrator<int32_t> powerStore = {0};
|
||||
|
||||
const int rate = 1000 / (xTaskGetTickCount() - lastCall);
|
||||
const TickType_t rate = 1000 / (xTaskGetTickCount() - lastCall);
|
||||
lastCall = xTaskGetTickCount();
|
||||
// Sandman note:
|
||||
// PID Challenge - we have a small thermal mass that we to want heat up as fast as possible but we don't
|
||||
|
||||
Reference in New Issue
Block a user