1
0
forked from me/IronOS

Compare commits

...

19 Commits

Author SHA1 Message Date
Ben V. Brown
f716578138 Stop adjust buttons auto-rotating
Closes #270
2018-07-29 11:57:24 +10:00
Ben V. Brown
8ddfa0e275 Adding Norwegian (bokmål) translation
Merged in #277 locally, may need updates but better to get something in.
Closes #277
2018-07-29 11:40:25 +10:00
Yuri Schaeffer
9127802acc Display seconds until sleep in soldering mode. (#311)
Adds a number indicator to the detailed soldering mode that shows the pending time until the iron goes to sleep.
2018-07-29 11:35:25 +10:00
Ben V. Brown
2494522e85 Fix encoding screwup 2018-07-29 11:35:05 +10:00
Ben V. Brown
3d1d47acee Long overdue additions
Closes #329
Closes #324
Closes #331
Should Close #321
Should Close #301
2018-07-27 19:21:12 +10:00
Julius Vitkauskas
e598d1cbbb Update Lithuanian translation (#335) 2018-07-27 16:22:44 +10:00
nils måsén
20d1874aee Add Swedish translation (#318)
* Swedish language
2018-06-20 08:43:12 +10:00
Alessandro Gatti
030a714ff2 Initialise variables before usage / Cleanup (#315) 2018-06-17 09:41:53 +10:00
L0laapk3
67066f218f added dutch translation (#307)
* added dutch translation

* fixed caps

* dutch language improvements

* dutch language improvements
2018-06-02 10:44:26 +10:00
Alessandro Gatti
50fe2bcff1 Shrink GUI code and simplify LCD rotation. (#300)
* Inline more methods in FRToSI2C.

* Shrink down GUI code.

* Simplify LCD rotation handling.

* Extract version headers.
2018-05-26 14:21:42 +10:00
dogtopus
a576f44ba2 Add binary generation (#310) 2018-05-26 14:21:06 +10:00
Ben V. Brown
74de59c235 Update readme 2018-05-25 22:24:20 +10:00
Valmantas Palikša
fc669dc274 Use LTO to save up to 7k of flash (#305) 2018-05-18 18:54:57 +10:00
Ben V. Brown
b0b512030f Fix up menu icons
Sorry this got lost 😠
Fixed now :)
Fixes #214 finally.
2018-05-11 13:10:36 +10:00
Ben V. Brown
48cc1ff8cc Add auto-repeat to temp adjust
Fixes #285
2018-05-11 13:06:10 +10:00
Ben V. Brown
c9a56392a0 Bring back cooling blink
Fixes #289
2018-05-11 13:01:21 +10:00
Ben V. Brown
b6b207568c Delay I2C DMA thread on oled slightly
The flickering on the LCD screen was caused by the OLED DMA taking slightly longer than the delays, so the tail end would flicker if the buffer was cleared before it finished writing.

In future may want to double buffer the LCD.

Fixes #290
2018-05-11 12:54:55 +10:00
Alessandro Gatti
8bf65351ea Shrink OLED driver code. (#296)
* Precompute command header.
* Update data header on-demand.
* Use more aggressive inlining.
* Do not clear number buffer twice.
2018-05-11 12:32:37 +10:00
Alessandro Gatti
215fe8e9e8 Reduce code size for accelerometer support (#288)
* Reduce the LIS2DH12 driver's code size.
* Reduce the MMA8652FC driver's code size.
* Make orientation detection smaller.


* Inlined C++ class constructor.
* De-unroll I2C register writes.
* Removed unused setSensitivity method.
2018-05-10 10:02:29 +10:00
17 changed files with 1755 additions and 1418 deletions

View File

@@ -1,10 +1,12 @@
# TS100
This is a complete rewrite of the open source software for the ts100 soldering iron.
The version two fork of this code has no shared code with the original firmware from Miniware (E-design) group.
This project is considered feature complete for use as a soldering iron, *so please suggest any feature improvements you would like!*
A short(ish) video that goes through every single menu option in the firmware is available [over here](https://www.youtube.com/watch?v=WlnpboYfxNk).
This video was created on an earlier 1.x version of the firmware, so alot has changed and a new video will be coming soon for the 2.x fork.
This video was created on an earlier 1.x version of the firmware, so alot has changed but should be fairly intuitive as the menu has vastly improved.
*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.*
@@ -12,6 +14,7 @@ This video was created on an earlier 1.x version of the firmware, so alot has ch
Please calibrate your irons voltage reading when you are using a lithium battery after any firmware upgrades.*
## Features
* PID iron temperature control
* Automatic sleep with selectable sensitivity
* Motion wake support
@@ -26,10 +29,11 @@ Please calibrate your irons voltage reading when you are using a lithium battery
* Battery charge level indicatior if power source set to a lipo cell count.
* Custom bootup logo support
* Automatic LCD rotation based on orientation
* Supports both the version 1 and version 2 hardware
## Upgrading your ts100 iron
This is completely safe, if it goes wrong just put the .hex file from the official website onto the unit and your back to the old firmware. Downloads for the hex files to flash are available on the [releases page.](https://github.com/Ralim/ts100/releases) The file you want is called *ts100.hex* unless you want the translations, they are ts100_*language short name*.hex.
This is completely safe, if it goes wrong just put the .hex file from the official website onto the unit and your back to the old firmware. Downloads for the hex files to flash are available on the [releases page.](https://github.com/Ralim/ts100/releases) The file you want is called *ts100_EN.hex* unless you want the translations, they are ts100_*language short name*.hex.
Officially the bootloader on the iron only works under windows. 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).
@@ -55,10 +59,12 @@ There are further instructions on the [wiki](https://github.com/Ralim/ts100/wiki
This new firmware uses a new menu system to allow access to the settings on the device.
When on the main screen, the unit shows prompts for the two most common operations.
* Pressing the button near the tip enters soldering mode
* Pressing the button near the USB enters the settings menu.
* Holding the button near the tip will enter soldering temperature adjust mode (This is the same as the one in the soldering menu, just to let you edit before heating up).
* Holding the button near the USB end will show the firmware version details.
## Soldering mode
In this mode the iron works as you would expect, pressing either button will take you to a temperature change screen.
@@ -70,23 +76,12 @@ 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, and some settings such as screen flip do not apply until a power cycle is applied.
If you leave the unit alone (ie don't press any buttons) on a setting, after 3 seconds the screen will scroll a longer version of the name
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.
* PWRSC -> Power source, select a cell count if using a LiPo, or DC to disable the shutdown. (Sets it to minimum of 10V).
* STMP -> The temperature the unit drops to in sleep mode
* SLTME -> Sleep time, how long it takes before the unit goes to sleep
* SHTME -> Shutdown Time, how long the unit will wait after movement before shutting down completely
* MSENSE -> Motion Sensitivity,0*9,0 means motion sensing is turned off, 9 is most sensitive, 1 is least sensitive (ie takes more movement to trigger)
* ADVDSP -> Enable the advanced display (shows more details)
* DSPROT -> Display rotation mode, Automatic, Left handed or Right handed
* BOOST -> Enable boost mode
* BTMP -> Set the temperature for the boost mode
* ASART -> Automatically start the unit when power is applied (i.e. the unit will go straight into soldering mode)
* CLBLNK -> Blink the screen as an alert when cooling down
* TMP CAL -> Use to calibrate offset on the tip temperature
* RESET -> Use to force a complete reset on exit of the settings menu
* TMPUNIT -> Temperature unit, C or F
The menu is arranged so that the most often used settings are first.
With submenu's being selected to enter using the front button (as if you were going to change the setting).
Scrolling through the submenu will return you back to its entry location after you scroll through all of the options.
### Calibrating input voltage
@@ -99,19 +94,11 @@ To calibrate your Iron:
1. Measure the input voltage with a multimeter and note it down.
2. Connect the input to your iron.
3. On the home screen (showing iron symbol), press both buttons simultainiously.
4. The iron will now show the tip temperature.
5. Press the button near the soldering iron tip.
6. The screen will display the measured input voltage.
7. If this is the same as what you measured before skip to step 13
8. Otherwise, press the button near the USB end of the iron
9. The voltage will now slowly blink.
10. Use the buttons to adjust the reading up and down until it reads as close as possible to the voltage you measured earlier.
11. When it is reading as close as possible, press both buttons at once.
12. The screen will go back to just showing the input voltage.
13. Press the button near the tip of the iron to exit back to the live temperature display.
14. Press both buttons at once to exit back to the idle screen.
15. You're done. Enjoy your iron.
3. Enter the settings menu
4. Under the advanced submenu
5. Select the calibrate voltage option
6. Use the front and back buttons to adjust the displayed voltage to minimise the error to your origional measurement
7. Hold both buttons to save and exit to the menu
### Calibrating tip offset
@@ -120,7 +107,7 @@ Some tips will have an offset on their readings, to calibrate this out perform t
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)
3. Enter the settings menu
4. Scroll down to *TMP CAL*
4. Scroll down to the advanced menu, and then the temperature calibration
5. Press the button to change the option (tip button)
6. The display will start to scroll a warning message to check that the tip is at ambient temperature!
7. Press the button near the tip of the iron to confirm.
@@ -135,7 +122,6 @@ This allows you to change the front key (one near the tip) to become a boost but
The boost temperature is set in the settings menu.
## Thanks
If you love this firmware and want to continue my caffine addiction, you can do so here (or email me for other options) : https://paypal.me/RalimTek

View File

@@ -32,7 +32,7 @@ HEXFILE_DIR=Hexfile
OUTPUT_DIR=Objects
# code optimisation ------------------------------------------------------------
OPTIM=-Os -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections
# global defines ---------------------------------------------------------------
@@ -73,7 +73,7 @@ LINKER_FLAGS=-Wl,--gc-sections \
-mcpu=cortex-m3 \
-mthumb \
-mfloat-abi=soft \
-lm
-lm -Os -flto -Wl,--undefined=vTaskSwitchContext
# compiler flags ---------------------------------------------------------------
CPUFLAGS=-D GCC_ARMCM3 \
@@ -177,7 +177,7 @@ OUT_OBJS_CPP=$(addprefix $(OUTPUT_DIR)/,$(OBJS_CPP))
OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S))
OUT_HEXFILE=$(addprefix $(HEXFILE_DIR)/,$(OUTPUT_EXE))
all: $(OUT_HEXFILE).hex
all: $(OUT_HEXFILE).hex $(OUT_HEXFILE).bin
#
# The rule to create the target directory
@@ -185,13 +185,17 @@ all: $(OUT_HEXFILE).hex
# Create hexfile
%.hex : %.elf
$(SIZE) -x $^
$(SIZE) $^
$(OBJCOPY) $^ -O ihex $@
%.bin : %.elf
$(SIZE) $^
$(OBJCOPY) $^ -O binary $@
$(OUT_HEXFILE).elf : $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $(OUTPUT_EXE).elf
@$(CPP) $(CXXFLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS) $(LINKER_FLAGS)
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) $(LIBS) $(LINKER_FLAGS)
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
@test -d $(@D) || mkdir -p $(@D)

View File

@@ -35,3 +35,5 @@ make -j16 lang=LT
rm -rf Objects/src
make -j16 lang=UA
rm -rf Objects/src
make -j16 lang=SR
rm -rf Objects/src

View File

@@ -12,8 +12,16 @@
class FRToSI2C {
public:
FRToSI2C(I2C_HandleTypeDef* i2chandle);
void FRToSInit();
FRToSI2C(I2C_HandleTypeDef *i2chandle) : i2c(i2chandle),
I2CSemaphore(nullptr) {
}
void FRToSInit() {
I2CSemaphore = xSemaphoreCreateBinary();
xSemaphoreGive(I2CSemaphore);
}
void CpltCallback(); //Normal Tx Callback
void Mem_Read(uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize,

View File

@@ -602,16 +602,20 @@ const uint8_t SettingsMenuIcons[] = {
// Soldering
//width = 16
//height = 16
0x00,0x02,0x04,0x08,0x12,0x24,0xC4,0x42,0x82,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x07,0x0A,0x14,0x28,0x50,0x60,0x00,
0x00, 0x02, 0x04, 0x08, 0x12, 0x24, 0xC4, 0x42, 0x82, 0x04,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x02, 0x07, 0x0A, 0x14, 0x28, 0x50,
0x60, 0x00,
//Sleep
//width = 16
//height = 16
0x00,0xC6,0xE6,0xF6,0xBE,0x9E,0x8E,0x86,0x00,0x00,0x40,0x40,0xC0,0xC0,0xC0,0x00,
0x00,0x01,0x01,0x01,0x45,0x65,0x75,0x5D,0x4C,0x00,0x06,0x07,0x07,0x05,0x04,0x00,
0x00, 0xC6, 0xE6, 0xF6, 0xBE, 0x9E, 0x8E, 0x86, 0x00, 0x00,
0x40, 0x40, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x01, 0x01, 0x01,
0x45, 0x65, 0x75, 0x5D, 0x4C, 0x00, 0x06, 0x07, 0x07, 0x05,
0x04, 0x00,
@@ -624,14 +628,18 @@ const uint8_t SettingsMenuIcons[] = {
//Wrench
///width = 16
//height = 16
0x00,0x18,0x30,0x32,0x7E,0x7C,0xF0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x0F,0x3E,0x7E,0x4C,0x0C,0x18,0x00,
0x00, 0x18, 0x30, 0x32, 0x7E, 0x7C, 0xF0, 0xC0, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, 0x3E, 0x7E, 0x4C, 0x0C,
0x18, 0x00,
#ifdef NOTUSED
//Calibration (Not used, kept for future menu layouts)
//width = 16
//height = 16
0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE8,0x70,0x7A,0x5E,0x8E,0x1C,0x30,0x00,
0x00,0x10,0x38,0x1C,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE8, 0x70,
0x7A, 0x5E, 0x8E, 0x1C, 0x30, 0x00, 0x00, 0x10, 0x38, 0x1C,
0x0E, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
#endif
};

View File

@@ -10,16 +10,16 @@
#include "stm32f1xx_hal.h"
#include "FRToSI2C.hpp"
#include "LIS2DH12_defines.hpp"
#include "hardware.h"
class LIS2DH12 {
public:
LIS2DH12(FRToSI2C* i2cHandle);
LIS2DH12(FRToSI2C* i2cHandle) : i2c(i2cHandle) {}
void initalize();
uint8_t getOrientation();
Orientation getOrientation() { return static_cast<Orientation>((I2C_RegisterRead(LIS_INT2_SRC) >> 2) - 1); }
void getAxisReadings(int16_t *x, int16_t *y, int16_t *z);
private:
void setSensitivity(uint8_t threshold, uint8_t filterTime); // Sets the sensitivity of the unit
void I2C_RegisterWrite(uint8_t reg, uint8_t data);
uint8_t I2C_RegisterRead(uint8_t reg);
FRToSI2C* i2c;

View File

@@ -10,17 +10,18 @@
#include "stm32f1xx_hal.h"
#include "MMA8652FC_defines.h"
#include "FRToSI2C.hpp"
#include "hardware.h"
class MMA8652FC {
public:
MMA8652FC(FRToSI2C* i2cHandle);
MMA8652FC(FRToSI2C* i2cHandle) : i2c(i2cHandle) {}
void initalize(); // Initalize the system
uint8_t getOrientation();// Reads the I2C register and returns the orientation (true == left)
Orientation getOrientation();// Reads the I2C register and returns the orientation (true == left)
void getAxisReadings(int16_t *x, int16_t *y, int16_t *z);
private:
void setSensitivity(uint8_t threshold, uint8_t filterTime); // Sets the sensitivity of the unit
void I2C_RegisterWrite(uint8_t reg, uint8_t data);
uint8_t I2C_RegisterRead(uint8_t reg);

View File

@@ -12,6 +12,7 @@
#include <hardware.h>
#include "stm32f1xx_hal.h"
#include <stdbool.h>
#include <string.h>
#include "FRToSI2C.hpp"
#include "Font.h"
#ifdef __cplusplus
@@ -23,32 +24,65 @@ extern "C" {
#endif
#define DEVICEADDR_OLED (0x3c<<1)
#define OLED_WIDTH 96
#define FRAMEBUFFER_START 17
class OLED {
public:
OLED(FRToSI2C* i2cHandle); // Initialize Driver and store I2C pointer
void initialize(); // Startup the I2C coms (brings screen out of reset etc)
void refresh(); // Draw the buffer out to the LCD using the DMA Channel
// Draw the buffer out to the LCD using the DMA Channel
void refresh() {
i2c->Transmit( DEVICEADDR_OLED, screenBuffer, FRAMEBUFFER_START + (OLED_WIDTH * 2));
//DMA tx time is ~ 20mS Ensure after calling this you delay for at least 25ms
//or we need to goto double buffering
}
void drawChar(char c, char preCursorCommand = '\0'); // Draw a character to a specific location
void displayOnOff(bool on); // Turn the screen on or not
// Turn the screen on or not
void displayOnOff(bool on) {
displayOnOffState = on;
screenBuffer[1] = on ? 0xAF : 0xAE;
}
void setRotation(bool leftHanded); // Set the rotation for the screen
bool getRotation(); // Get the current rotation of the LCD
// Get the current rotation of the LCD
bool getRotation() const {
return inLeftHandedMode;
}
void print(const char* string); // Draw a string to the current location, with current font
void setCursor(int16_t x, int16_t y); // Set the cursor location by pixels
void setCharCursor(int16_t x, int16_t y); //Set cursor location by chars in current font
// Set the cursor location by pixels
void setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}
//Set cursor location by chars in current font
void setCharCursor(int16_t x, int16_t y) {
cursor_x = x * fontWidth;
cursor_y = y * fontHeight;
}
void setFont(uint8_t fontNumber); // (Future) Set the font that is being used
void drawImage(const uint8_t* buffer, uint8_t x, uint8_t width);
void drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
drawArea(x, 0, width, 16, buffer);
}
// Draws an image to the buffer, at x offset from top to bottom (fixed height renders)
void printNumber(uint16_t number, uint8_t places);
// Draws a number at the current cursor location
void clearScreen(); // Clears the buffer
void drawBattery(uint8_t state); // Draws the battery level symbol
void drawCheckbox(bool state); // Draws a checkbox
// Clears the buffer
void clearScreen() {
memset(&screenBuffer[FRAMEBUFFER_START], 0, OLED_WIDTH * 2);
}
// Draws the battery level symbol
void drawBattery(uint8_t state) {
drawSymbol(3 + (state > 10 ? 10 : state));
}
// Draws a checkbox
void drawCheckbox(bool state) {
drawSymbol((state) ? 16 : 17);
}
void drawSymbol(uint8_t symbolID);//Used for drawing symbols of a predictable width
void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
const uint8_t* ptr);
void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
const uint8_t value);
void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t* ptr); //Draw an area, but y must be aligned on 0/8 offset
void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t value); //Fill an area, but y must be aligned on 0/8 offset
void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,bool clear);
void drawHeatSymbol(uint8_t state);
private:
@@ -57,7 +91,6 @@ private:
FRToSI2C* i2c; //i2c Pointer
const uint8_t* currentFont; // Pointer to the current font used for rendering to the buffer
uint8_t screenBuffer[16 + 96 + 96 + 10]; // The data buffer
uint8_t* firstStripPtr; // Pointers to the strips to allow for buffer having extra content
uint8_t* secondStripPtr; //Pointers to the strips
bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
@@ -65,6 +98,7 @@ private:
uint8_t fontWidth, fontHeight;
int16_t cursor_x, cursor_y;
uint8_t displayOffset;
uint8_t screenBuffer[16 + (OLED_WIDTH * 2) + 10]; // The data buffer
};
#endif /* OLED_HPP_ */

View File

@@ -13,6 +13,12 @@
extern "C" {
#endif
enum Orientation {
ORIENTATION_LEFT_HAND = 0,
ORIENTATION_RIGHT_HAND = 1,
ORIENTATION_FLAT = 3
};
#define KEY_B_Pin GPIO_PIN_6
#define KEY_B_GPIO_Port GPIOA
#define TMP36_INPUT_Pin GPIO_PIN_7

View File

@@ -7,11 +7,6 @@
#include "FRToSI2C.hpp"
FRToSI2C::FRToSI2C(I2C_HandleTypeDef* i2chandle) {
i2c = i2chandle;
I2CSemaphore = NULL;
}
void FRToSI2C::CpltCallback() {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
i2c->State = HAL_I2C_STATE_READY;//Force state reset
@@ -19,8 +14,6 @@ void FRToSI2C::CpltCallback() {
xSemaphoreGiveFromISR(I2CSemaphore, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
void FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t MemAddress,
@@ -69,14 +62,7 @@ void FRToSI2C::Mem_Write(uint16_t DevAddress, uint16_t MemAddress,
} else {
NVIC_SystemReset();
}
}
}
void FRToSI2C::FRToSInit() {
I2CSemaphore = xSemaphoreCreateBinary();
xSemaphoreGive(I2CSemaphore);
}
void FRToSI2C::Transmit(uint16_t DevAddress, uint8_t* pData, uint16_t Size) {

View File

@@ -7,39 +7,32 @@
#include <LIS2DH12.hpp>
#include "cmsis_os.h"
LIS2DH12::LIS2DH12(FRToSI2C* i2cHandle) {
i2c = i2cHandle;
}
typedef struct {
const uint8_t reg;
const uint8_t value;
} LIS_REG;
static const LIS_REG i2c_registers[] = {
{LIS_CTRL_REG1, 0x17}, // 25Hz
{LIS_CTRL_REG2, 0b00001000}, // Highpass filter off
{LIS_CTRL_REG3, 0b01100000}, // Setup interrupt pins
{LIS_CTRL_REG4, 0b00001000}, // Block update mode off, HR on
{LIS_CTRL_REG5, 0b00000010},
{LIS_CTRL_REG6, 0b01100010},
//Basically setup the unit to run, and enable 4D orientation detection
{LIS_INT2_CFG, 0b01111110}, //setup for movement detection
{LIS_INT2_THS, 0x28},
{LIS_INT2_DURATION, 64},
{LIS_INT1_CFG, 0b01111110},
{LIS_INT1_THS, 0x28},
{LIS_INT1_DURATION, 64}
};
void LIS2DH12::initalize() {
I2C_RegisterWrite(LIS_CTRL_REG1, 0x17); //25Hz
I2C_RegisterWrite(LIS_CTRL_REG2, 0b00001000); //Highpass filter off
I2C_RegisterWrite(LIS_CTRL_REG3, 0b01100000); //Setup interrupt pins
I2C_RegisterWrite(LIS_CTRL_REG4, 0b00001000); //Block update mode off,HR on
I2C_RegisterWrite(LIS_CTRL_REG5, 0b00000010);
I2C_RegisterWrite(LIS_CTRL_REG6, 0b01100010);
//Basically setup the unit to run, and enable 4D orientation detection
I2C_RegisterWrite(LIS_INT2_CFG, 0b01111110); //setup for movement detection
I2C_RegisterWrite(LIS_INT2_THS, 0x28);
I2C_RegisterWrite(LIS_INT2_DURATION, 64);
I2C_RegisterWrite(LIS_INT1_CFG, 0b01111110); //setup for movement detection
I2C_RegisterWrite(LIS_INT1_THS, 0x28);
I2C_RegisterWrite(LIS_INT1_DURATION, 64);
for (size_t index = 0; index < (sizeof(i2c_registers) / sizeof(i2c_registers[0])); index++) {
I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].value);
}
//0=no change, 1= right handed, 2= left handed
uint8_t LIS2DH12::getOrientation() {
// 8=right handed,4=left,16=flat
//So we ignore if not 8/4
uint8_t pos = I2C_RegisterRead(LIS_INT2_SRC);
if (pos == 8)
return 1;
else if (pos == 4)
return 2;
else
return 0;
}
void LIS2DH12::getAxisReadings(int16_t* x, int16_t* y, int16_t* z) {
@@ -52,9 +45,6 @@ void LIS2DH12::getAxisReadings(int16_t* x, int16_t* y, int16_t* z) {
(*z) = ((uint16_t) (tempArr[5] << 8 | tempArr[4]));
}
void LIS2DH12::setSensitivity(uint8_t threshold, uint8_t filterTime) {
}
void LIS2DH12::I2C_RegisterWrite(uint8_t reg, uint8_t data) {
i2c->Mem_Write(LIS2DH_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);

View File

@@ -8,9 +8,26 @@
#include <MMA8652FC.hpp>
#include "cmsis_os.h"
MMA8652FC::MMA8652FC(FRToSI2C* i2cHandle) {
i2c = i2cHandle;
}
typedef struct {
const uint8_t reg;
const uint8_t val;
} MMA_REG;
static const MMA_REG i2c_registers[] = {
{CTRL_REG2, 0}, //Normal mode
{CTRL_REG2, 0x40}, // Reset all registers to POR values
{FF_MT_CFG_REG, 0x78}, // Enable motion detection for X, Y, Z axis, latch disabled
{PL_CFG_REG, 0x40}, //Enable the orientation detection
{PL_COUNT_REG, 200}, //200 count debounce
{PL_BF_ZCOMP_REG, 0b01000111}, //Set the threshold to 42 degrees
{P_L_THS_REG, 0b10011100}, //Up the trip angles
{CTRL_REG4, 0x01 | (1 << 4)}, // Enable dataready interrupt & orientation interrupt
{CTRL_REG5, 0x01}, // Route data ready interrupts to INT1 ->PB5 ->EXTI5, leaving orientation routed to INT2
{CTRL_REG2, 0x12}, //Set maximum resolution oversampling
{XYZ_DATA_CFG_REG, (1 << 4)}, //select high pass filtered data
{HP_FILTER_CUTOFF_REG, 0x03}, //select high pass filtered data
{CTRL_REG1, 0x19} // ODR=12 Hz, Active mode
};
void MMA8652FC::I2C_RegisterWrite(uint8_t reg, uint8_t data) {
i2c->Mem_Write( MMA8652FC_I2C_ADDRESS, reg, I2C_MEMADD_SIZE_8BIT, &data, 1);
@@ -24,47 +41,34 @@ uint8_t MMA8652FC::I2C_RegisterRead(uint8_t reg) {
return tx_data[0];
}
void MMA8652FC::initalize() {
size_t index = 0;
//send all the init commands to the unit
I2C_RegisterWrite(CTRL_REG2, 0); //Normal mode
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].val); index++;
I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].val); index++;
HAL_Delay(2); // ~1ms delay
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X, Y, Z axis, latch disabled
I2C_RegisterWrite(PL_CFG_REG, 0x40); //Enable the orientation detection
I2C_RegisterWrite(PL_COUNT_REG, 200); //200 count debounce
I2C_RegisterWrite(PL_BF_ZCOMP_REG, 0b01000111); //Set the threshold to 42 degrees
I2C_RegisterWrite(P_L_THS_REG, 0b10011100); //Up the trip angles
I2C_RegisterWrite( CTRL_REG4, 0); // Disable IRQ's
I2C_RegisterWrite( CTRL_REG5, 0x01); // Route data ready interrupts to INT1 ->PB5 ->EXTI5, leaving orientation routed to INT2
I2C_RegisterWrite( CTRL_REG2, 0x12); //Set maximum resolution oversampling
I2C_RegisterWrite( XYZ_DATA_CFG_REG, (1 << 4)); //select high pass filtered data
I2C_RegisterWrite( HP_FILTER_CUTOFF_REG, 0x03); //select high pass filtered data
I2C_RegisterWrite( CTRL_REG1, 0x19); // ODR=12 Hz, Active mode
while (index < (sizeof(i2c_registers) / sizeof(i2c_registers[0]))) {
I2C_RegisterWrite(i2c_registers[index].reg, i2c_registers[index].val); index++;
}
}
void MMA8652FC::setSensitivity(uint8_t threshold, uint8_t filterTime) {
uint8_t sens = 9 * 2 + 17;
sens -= 2 * threshold;
I2C_RegisterWrite( CTRL_REG1, 0); // sleep mode
I2C_RegisterWrite(FF_MT_THS_REG, (sens & 0x7F));// Set accumulation threshold
I2C_RegisterWrite(FF_MT_COUNT_REG, filterTime); // Set debounce threshold
I2C_RegisterWrite( CTRL_REG1, 0x31); // ODR=12 Hz, Active mode
}
uint8_t MMA8652FC::getOrientation() {
Orientation MMA8652FC::getOrientation() {
//First read the PL_STATUS register
uint8_t plStatus = I2C_RegisterRead(PL_STATUS_REG);
if ((plStatus & 0b10000000) == 0b10000000) {
plStatus >>= 1; //We don't need the up/down bit
plStatus &= 0x03; //mask to the two lower bits
//0 == left handed
//1 == right handed
return plStatus == 0 ? 2 : 1;
} else
return 0;
return static_cast<Orientation>(plStatus);
}
return ORIENTATION_FLAT;
}
void MMA8652FC::getAxisReadings(int16_t *x, int16_t *y, int16_t *z) {
uint8_t tempArr[6];

View File

@@ -13,7 +13,6 @@
/*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/
/*All commands are prefixed with 0x80*/
/*Data packets are prefixed with 0x40*/
const uint8_t configLength = 50;
uint8_t OLED_Setup_Array[] = { /**/
0x80, 0xAE,/*Display off*/
0x80, 0xD5,/*Set display clock divide ratio / osc freq*/
@@ -43,54 +42,42 @@ uint8_t OLED_Setup_Array[] = { /**/
};
//Setup based on the SSD1307 and modified for the SSD1306
const uint8_t REFRESH_COMMANDS[17] = {
0x80, 0xAF,
0x80, 0x21,
0x80, 0x20,
0x80, 0x7F,
0x80, 0xC0,
0x80, 0x22,
0x80, 0x00,
0x80, 0x01,
0x40
};
OLED::OLED(FRToSI2C* i2cHandle) {
i2c = i2cHandle;
cursor_x = cursor_y = 0;
currentFont = FONT_12;
fontWidth = 12;
inLeftHandedMode = false;
firstStripPtr = &screenBuffer[16 + 1];
secondStripPtr = &screenBuffer[16 + 1 + 96];
firstStripPtr = &screenBuffer[FRAMEBUFFER_START];
secondStripPtr = &screenBuffer[FRAMEBUFFER_START + OLED_WIDTH];
fontHeight = 16;
fontWidth = 12;
displayOffset = 0;
displayOnOffState = true;
}
void OLED::initialize() {
memcpy(&screenBuffer[0], &REFRESH_COMMANDS[0], sizeof(REFRESH_COMMANDS));
HAL_Delay(5);
HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET);
HAL_Delay(10);
//Send the setup settings
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, configLength);
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
displayOnOff(true);
}
//Write out the buffer to the OLEd & call any rendering objects
void OLED::refresh() {
screenBuffer[0] = 0x80;
screenBuffer[1] = displayOnOffState ? 0xAF : 0xAE;
screenBuffer[2] = 0x80;
screenBuffer[3] = 0x21;
screenBuffer[4] = 0x80;
screenBuffer[5] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
screenBuffer[6] = 0x80;
screenBuffer[7] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
screenBuffer[8] = 0x80; /*Set COM Scan direction*/
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
screenBuffer[10] = 0x80; //Set pages to rollover after 2
screenBuffer[11] = 0x22;
screenBuffer[12] = 0x80;
screenBuffer[13] = 0x00; //start page 0
screenBuffer[14] = 0x80;
screenBuffer[15] = 0x01;
screenBuffer[16] = 0x40; //start of data marker
i2c->Transmit( DEVICEADDR_OLED, screenBuffer, 16 + (96 * 2) + 1);
}
/*
* Prints a char to the screen.
* UTF font handling is done using the two input chars.
@@ -151,24 +138,25 @@ void OLED::drawChar(char c, char PrecursorCommand) {
cursor_x += fontWidth;
}
void OLED::displayOnOff(bool on) {
displayOnOffState = on;
void OLED::setRotation(bool leftHanded) {
if (inLeftHandedMode == leftHanded) {
return;
}
void OLED::setRotation(bool leftHanded) {
if (inLeftHandedMode != leftHanded) {
//send command struct again with changes
if (leftHanded == 1) {
if (leftHanded) {
OLED_Setup_Array[11] = 0xC8; //c1?
OLED_Setup_Array[19] = 0xA1;
} else if (leftHanded == 0) {
} else {
OLED_Setup_Array[11] = 0xC0;
OLED_Setup_Array[19] = 0xA0;
}
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array,
configLength);
i2c->Transmit( DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, sizeof(OLED_Setup_Array));
inLeftHandedMode = leftHanded;
}
screenBuffer[5] = inLeftHandedMode ? 0 : 32; //display is shifted by 32 in left handed mode as driver ram is 128 wide
screenBuffer[7] = inLeftHandedMode ? 95 : 0x7F; //End address of the ram segment we are writing to (96 wide)
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
}
//print a string to the current cursor location
@@ -183,14 +171,6 @@ void OLED::print(const char* str) {
}
}
void OLED::setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}
void OLED::setCharCursor(int16_t x, int16_t y) {
cursor_x = x * fontWidth;
cursor_y = y * fontHeight;
}
void OLED::setFont(uint8_t fontNumber) {
if (fontNumber == 1) {
//small font
@@ -208,58 +188,35 @@ void OLED::setFont(uint8_t fontNumber) {
}
}
void OLED::drawImage(const uint8_t* buffer, uint8_t x, uint8_t width) {
drawArea(x, 0, width, 16, buffer);
}
//maximum places is 5
void OLED::printNumber(uint16_t number, uint8_t places) {
char buffer[6];
buffer[5] = 0; //null
char buffer[6] = { 0 };
if (places == 5) {
buffer[4] = '0' + number % 10;
number /= 10;
} else
buffer[4] = 0;
}
if (places > 3) {
buffer[3] = '0' + number % 10;
number /= 10;
} else
buffer[3] = 0;
}
if (places > 2) {
buffer[2] = '0' + number % 10;
number /= 10;
} else
buffer[2] = 0;
}
if (places > 1) {
buffer[1] = '0' + number % 10;
number /= 10;
} else
buffer[1] = 0;
}
buffer[0] = '0' + number % 10;
number /= 10;
print(buffer);
}
void OLED::clearScreen() {
memset(firstStripPtr, 0, 96);
memset(secondStripPtr, 0, 96);
}
bool OLED::getRotation() {
return inLeftHandedMode;
}
void OLED::drawBattery(uint8_t state) {
if (state > 10)
state = 10;
drawSymbol(3 + state);
}
void OLED::drawCheckbox(bool state) {
drawSymbol((state) ? 16 : 17);
}
void OLED::drawSymbol(uint8_t symbolID) {
//draw a symbol to the current cursor location
setFont(2);

View File

@@ -577,7 +577,8 @@ const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
#ifdef LANG_FR
const char* SettingsDescriptions[17] = {
const char* SettingsDescriptions[17] =
{
// These are all the help text for all the settings.
// No requirements on spacing or length.
/* Power source (DC or batt) */"Source d'alimentation. Règle la tension de coupure <DC=10V S=3.3V par cellules>",
@@ -596,11 +597,12 @@ const char* SettingsDescriptions[17] = {
/* Settings reset command */"Réinitialiser tous les réglages",
/* Calibrate input voltage */"Etalonner tension d'entrée. Boutons pour ajuster, appui long pour quitter",
/* Advanced soldering screen enabled */"Afficher des informations détaillées pendant la soudure",
/* Description Scroll Speed */ "Vitesse de défilement de ce texte en <R=Rapide L=Lent>",
};
/* Description Scroll Speed */"Vitesse de défilement de ce texte en <R=Rapide L=Lent>", };
const char* SettingsCalibrationWarning = "Assurez-vous que la panne soit à température ambiante avant de continuer!";
const char* SettingsResetWarning = "Voulez-vous vraiment réinitialiser les paramètres aux valeurs d'usine?";
const char* SettingsCalibrationWarning =
"Assurez-vous que la panne soit à température ambiante avant de continuer!";
const char* SettingsResetWarning =
"Voulez-vous vraiment réinitialiser les paramètres aux valeurs d'usine?";
const char* UVLOWarningString = "DC FAIBLE"; // <=8 chars
const char* UndervoltageString = "Sous-tension"; // <=16 chars
const char* InputVoltageString = "V d'entrée: "; // <=11 chars, preferably end with a space
@@ -630,32 +632,40 @@ const char* SettingsShortNames[17][2] = {
/* (<= 9) Sleep temperature */{ "Temp.", "veille" },
/* (<= 9) Sleep timeout */{ "Délai", "veille" },
/* (<= 10) Shutdown timeout */{ "Délai", "extinction" },
/* (<= 13) Motion sensitivity level */ {"Sensibilité", "au mouvement"},
/* (<= 13) Temperature in F and C */ {"Unité de", "température"},
/* (<= 13) Advanced idle display mode enabled */ {"Ecran veille", "détaillé"},
/* (<= 13) Display rotation mode */ {"Orientation", "de l'écran"},
/* (<= 13) Boost enabled */ {"Activation du", "mode Boost"},
/* (<= 13) Motion sensitivity level */{ "Sensibilité",
"au mouvement" },
/* (<= 13) Temperature in F and C */{ "Unité de",
"température" },
/* (<= 13) Advanced idle display mode enabled */{ "Ecran veille",
"détaillé" },
/* (<= 13) Display rotation mode */{ "Orientation",
"de l'écran" },
/* (<= 13) Boost enabled */{ "Activation du",
"mode Boost" },
/* (<= 9) Boost temperature */{ "Temp.", "Boost" },
/* (<= 13) Automatic start mode */ {"Démarrage", "automatique"},
/* (<= 13) Cooldown blink */ {"Refroidir en", "clignottant"},
/* (<= 16) Temperature calibration enter menu */ {"Etalonner", "température"},
/* (<= 16) Settings reset command */ {"Réinitialisation", "d'usine"},
/* (<= 16) Calibrate input voltage */ {"Etalonner", "tension d'entrée"},
/* (<= 13) Advanced soldering screen enabled */ {"Ecran soudure", "détaillé"},
/* (<= 11) Display Help Text Scroll Speed */ {"Vitesse de","défilement"},
};
/* (<= 13) Automatic start mode */{ "Démarrage",
"automatique" },
/* (<= 13) Cooldown blink */{ "Refroidir en",
"clignottant" },
/* (<= 16) Temperature calibration enter menu */{ "Etalonner",
"température" },
/* (<= 16) Settings reset command */{ "Réinitialisation",
"d'usine" },
/* (<= 16) Calibrate input voltage */{ "Etalonner",
"tension d'entrée" },
/* (<= 13) Advanced soldering screen enabled */{ "Ecran soudure",
"détaillé" },
/* (<= 11) Display Help Text Scroll Speed */{ "Vitesse de",
"défilement" }, };
const char* SettingsMenuEntries[4] = {
/*Soldering Menu*/"Soudure\nParamètres",
/* Power Saving Menu*/"Mode\nVeille",
/* UI Menu*/"Interface\nUtilisateur",
/* Advanced Menu*/"Options\nAdvancées", };
const char* SettingsMenuEntriesDescriptions[4] ={
"Paramètres de soudage",
const char* SettingsMenuEntriesDescriptions[4] = { "Paramètres de soudage",
"Paramètres d'économie d'énergie",
"Paramètres de l'interface utilisateur",
"Options avancées"
};
"Paramètres de l'interface utilisateur", "Options avancées" };
#endif
#ifdef LANG_DE
@@ -1328,11 +1338,11 @@ const char* SettingsDescriptions[17] = {
/* Settings reset command */"Reverte todos ajustes",
/* Calibrate input voltage */"Calibra a tensão e configura os botões. Mantenha presionado para sair",
/* Advanced soldering screen enabled */"Exibe informações avançadas durante o uso",
/* Description Scroll Speed */ "Speed this text scrolls past at",
/* Description Scroll Speed */"Velocidade que esse texto é exibido",
};
const char* SettingsCalibrationWarning = "A ponta deve estar em temperatura ambiente antes de continuar!";
const char* SettingsResetWarning = "Reverter para os ajustes de fábrica?";
const char* SettingsResetWarning = "Resetar para ajustes de fábrica?";
const char* UVLOWarningString = "DC BAIXO"; // <=8 chars
const char* UndervoltageString = "Subtensão";// <=16 chars
const char* InputVoltageString = "Tensão ";// <=11 chars, preferably end with a space
@@ -1374,18 +1384,18 @@ const char* SettingsShortNames[17][2] = {
/* (<= 8) Settings reset command */{"RESETAR"},
/* (<= 8) Calibrate input voltage */{"CAL.VOLT"},
/* (<= 6) Advanced soldering screen enabled */{"AVNCAD"},
/* (<= 6) Message Scroll Speed */ {"DESCSP"},
/* (<= 6) Message Scroll Speed */{"VELTEX"},
};
const char* SettingsMenuEntries[4] = {
/*Soldering Menu*/"Soldering\nSettings",
/* Power Saving Menu*/"Sleep\nModes",
/* UI Menu*/"User\nInterface",
/* Advanced Menu*/"Advanced\nOptions", };
/*Soldering Menu*/"Configurações\nSolda",
/* Power Saving Menu*/"Modos\nSuspensão",
/* UI Menu*/"Interface\nUsuário",
/* Advanced Menu*/"Menu\nAvançado",};
const char* SettingsMenuEntriesDescriptions[4] = {
"Soldering settings",
"Power Saving Settings",
"User Interface settings",
"Advanced options"
"Configurações de solda",
"Configurações de economia de energia",
"Configurações da interface do usuário",
"Opções avançadas"
};
#endif
@@ -1421,14 +1431,14 @@ const char* WarningTipTempString = "Antgl Temp: "; // <=12 chars, prefer
const char* BadTipString = "BLOG ANT";// <=8 chars
const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars
const char* SleepingAdvancedString = "Miegu...";// <=16 chars
const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars
const char* WarningSimpleString = "KRŠ!";// Must be <= 4 chars
const char* WarningAdvancedString = "ANTGALIS KARŠTAS";// <=16 chars
const char* SleepingTipAdvancedString = "Antgl:";// <=6 chars
const char* IdleTipString = "Ant:";// IdleTipString+IdleSetString <= 10
const char* IdleSetString = " Nust:";// preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "ANTGAL ATJUNGTAS";// <=16 chars
const char* SolderingAdvancedPowerPrompt = "Maitinimas: ";// <=12 chars
const char* OffString ="Off"; // 3 chars max
const char* OffString ="Išj";// 3 chars max
const char SettingRightChar = 'D';
const char SettingLeftChar = 'K';
@@ -1554,3 +1564,333 @@ const char* SettingsMenuEntriesDescriptions[4] ={
"Розширені налаштування. Додаткові зручності."
};
#endif
#ifdef LANG_NL
const char* SettingsDescriptions[17] = {
// These are all the help text for all the settings.
// No requirements on spacing or length.
/* Power source (DC or batt) */"Spanningsbron. Stelt drempelspanning in. <DC 10V> <S 3.3V per cel>",
/* Sleep temperature */"Temperatuur in slaapstand <C>",
/* Sleep timeout */"Slaapstand time-out <Minuten/Seconden>",
/* Shutdown timeout */"Automatisch afsluiten time-out <Minuten>",
/* Motion sensitivity level */"Bewegingsgevoeligheid <0.uit 1.minst gevoelig 9.meest gevoelig>",
/* Temperature in F and C */"Temperatuureenheid <C=Celsius F=Fahrenheit>",
/* Advanced idle display mode enabled */"Gedetailleerde informatie weergeven in een kleiner lettertype op het slaapscherm.",
/* Display rotation mode */"Schermoriëntatie <A. Automatisch L. Linkshandig R. Rechtshandig>",
/* Boost enabled */"Soldeerbout gaat naar een hogere boost-temperatuur wanneer de voorste knop ingedrukt is.",
/* Boost temperature */"Temperatuur in boostmodes",
/* Automatic start mode */"Breng de soldeerbout direct op temperatuur bij het opstarten. T=Soldeertemperatuur, S=Slaapstand-temperatuur, F=Uit",
/* Cooldown blink */"Temperatuur laten flikkeren in het hoofdmenu als de soldeerpunt aan het afkoelen is.",
/* Temperature calibration enter menu */"Temperatuursafwijking van de soldeerpunt calibreren.",
/* Settings reset command */"Alle instellingen terugzetten.",
/* Calibrate input voltage */"VIN Calibreren. Knoppen lang ingedrukt houden om te bevestigen.",
/* Advanced soldering screen enabled */"Gedetailleerde informatie weergeven in een kleiner lettertype op het soldeerscherm.",
/* Description Scroll Speed */"Snelheid waarmee de tekst scrolt.",
};
const char* SettingsCalibrationWarning = "Zorg ervoor dat de soldeerpunt op kamertemperatuur is voor je verdergaat!";
const char* SettingsResetWarning = "Ben je zeker dat je alle instellingen naar de standaardwaardes wilt terugzetten?";
const char* UVLOWarningString = "DC LAAG"; // <=8 chars
const char* UndervoltageString = "Onderspanning";// <=16 chars
const char* InputVoltageString = "Input V: ";// <=11 chars, preferably end with a space
const char* WarningTipTempString = "Tip Temp: ";// <=12 chars, preferably end with a space
const char* BadTipString = "DEFECT";// <=8 chars
const char* SleepingSimpleString = "Zzz ";// Must be <= 4 chars
const char* SleepingAdvancedString = "Slaapstand...";// <=16 chars
const char* WarningSimpleString = "HEET!";// Must be <= 4 chars
const char* WarningAdvancedString = "!!! TIP HEET !!!";// <=16 chars
const char* SleepingTipAdvancedString = "Tip:";// <=6 chars
const char* IdleTipString = "Tip:";// IdleTipString+IdleSetString <= 10
const char* IdleSetString = " Set:";// preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP LOSGEKOPPELD";// <=16 chars
const char* SolderingAdvancedPowerPrompt = "vermogen: ";// <=12 chars
const char* OffString ="Off";// 3 chars max
const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
const char SettingAutoChar = 'A';
const char SettingFastChar = 'F';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
/* (<= 11) Power source (DC or batt) */{"Spannings-", "bron"},
/* (<= 9) Sleep temperature */{"Slaap", "temp"},
/* (<= 9) Sleep timeout */{"Slaap", "time-out"},
/* (<= 10) Shutdown timeout */{"Uitschakel", "time-out"},
/* (<= 13) Motion sensitivity level */{"Bewegings-", "gevoeligheid"},
/* (<= 13) Temperature in F and C */{"Temperatuur", "eenheid"},
/* (<= 13) Advanced idle display mode enabled */{"Gedetailleerd", "slaapscherm"},
/* (<= 13) Display rotation mode */{"Scherm-", "oriëntatie"},
/* (<= 13) Boost enabled */{"Boostmodes", "ingeschakeld?"},
/* (<= 9) Boost temperature */{"Boost", "temp"},
/* (<= 13) Automatic start mode */{"Auto", "start"},
/* (<= 13) Cooldown blink */{"Afkoel", "flikker"},
/* (<= 16) Temperature calibration enter menu */{"Calibreer", "temperatuur?"},
/* (<= 16) Settings reset command */{"Instellingen", "resetten?"},
/* (<= 16) Calibrate input voltage */{"Calibreer", "input-voltage?"},
/* (<= 13) Advanced soldering screen enabled */{"Gedetailleerd", "soldeerscherm"},
/* (<= 11) Display Help Text Scroll Speed */{"Scroll","snelheid"},
};
// SettingsMenuEntries lengths <= 13 per line (\n starts second line)
const char* SettingsMenuEntries[4] = {
/* Soldering Menu */"Soldeer\nInstellingen",
/* Power Saving Menu */"Slaap\nModes",
/* UI Menu */"Gebruikers-\nInterface",
/* Advanced Menu */"geavanceerde\nInstellingen",
};
const char* SettingsMenuEntriesDescriptions[4] = {
"Soldeerinstellingen",
"Batterijbesparingsinstellingen",
"Gebruikersinterface Instellingen",
"geavanceerde Instellingen"
};
#endif
#ifdef LANG_SV
const char* SettingsDescriptions[17] = {
// These are all the help text for all the settings.
// No requirements on spacing or length.
/* Power source (DC or batt) */"Strömkälla. Anger lägsta spänning. <DC 10V> <S 3.3V per cell>",
/* Sleep temperature */"Vilotemperatur <C>",
/* Sleep timeout */"Vilo-timeout <Minuter/Seconder>",
/* Shutdown timeout */"Avstängnings-timeout <Minuter>",
/* Motion sensitivity level */"Rörelsekänslighet <0.Av 1.minst känslig 9.mest känslig>",
/* Temperature in F and C */"Temperaturenhet <C=Celsius F=Fahrenheit>",
/* Advanced idle display mode enabled */"Visa detaljerad information i mindre typsnitt när inaktiv.",
/* Display rotation mode */"Visningsläge <A. Automatisk V. Vänsterhänt H. Högerhänt>",
/* Boost enabled */"Aktivera främre knappen för turboläge (temperaturhöjning) vid lödning",
/* Boost temperature */"Temperatur i \"turbo\"-läge",
/* Automatic start mode */"Startar automatiskt lödpennan vid uppstart. T=Lödning, S=Viloläge, F=Av",
/* Cooldown blink */"Blinka temperaturen medan spetsen kyls av och fortfarande är varm.",
/* Temperature calibration enter menu */"Kalibrera spets-kompensation.",
/* Settings reset command */"Återställ alla inställningar",
/* Calibrate input voltage */"Inspänningskalibrering. Knapparna justerar, håll inne för avslut",
/* Advanced soldering screen enabled */"Visa detaljerad information vid lödning",
/* Description Scroll Speed */"Hastighet som den här texten rullar i",
};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* SettingsResetWarning = "Are you sure to reset settings to default values?";
const char* UVLOWarningString = "DC LÅG"; // <=8 chars
const char* UndervoltageString = "Underspänning";// <=16 chars
const char* InputVoltageString = "Inspän. V: ";// <=11 chars, preferably end with a space
const char* WarningTipTempString = "Spetstemp: ";// <=12 chars, preferably end with a space
const char* BadTipString = "SPETSFEL";// <=8 chars
const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars
const char* SleepingAdvancedString = "Viloläge...";// <=16 chars
const char* WarningSimpleString = "VARM";// Must be <= 4 chars
const char* WarningAdvancedString = "!! SPETS VARM !!";// <=16 chars
const char* SleepingTipAdvancedString = "Spets:";// <=6 chars
const char* IdleTipString = "Spets:";// IdleTipString+IdleSetString <= 10
const char* IdleSetString = " Ange:";// preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "SPETS URTAGEN";// <=16 chars
const char* SolderingAdvancedPowerPrompt = "Ström: ";// <=12 chars
const char* OffString ="Av";// 3 chars max
const char SettingRightChar = 'H';
const char SettingLeftChar = 'V';
const char SettingAutoChar = 'A';
const char SettingFastChar = 'S';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
/* (<= 11) Power source (DC or batt) */{"Ström-", "källa"},
/* (<= 9) Sleep temperature */{"Vilo-", "temp"},
/* (<= 9) Sleep timeout */{"Vilo-", "timeout"},
/* (<= 10) Shutdown timeout */{"Avstängn.", "timeout"},
/* (<= 13) Motion sensitivity level */{"Rörelse-", "känslighet"},
/* (<= 13) Temperature in F and C */{"Temperatur-", "enheter"},
/* (<= 13) Advanced idle display mode enabled */{"Detaljerad", "vid inaktiv"},
/* (<= 13) Display rotation mode */{"Visnings", "läge"},
/* (<= 13) Boost enabled */{"Turboläge", "aktiverat"},
/* (<= 9) Boost temperature */{"Turbo-", "temp"},
/* (<= 13) Automatic start mode */{"Auto", "start"},
/* (<= 13) Cooldown blink */{"Nedkylnings-", "blink"},
/* (<= 16) Temperature calibration enter menu */{"Kalibrera", "temperatur?"},
/* (<= 16) Settings reset command */{"Fabriks-", "inställ?"},
/* (<= 16) Calibrate input voltage */{"Kalibrera", "inspänning?"},
/* (<= 13) Advanced soldering screen enabled */{"Detaljerad", "lödng.skärm"},
/* (<= 11) Display Help Text Scroll Speed */{"Beskrivning","rullhast."},
};
// SettingsMenuEntries lengths <= 13 per line (\n starts second line)
const char* SettingsMenuEntries[4] = {
/* Soldering Menu */"Lödnings-\ninställningar",
/* Power Saving Menu */"Vilo-\nlägen",
/* UI Menu */"Användar-\ngränssnitt",
/* Advanced Menu */"Avancerade\nalternativ",
};
const char* SettingsMenuEntriesDescriptions[4] = {
"Lödningsinställningar",
"Viloläges-inställningar",
"Användargränssnitts-inställningar",
"Avancerade alternativ"
};
#endif
#ifdef LANG_SR
const char* SettingsDescriptions[17] = {
// These are all the help text for all the settings.
// No requirements on spacing or length.
/* Power source (DC or batt) / "Izvor napajanja. Postavlja napon isključivanja. <DC 10V> <S 3.3V po ćeliji>",
/ Sleep temperature / "Temperatura na koju se spušta lemilica nakon određenog vremena mirovanja. <C/F>",
/ Sleep timeout / "Vreme mirovanja nakon koga lemilica spušta temperaturu. <Minute/Sekunde>",
/ Shutdown timeout / "Vreme mirovanja nakon koga će se lemilica ugasiti. ",
/ Motion sensitivity level / "Osetljivost prepoznavanja pokreta. <0=Ugašeno, 1=Najmanje osetljivo, 9=Najosjetljivije>",
/ Temperature in F and C / "Jedinica temperature. <C=Celzijus, F=Fahrenheit>",
/ Advanced idle display mode enabled / "Prikazivanje detaljnih informacija manjim fontom tokom čekanja.",
/ Display rotation mode / "Orijentacija ekrana. <A=Automatski, L=Levoruki, D=Desnoruki>",
/ Boost enabled / "Držanjem prednjeg dugmeta prilikom lemljenja aktivira se pojačani (Boost) način.",
/ Boost temperature / "Temperatura u pojačanom (Boost) načinu.",
/ Automatic start mode / "Ako je aktivno, lemilica po uključivanju napajanja odmah počinje grejati.",
/ Cooldown blink / "Blinkanje temperature prilikom hlađenja, ako je lemilica vruća.",
/ Temperature calibration enter menu / "Kalibrisanje temperature meri razliku temperatura vrha i drške, dok je lemilica hladna.",
/ Settings reset command / "Vraćanje svih podešavanja na fabričke vrednosti.",
/ Calibrate input voltage / "Kalibracija ulaznog napona. Podešavanje tastera, dugački pritisak za kraj.",
/ Advanced soldering screen enabled / "Prikazivanje detaljnih informacija tokom lemljenja.",
/ Description Scroll Speed */"Brzina kretanja dugačkih poruka <B=brzo, S=sporo>",
};
const char* SettingsCalibrationWarning = "Proverite da li je vrh ohlađen na sobnu temperaturu pre nego što nastavite!";
const char* SettingsResetWarning = "Jeste li sigurni da želite da vratite sva podešavanja na fabričke vrednosti?";
const char* UVLOWarningString = "BATERIJA"; // <=8 chars
const char* UndervoltageString = "PRENIZAK NAPON";// <=16 chars
const char* InputVoltageString = "Napajanje: ";// <=11 chars, preferably end with a space
const char* WarningTipTempString = "Temp vrha: ";// <=12 chars, preferably end with a space
const char* BadTipString = "NEISPRAVAN VRH";// <=8 chars
const char* SleepingSimpleString = "Zzz ";// Must be <= 4 chars
const char* SleepingAdvancedString = "SPAVANJE...";// <=16 chars
const char* WarningSimpleString = "VRUĆ";// Must be <= 4 chars
const char* WarningAdvancedString = "OPREZ, VRUĆE!";// <=16 chars
const char* SleepingTipAdvancedString = "Vrh: ";// <=6 chars
const char* IdleTipString = "Vrh: ";// IdleTipString+IdleSetString <= 10
const char* IdleSetString = " / ";// preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "VRH NIJE SPOJEN!";// <=16 chars
const char* SolderingAdvancedPowerPrompt = "Snaga: ";// <=12 chars
const char* OffString ="Off";// 3 chars max
const char SettingRightChar = 'D';
const char SettingLeftChar = 'L';
const char SettingAutoChar = 'A';
const char SettingFastChar = 'B';
const char SettingSlowChar = 'S';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE;
const char* SettingsShortNames[17][2] = {
/* (<= 11) Power source (DC or batt) */{"Izvor", "napajanja"},
/* (<= 9) Sleep temperature */{"Temp", "spavanja"},
/* (<= 9) Sleep timeout */{"Vreme", "spavanja"},
/* (<= 10) Shutdown timeout */{"Vreme", "gašenja"},
/* (<= 13) Motion sensitivity level */{"Osetljivost", "pokreta"},
/* (<= 13) Temperature in F and C */{"Jedinica", "temperature"},
/* (<= 13) Advanced idle display mode enabled */{"Detalji", "pri čekanju"},
/* (<= 13) Display rotation mode */{"Rotacija", "ekrana"},
/* (<= 13) Boost enabled */{"Boost", "način"},
/* (<= 9) Boost temperature */{"Boost", "temp"},
/* (<= 13) Automatic start mode */{"Auto", "start"},
/* (<= 13) Cooldown blink */{"Upozorenje", "pri hlađenju"},
/* (<= 16) Temperature calibration enter menu */{"Kalibracija", "temperature"},
/* (<= 16) Settings reset command */{"Fabričke", "postavke"},
/* (<= 16) Calibrate input voltage */{"Kalibracija", "napona napajanja"},
/* (<= 13) Advanced soldering screen enabled */{"Detalji", "pri lemljenju"},
/* (<= 11) Display Help Text Scroll Speed */{"Brzina","poruka"},
};
const char SettingsMenuEntries[4] = {
/*Soldering Menu*/ "Postavke\nlemljenja",
/* Power Saving Menu*/ "Ušteda\nenergije",
/* UI Menu*/ "Korisničke\opcije",
/* Advanced Menu*/ "Napredne\nopcije",};
const char* SettingsMenuEntriesDescriptions[4] = {
"Postavke pri lemljenju",
"Postavke spavanja i štednje energije",
"Postavke korisničkih opcija",
"Upravljanje naprednim opcijama"
};
#endif
#ifdef LANG_NB
const char* SettingsDescriptions[17] = {
// These are all the help text for all the settings.
// No requirements on spacing or length
/* Power source (DC or batt) */ "Strømforsyning. Sett nedre spenning for automatisk nedstenging. <DC 10V <S 3.3V per celle",
/* Sleep temperature */ "Dvaletemperatur <C",
/* Sleep timeout */ "Tid før dvale <Minutter/Sekunder",
/* Shutdown timeout */ "Tid før automatisk nedstenging <Minutter",
/* Motion sensitivity level */ "Bevegelsesfølsomhet <0.Inaktiv 1.Minst følsom 9.Mest følsom",
/* Temperature in F and C */ "Temperaturskala <C=Celsius F=Fahrenheit",
/* Advanced idle display mode enabled */ "Vis detaljert informasjon med liten skrift på dvaleskjermen.",
/* Display rotation mode */ "Skjermretning <A. Automatisk V. Venstrehendt H. Høyrehendt",
/* Boost enabled */ "Frontknappen aktiverer kraftfunksjonen, 450C ved lodding",
/* Boost temperature */ "Temperatur i \"kraft\"-modus",
/* Automatic start mode */ "Start automatisk med lodding når strøm kobles til. L=Lodding, D=Dvale, I=Inaktiv",
/* Cooldown blink */ "Blink temperaturen på skjermen mens spissen fortsatt er varm.",
/* Temperature calibration enter menu */ "Kalibrer spiss-temperatur.",
/* Settings reset command */ "Tilbakestill alle innstillinger",
/* Calibrate input voltage */ "Kalibrer spenning. Knappene justerer. Langt trykk for å gå ut",
/* Advanced soldering screen enabled */ "Vis detaljert informasjon ved lodding",
/* Description Scroll Speed */ "Hastigheten på rulletekst",
};
const char* SettingsCalibrationWarning = "Sørg for at loddespissen har romtemperatur før du fortsetter!";
const char* SettingsResetWarning = "Er du sikker på at du vil tilbakestille til standardinnstillinger?";
const char* UVLOWarningString = "Lavspenn"; // <=8 chars
const char* UndervoltageString = "Underspenning"; // <=16 chars
const char* InputVoltageString = "Innspenn.: "; // <=11 chars, preferably end with a space
const char* WarningTipTempString = "Spisstemp: "; // <=12 chars, preferably end with a space
const char* BadTipString = "BAD TIP"; // <=8 chars
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
const char* SleepingAdvancedString = "Dvale..."; // <=16 chars
const char* WarningSimpleString = "Varm"; // Must be <= 4 chars
const char* WarningAdvancedString = "VARM SPISS!"; // <=16 chars
const char* SleepingTipAdvancedString = "Spiss:"; // <=6 chars
const char* IdleTipString = "Spiss:"; // IdleTipString+IdleSetString <= 10
const char* IdleSetString = "Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "SPISS FRAKOBLET"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Effekt: "; // <=12 chars
const char* OffString ="Av"; // 3 chars max
const char SettingRightChar = 'H';
const char SettingLeftChar = 'V';
const char SettingAutoChar = 'A';
const char SettingFastChar = 'H';
const char SettingSlowChar = 'L';
const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE;
const char* SettingsShortNames[17][2] = {
/* (<= 5) Power source (DC or batt) */ {"Kilde"},
/* (<= 4) Sleep temperature */ {"DTmp"},
/* (<= 4) Sleep timeout */ {"DTid"},
/* (<= 5) Shutdown timeout */ {"AvTid"},
/* (<= 6) Motion sensitivity level */ {"BSensr"},
/* (<= 6) Temperature in F and C */ {"TmpEnh"},
/* (<= 6) Advanced idle display mode enabled */ {"AvDvSk"},
/* (<= 6) Display rotation mode */ {"SkRetn"},
/* (<= 6) Boost enabled */ {"Kraft"},
/* (<= 4) Boost temperature */ {"KTmp"},
/* (<= 6) Automatic start mode */ {"AStart"},
/* (<= 6) Cooldown blink */ {"KjBlnk"},
/* (<= 8) Temperature calibration enter menu */ {"TempKal?"},
/* (<= 8) Settings reset command */ {"TilbStl?"},
/* (<= 8) Calibrate input voltage */ {"KalSpIn?"},
/* (<= 6) Advanced soldering screen enabled */ {"AvLdSk"},
/* (<= 6) Message Scroll Speed */ {"RullHa"},
};
const char* SettingsMenuEntries[4] = {
/*Soldering Menu*/"Lodde-\ninnst.",
/* Power Saving Menu*/"Dvale-\ninnst.",
/* UI Menu*/"Bruker-\ngrensesn.",
/* Advanced Menu*/"Avanserte\nvalg", };
const char* SettingsMenuEntriesDescriptions[4] ={
"Loddeinnstillinger",
"Dvaleinnstillinger",
"Brukergrensesnitt-innstillinger",
"Avanserte valg"
};
#endif

View File

@@ -279,7 +279,7 @@ static int userConfirmation(const char* message) {
if (lcdRefresh) {
lcd.refresh();
osDelay(20);
osDelay(40);
lcdRefresh = false;
}
}
@@ -628,14 +628,14 @@ static void settings_setCalibrateVIN(void) {
case BUTTON_B_LONG:
saveSettings();
return;
break;
case BUTTON_NONE:
default:
break;
}
lcd.refresh();
osDelay(50);
osDelay(40);
// Cap to sensible values
if (systemSettings.voltageDiv < 90) {
@@ -646,55 +646,40 @@ static void settings_setCalibrateVIN(void) {
}
}
static void settings_displayCalibrateVIN(void) {
printShortDescription(14, 5);
}
static void settings_displaySolderingMenu(void) {
static void displayMenu(size_t index) {
//Call into the menu
lcd.setFont(1);
lcd.setCursor(0, 0);
//Draw title
lcd.print(SettingsMenuEntries[0]);
lcd.print(SettingsMenuEntries[index]);
//Draw symbol
//16 pixel wide image
lcd.drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * 0]));
lcd.drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
}
static void settings_displayCalibrateVIN(void) {
printShortDescription(14, 5);
}
static void settings_displaySolderingMenu(void) {
displayMenu(0);
}
static void settings_enterSolderingMenu(void) {
gui_Menu(solderingMenu);
}
static void settings_displayPowerMenu(void) {
lcd.setFont(1);
lcd.setCursor(0, 0);
//Draw title
lcd.print(SettingsMenuEntries[1]);
//Draw symbol
//16 pixel wide image
lcd.drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * 1]));
displayMenu(1);
}
static void settings_enterPowerMenu(void) {
gui_Menu(PowerMenu);
}
static void settings_displayUIMenu(void) {
lcd.setFont(1);
lcd.setCursor(0, 0);
//Draw title
lcd.print(SettingsMenuEntries[2]);
//Draw symbol
//16 pixel wide image
lcd.drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * 2]));
displayMenu(2);
}
static void settings_enterUIMenu(void) {
gui_Menu(UIMenu);
}
static void settings_displayAdvancedMenu(void) {
lcd.setFont(1);
lcd.setCursor(0, 0);
//Draw title
lcd.print(SettingsMenuEntries[3]);
//Draw symbol
//16 pixel wide image
lcd.drawArea(96 - 16, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * 3]));
displayMenu(3);
}
static void settings_enterAdvancedMenu(void) {
gui_Menu(advancedMenu);
@@ -807,7 +792,7 @@ void gui_Menu(const menuitem* menu) {
if (lcdRefresh) {
lcd.refresh(); // update the LCD
osDelay(20);
osDelay(40);
lcdRefresh = false;
}
}

View File

@@ -63,12 +63,15 @@ uint16_t getTipRawTemp(uint8_t instant) {
static int64_t filterFP = 0;
const uint8_t filterBeta = 5; //higher values smooth out more, but reduce responsiveness
if (instant) {
if (instant == 1) {
uint16_t itemp = getTipInstantTemperature();
filterFP = (filterFP << filterBeta) - filterFP;
filterFP += (itemp << 9);
filterFP = filterFP >> filterBeta;
return itemp;
} else if (instant == 2) {
filterFP = (getTipInstantTemperature() << 9);
return filterFP >> 9;
} else {
return filterFP >> 9;
}

View File

@@ -97,7 +97,7 @@ void printVoltage() {
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
}
void GUIDelay() {
osDelay(66); // 15Hz
osDelay(50);
}
void gui_drawTipTemp(bool symbol) {
// Draw tip temp handling unit conversion & tolerance near setpoint
@@ -193,13 +193,13 @@ static void waitForButtonPress() {
ButtonState buttons = getButtonState();
while (buttons) {
buttons = getButtonState();
GUIDelay();
lcd.refresh();
GUIDelay();
}
while (!buttons) {
buttons = getButtonState();
GUIDelay();
lcd.refresh();
GUIDelay();
}
}
@@ -263,6 +263,8 @@ static void gui_drawBatteryIcon() {
static void gui_solderingTempAdjust() {
uint32_t lastChange = xTaskGetTickCount();
currentlyActiveTemperatureTarget = 0;
uint32_t autoRepeatTimer = 0;
uint8_t autoRepeatAcceleration = 0;
for (;;) {
lcd.setCursor(0, 0);
lcd.clearScreen();
@@ -279,28 +281,35 @@ static void gui_solderingTempAdjust() {
return;
break;
case BUTTON_B_LONG:
if (xTaskGetTickCount() - autoRepeatTimer
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
systemSettings.SolderingTemp -= 10; // sub 10
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
case BUTTON_F_LONG:
if (xTaskGetTickCount() - autoRepeatTimer
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
systemSettings.SolderingTemp += 10;
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
case BUTTON_F_SHORT:
if (lcd.getRotation()) {
systemSettings.SolderingTemp += 10; // add 10
} else {
systemSettings.SolderingTemp -= 10; // sub 10
}
break;
case BUTTON_B_SHORT:
if (!lcd.getRotation()) {
systemSettings.SolderingTemp += 10; // add 10
} else {
systemSettings.SolderingTemp -= 10; // sub 10
}
break;
default:
break;
}
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration)
< PRESS_ACCEL_INTERVAL_MIN) {
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX
- PRESS_ACCEL_INTERVAL_MIN;
}
// constrain between 50-450 C
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp > 850)
@@ -320,7 +329,12 @@ static void gui_solderingTempAdjust() {
if (xTaskGetTickCount() - lastChange > 200)
return; // exit if user just doesn't press anything for a bit
if (lcd.getRotation())
lcd.drawChar('-');
else
lcd.drawChar('+');
lcd.drawChar(' ');
lcd.printNumber(systemSettings.SolderingTemp, 3);
if (systemSettings.temperatureInF)
@@ -328,7 +342,10 @@ static void gui_solderingTempAdjust() {
else
lcd.drawSymbol(1);
lcd.drawChar(' ');
if (lcd.getRotation())
lcd.drawChar('+');
else
lcd.drawChar('-');
lcd.refresh();
GUIDelay();
}
@@ -407,6 +424,25 @@ static int gui_SolderingSleepingMode() {
}
return 0;
}
static void display_countdown(int sleepThres) {
/*
* Print seconds or minutes (if > 99 seconds) until sleep
* mode is triggered.
*/
int lastEventTime =
lastButtonTime < lastMovementTime ?
lastMovementTime : lastButtonTime;
int downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
if (downCount > 9900) {
lcd.printNumber(downCount / 6000 + 1, 2);
lcd.print("M");
} else {
lcd.printNumber(downCount / 100 + 1, 2);
lcd.print("S");
}
}
static void gui_solderingMode() {
/*
* * Soldering (gui_solderingMode)
@@ -477,6 +513,11 @@ static void gui_solderingMode() {
lcd.printNumber(getTipPWM(), 3);
lcd.print("%");
if (systemSettings.sensitivity && systemSettings.SleepTime) {
lcd.print(" ");
display_countdown(sleepThres);
}
lcd.setCursor(0, 8);
lcd.print(SleepingTipAdvancedString);
gui_drawTipTemp(true);
@@ -553,6 +594,10 @@ static void gui_solderingMode() {
}
}
static const char *HEADERS[] = {
__DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "Rtip: ",
"Ctip: ", "Vin :" };
void showVersion(void) {
uint8_t screen = 0;
ButtonState b;
@@ -563,35 +608,36 @@ void showVersion(void) {
lcd.print((char *) "V2.05 PCB"); // Print version number
lcd.printNumber(PCBVersion, 1); //Print PCB ID number
lcd.setCursor(0, 8); // second line
lcd.print(HEADERS[screen]);
switch (screen) {
case 0:
lcd.print(__DATE__); // print the compile date
break;
case 1:
lcd.print("Heap: ");
lcd.printNumber(xPortGetFreeHeapSize(), 5);
break;
case 2:
lcd.print("HWMG: ");
lcd.printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5);
break;
case 3:
lcd.print("HWMP: ");
lcd.printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5);
break;
case 4:
lcd.print("HWMM: ");
lcd.printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5);
break;
case 5:
lcd.print("Time: ");
lcd.printNumber(xTaskGetTickCount() / 100, 5);
break;
case 6:
lcd.print("Move: ");
lcd.printNumber(lastMovementTime / 100, 5);
break;
case 7:
lcd.printNumber(getTipRawTemp(0), 5);
break;
case 8:
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 5);
break;
case 9:
printVoltage();
break;
default:
break;
}
@@ -601,8 +647,9 @@ void showVersion(void) {
return;
else if (b == BUTTON_F_SHORT) {
screen++;
screen = screen % 7;
screen = screen % 10;
}
GUIDelay();
}
}
@@ -611,20 +658,9 @@ void startGUITask(void const *argument) {
i2cDev.FRToSInit();
uint8_t tempWarningState = 0;
bool buttonLockout = false;
switch (systemSettings.OrientationMode) {
case 0:
lcd.setRotation(false);
break;
case 1:
lcd.setRotation(true);
break;
case 2:
lcd.setRotation(false);
break;
default:
break;
}
bool tempOnDisplay = false;
getTipRawTemp(2); //reset filter
lcd.setRotation(systemSettings.OrientationMode & 1);
uint32_t ticks = xTaskGetTickCount();
ticks += 400; //4 seconds from now
while (xTaskGetTickCount() < ticks) {
@@ -748,7 +784,11 @@ void startGUITask(void const *argument) {
lcd.setCursor(84, 0);
gui_drawBatteryIcon();
}
if (tipTemp > 50) {
if (tipTemp > 55)
tempOnDisplay = true;
else if (tipTemp < 45)
tempOnDisplay = false;
if (tempOnDisplay) {
//draw temp over the start soldering button
//Location changes on screen rotation
if (lcd.getRotation()) {
@@ -762,6 +802,8 @@ void startGUITask(void const *argument) {
}
//draw in the temp
lcd.setFont(0); //big font
if (!(systemSettings.coolingTempBlink
&& (xTaskGetTickCount() % 50 < 25)))
gui_drawTipTemp(false); // draw in the temp
}
}
@@ -812,7 +854,8 @@ void startPIDTask(void const *argument) {
int32_t rawTempError = currentlyActiveTemperatureTarget
- rawTemp;
int32_t ierror = (rawTempError / ((int32_t)systemSettings.PID_I));
int32_t ierror = (rawTempError
/ ((int32_t) systemSettings.PID_I));
integralCount += ierror;
if (integralCount > (itermMax / 2))
integralCount = itermMax / 2; // prevent too much lead
@@ -822,7 +865,8 @@ void startPIDTask(void const *argument) {
int32_t dInput = (rawTemp - derivativeLastValue);
/*Compute PID Output*/
int32_t output = (rawTempError / ((int32_t)systemSettings.PID_P));
int32_t output = (rawTempError
/ ((int32_t) systemSettings.PID_P));
if (((int32_t) systemSettings.PID_I))
output += integralCount;
if (((int32_t) systemSettings.PID_D))
@@ -853,35 +897,20 @@ void startPIDTask(void const *argument) {
#define MOVFilter 8
void startMOVTask(void const *argument) {
osDelay(250); // wait for accelerometer to stabilize
switch (systemSettings.OrientationMode) {
case 0:
lcd.setRotation(false);
break;
case 1:
lcd.setRotation(true);
break;
case 2:
lcd.setRotation(false);
break;
default:
break;
}
lcd.setRotation(systemSettings.OrientationMode & 1);
lastMovementTime = 0;
int16_t datax[MOVFilter];
int16_t datay[MOVFilter];
int16_t dataz[MOVFilter];
int16_t datax[MOVFilter] = { 0 };
int16_t datay[MOVFilter] = { 0 };
int16_t dataz[MOVFilter] = { 0 };
uint8_t currentPointer = 0;
memset(datax, 0, MOVFilter * sizeof(int16_t));
memset(datay, 0, MOVFilter * sizeof(int16_t));
memset(dataz, 0, MOVFilter * sizeof(int16_t));
int16_t tx, ty, tz;
int32_t avgx, avgy, avgz;
int16_t tx = 0, ty = 0, tz = 0;
int32_t avgx = 0, avgy = 0, avgz = 0;
if (systemSettings.sensitivity > 9)
systemSettings.sensitivity = 9;
#if ACCELDEBUG
uint32_t max = 0;
#endif
uint8_t rotation = 0;
Orientation rotation = ORIENTATION_FLAT;
for (;;) {
int32_t threshold = 1500 + (9 * 200);
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
@@ -894,19 +923,16 @@ void startMOVTask(void const *argument) {
rotation = accel.getOrientation();
}
if (systemSettings.OrientationMode == 2) {
if (rotation != 0) {
lcd.setRotation(rotation == 2); // link the data through
if (rotation != ORIENTATION_FLAT) {
lcd.setRotation(rotation == ORIENTATION_LEFT_HAND); // link the data through
}
}
datax[currentPointer] = (int32_t) tx;
datay[currentPointer] = (int32_t) ty;
dataz[currentPointer] = (int32_t) tz;
currentPointer = (currentPointer + 1) % MOVFilter;
#if ACCELDEBUG
// Debug for Accel
avgx = avgy = avgz = 0;
// calculate averages
for (uint8_t i = 0; i < MOVFilter; i++) {
avgx += datax[i];
avgy += datay[i];
@@ -915,38 +941,35 @@ void startMOVTask(void const *argument) {
avgx /= MOVFilter;
avgy /= MOVFilter;
avgz /= MOVFilter;
//Sum the deltas
int32_t error = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz));
#if ACCELDEBUG
// Debug for Accel
lcd.setFont(1);
lcd.setCursor(0, 0);
lcd.printNumber(abs(avgx - (int32_t) tx), 5);
lcd.print(" ");
lcd.printNumber(abs(avgy - (int32_t) ty), 5);
if ((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)) > max)
if (error > max) {
max = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz));
}
lcd.setCursor(0, 8);
lcd.printNumber(max, 5);
lcd.print(" ");
lcd.printNumber((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)), 5);
lcd.refresh();
if (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET)
if (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET) {
max = 0;
#endif
// calculate averages
avgx = avgy = avgz = 0;
for (uint8_t i = 0; i < MOVFilter; i++) {
avgx += datax[i];
avgy += datay[i];
avgz += dataz[i];
}
avgx /= MOVFilter;
avgy /= MOVFilter;
avgz /= MOVFilter;
#endif
// So now we have averages, we want to look if these are different by more
// than the threshold
//Sum the deltas
int32_t error = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz));
// If error has occurred then we update the tick timer
if (error > threshold) {
lastMovementTime = xTaskGetTickCount();