Compare commits

..

No commits in common. "10693c4569b4bf33e02255c598693569f0950b18" and "947191a7979bf394986d3c3920e8fd0da472be58" have entirely different histories.

6 changed files with 14 additions and 64 deletions

View File

@ -1,6 +1,6 @@
version: 0.1
cli:
version: 1.22.15
version: 1.22.12
plugins:
sources:
- id: trunk
@ -8,18 +8,18 @@ plugins:
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- renovate@40.0.6
- renovate@39.243.0
- prettier@3.5.3
- trufflehog@3.88.26
- trufflehog@3.88.23
- yamllint@1.37.0
- bandit@1.8.3
- terrascan@1.19.9
- trivy@0.61.1
- trivy@0.61.0
- taplo@0.9.3
- ruff@0.11.7
- ruff@0.11.5
- isort@6.0.1
- markdownlint@0.44.0
- oxipng@9.1.5
- oxipng@9.1.4
- svgo@3.3.2
- actionlint@1.7.7
- flake8@7.2.0
@ -28,7 +28,7 @@ lint:
- shellcheck@0.10.0
- black@25.1.0
- git-diff-check
- gitleaks@8.25.1
- gitleaks@8.24.3
- clang-format@16.0.3
ignore:
- linters: [ALL]

View File

@ -108,7 +108,7 @@ lib_deps =
[device-ui_base]
lib_deps =
# renovate: datasource=git-refs depName=meshtastic-device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
https://github.com/meshtastic/device-ui/archive/aa38459f4e4c0bc6e4d1bda52d26393f0fcf1b97.zip
https://github.com/meshtastic/device-ui/archive/33aa6890f7862d81c2bc1658f43eeea7a8081c6e.zip
; Common libs for environmental measurements in telemetry module
[environmental_base]

View File

@ -1,10 +1,8 @@
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
#include "./LCMEN2R13EFC1.h"
#include <assert.h>
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
#include "SPILock.h"
#include <assert.h>
using namespace NicheGraphics::Drivers;
@ -152,9 +150,6 @@ void LCMEN213EFC1::reset()
void LCMEN213EFC1::sendCommand(const uint8_t command)
{
// Take firmware's SPI lock
spiLock->lock();
spi->beginTransaction(spiSettings);
digitalWrite(pin_dc, LOW); // DC pin low indicates command
digitalWrite(pin_cs, LOW);
@ -162,8 +157,6 @@ void LCMEN213EFC1::sendCommand(const uint8_t command)
digitalWrite(pin_cs, HIGH);
digitalWrite(pin_dc, HIGH);
spi->endTransaction();
spiLock->unlock();
}
void LCMEN213EFC1::sendData(uint8_t data)
@ -173,9 +166,6 @@ void LCMEN213EFC1::sendData(uint8_t data)
void LCMEN213EFC1::sendData(const uint8_t *data, uint32_t size)
{
// Take firmware's SPI lock
spiLock->lock();
spi->beginTransaction(spiSettings);
digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command
digitalWrite(pin_cs, LOW);
@ -193,8 +183,6 @@ void LCMEN213EFC1::sendData(const uint8_t *data, uint32_t size)
digitalWrite(pin_cs, HIGH);
digitalWrite(pin_dc, HIGH);
spi->endTransaction();
spiLock->unlock();
}
void LCMEN213EFC1::configFull()

View File

@ -1,9 +1,6 @@
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
#include "./SSD16XX.h"
#include "SPILock.h"
#ifdef MESHTASTIC_INCLUDE_NICHE_GRAPHICS
using namespace NicheGraphics::Drivers;
SSD16XX::SSD16XX(uint16_t width, uint16_t height, UpdateTypes supported, uint8_t bufferOffsetX)
@ -85,9 +82,6 @@ void SSD16XX::sendCommand(const uint8_t command)
if (failed)
return;
// Take firmware's SPI lock
spiLock->lock();
spi->beginTransaction(spiSettings);
digitalWrite(pin_dc, LOW); // DC pin low indicates command
digitalWrite(pin_cs, LOW);
@ -95,8 +89,6 @@ void SSD16XX::sendCommand(const uint8_t command)
digitalWrite(pin_cs, HIGH);
digitalWrite(pin_dc, HIGH);
spi->endTransaction();
spiLock->unlock();
}
void SSD16XX::sendData(uint8_t data)
@ -111,9 +103,6 @@ void SSD16XX::sendData(const uint8_t *data, uint32_t size)
if (failed)
return;
// Take firmware's SPI lock
spiLock->lock();
spi->beginTransaction(spiSettings);
digitalWrite(pin_dc, HIGH); // DC pin HIGH indicates data, instead of command
digitalWrite(pin_cs, LOW);
@ -130,8 +119,6 @@ void SSD16XX::sendData(const uint8_t *data, uint32_t size)
digitalWrite(pin_cs, HIGH);
digitalWrite(pin_dc, HIGH);
spi->endTransaction();
spiLock->unlock();
}
void SSD16XX::configFullscreen()

View File

@ -13,7 +13,6 @@ Avoid bloating everyone's protobuf code for our one-off UI implementations
#include "configuration.h"
#include "SPILock.h"
#include "SafeFile.h"
namespace NicheGraphics
@ -47,9 +46,6 @@ template <typename T> class FlashData
public:
static bool load(T *data, const char *label)
{
// Take firmware's SPI lock
concurrency::LockGuard guard(spiLock);
// Set false if we run into issues
bool okay = true;
@ -107,18 +103,14 @@ template <typename T> class FlashData
return okay;
}
// Save module's custom data (settings?) to flash. Doesn't use protobufs
// Takes the firmware's SPI lock, in case the files are stored on SD card
// Need to lock and unlock around specific FS methods, as the SafeFile class takes the lock for itself internally.
// Save module's custom data (settings?) to flash. Does use protobufs
static void save(T *data, const char *label)
{
// Get a filename based on the label
std::string filename = getFilename(label);
#ifdef FSCom
spiLock->lock();
FSCom.mkdir("/NicheGraphics");
spiLock->unlock();
auto f = SafeFile(filename.c_str(), true); // "true": full atomic. Write new data to temp file, then rename.
@ -127,10 +119,10 @@ template <typename T> class FlashData
// Calculate a hash of the data
uint32_t hash = getHash(data);
spiLock->lock();
f.write((uint8_t *)data, sizeof(T)); // Write the actual data
f.write((uint8_t *)&hash, sizeof(hash)); // Append the hash
spiLock->unlock();
// f.flush();
bool writeSucceeded = f.close();
@ -147,9 +139,6 @@ template <typename T> class FlashData
inline void clearFlashData()
{
// Take firmware's SPI lock, in case the files are stored on SD card
concurrency::LockGuard guard(spiLock);
#ifdef FSCom
File dir = FSCom.open("/NicheGraphics"); // Open the directory
File file = dir.openNextFile(); // Attempt to open the first file in the directory

View File

@ -22,8 +22,6 @@ InkHUD::MessageStore::MessageStore(std::string label)
}
// Write the contents of the MessageStore::messages object to flash
// Takes the firmware's SPI lock during FS operations. Implemented for consistency, but only relevant when using SD card.
// Need to lock and unlock around specific FS methods, as the SafeFile class takes the lock for itself internally
void InkHUD::MessageStore::saveToFlash()
{
assert(!filename.empty());
@ -31,9 +29,7 @@ void InkHUD::MessageStore::saveToFlash()
#ifdef FSCom
// Make the directory, if doesn't already exist
// This is the same directory accessed by NicheGraphics::FlashData
spiLock->lock();
FSCom.mkdir("/NicheGraphics");
spiLock->unlock();
// Open or create the file
// No "full atomic": don't save then rename
@ -41,9 +37,6 @@ void InkHUD::MessageStore::saveToFlash()
LOG_INFO("Saving messages in %s", filename.c_str());
// Take firmware's SPI Lock while writing
spiLock->lock();
// 1st byte: how many messages will be written to store
f.write(messages.size());
@ -58,9 +51,6 @@ void InkHUD::MessageStore::saveToFlash()
LOG_DEBUG("Wrote message %u, length %u, text \"%s\"", (uint32_t)i, min(MAX_MESSAGE_SIZE, m.text.size()), m.text.c_str());
}
// Release firmware's SPI lock, because SafeFile::close needs it
spiLock->unlock();
bool writeSucceeded = f.close();
if (!writeSucceeded) {
@ -73,7 +63,6 @@ void InkHUD::MessageStore::saveToFlash()
// Attempt to load the previous contents of the MessageStore:message deque from flash.
// Filename is controlled by the "label" parameter
// Takes the firmware's SPI lock during FS operations. Implemented for consistency, but only relevant when using SD card.
void InkHUD::MessageStore::loadFromFlash()
{
// Hopefully redundant. Initial intention is to only load / save once per boot.
@ -81,9 +70,6 @@ void InkHUD::MessageStore::loadFromFlash()
#ifdef FSCom
// Take the firmware's SPI Lock, in case filesystem is on SD card
concurrency::LockGuard guard(spiLock);
// Check that the file *does* actually exist
if (!FSCom.exists(filename.c_str())) {
LOG_WARN("'%s' not found. Using default values", filename.c_str());