Improve Nostr Zap functionality, BitAxe integration bugfix
This commit is contained in:
parent
e39a0ccc14
commit
2777637355
9 changed files with 430 additions and 116 deletions
24
lib/btclock/nostrdisplay_handler.cpp
Normal file
24
lib/btclock/nostrdisplay_handler.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "nostrdisplay_handler.hpp"
|
||||
|
||||
std::array<std::string, NUM_SCREENS> parseZapNotify(std::uint16_t amount, bool withSatsSymbol)
|
||||
{
|
||||
std::string text = std::to_string(amount);
|
||||
std::size_t textLength = text.length();
|
||||
std::size_t startIndex = NUM_SCREENS - textLength;
|
||||
|
||||
std::array<std::string, NUM_SCREENS> textEpdContent = {"ZAP", "mdi-lnbolt", "", "", "", "", ""};
|
||||
|
||||
// Insert the sats symbol just before the digits
|
||||
if (startIndex > 0 && withSatsSymbol)
|
||||
{
|
||||
textEpdContent[startIndex - 1] = "STS";
|
||||
}
|
||||
|
||||
// Place the digits
|
||||
for (std::size_t i = 0; i < textLength; i++)
|
||||
{
|
||||
textEpdContent[startIndex + i] = text.substr(i, 1);
|
||||
}
|
||||
|
||||
return textEpdContent;
|
||||
}
|
5
lib/btclock/nostrdisplay_handler.hpp
Normal file
5
lib/btclock/nostrdisplay_handler.hpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <array>
|
||||
#include <string>
|
||||
#include "utils.hpp"
|
||||
|
||||
std::array<std::string, NUM_SCREENS> parseZapNotify(std::uint16_t amount, bool withSatsSymbol);
|
Loading…
Add table
Add a link
Reference in a new issue