Skip to content

Commit

Permalink
Some scripting updates, bad 6PLUS_V2 define corrected, Version number…
Browse files Browse the repository at this point in the history
… shown in the about box
  • Loading branch information
turgu1 committed Oct 15, 2024
1 parent 4034427 commit 253ac77
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 79 deletions.
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,36 @@ if(DEVICE MATCHES "^INKPLATE_6$")
message("INKPLATE 6 defined")
set(DEVICE_NAME "I6")
add_compile_definitions(
EPUB_INKPLATE_BUILD=1
INKPLATE_6=1
MCP23017=1)
elseif(DEVICE MATCHES "^INKPLATE_6PLUS$")
message("INKPLATE 6PLUS defined")
set(DEVICE_NAME "I6P")
add_compile_definitions(
EPUB_INKPLATE_BUILD=1
INKPLATE_6PLUS=1
MCP23017=1)
elseif(DEVICE MATCHES "^INKPLATE_6PLUS_V2$")
message("INKPLATE 6PLUS V2 defined")
set(DEVICE_NAME "I6PV2")
add_compile_definitions(
EPUB_INKPLATE_BUILD=1
INKPLATE_6PLUS_V2=1
PCAL6416=1)
elseif(DEVICE MATCHES "^INKPLATE_6FLICK$")
message("INKPLATE 6FLICK defined")
set(DEVICE_NAME "I6F")
add_compile_definitions(
EPUB_INKPLATE_BUILD=1
INKPLATE_6FLICK=1
PCAL6416=1)
elseif(DEVICE MATCHES "^INKPLATE_10$")
message("INKPLATE 10 defined")
set(DEVICE_NAME "I10")
add_compile_definitions(
EPUB_INKPLATE_BUILD=1
INKPLATE_10=1
MCP23017=1)
elseif(DEVICE MATCHES "^INKPLATE_10_V2$")
message("INKPLATE 10 V2 defined")
set(DEVICE_NAME "I10V2")
add_compile_definitions(
EPUB_INKPLATE_BUILD=1
INKPLATE_10_V2=1
PCAL6416=1)
else()
Expand All @@ -62,9 +56,13 @@ list(APPEND EXTRA_COMPONENT_DIRS
src
)

string(TIMESTAMP THE_TIME "%Y/%m/%d-%H:%M:%SZ" UTC)
string(TIMESTAMP THE_TIME "%Y%m%d-%H%MZ" UTC)

set(PROJECT_VER "${APP_VERSION}-${DEVICE_NAME}-${THE_TIME}")

add_compile_definitions(
APP_VERSION="${APP_VERSION}"
EPUB_INKPLATE_BUILD=1)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(EPub-InkPlate)
42 changes: 33 additions & 9 deletions bld_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@
# Update for idf.py, October 2024
#

if [ ! command -v idf.py >/dev/null 2>&1 ]; then
. ~/esp/esp-idf/export.sh
if [ ! command -v idf.py >/dev/null 2>&1 ]; then
echo "Unable to get esp-idf ready. Aborting." >&2
return 1
fi
fi

if [ "$3" = "" ]; then
echo "Usage: $0 version type extended_case"
echo "Usage: $0 version_nbr type extended_case [build_only]"
echo "type = 6, 6v2, 10, 10v2, 6plus, 6plusv2, 6flick"
echo "extended_case = 0, 1"
echo " 0 = no extended case"
echo " 1 = with extended case"
echo "build_only (optional) = 1, 2"
echo " 1 = clean build folder"
echo " 2 = keep build folder"
return 1
fi

if [ "$3" = "0" ]; then
folder="release-$1-inkplate_$2"
folder="release-v$1-inkplate_$2"
environment="inkplate_$2_release"
case "$2" in
"6") device="INKPLATE_6" ;;
Expand All @@ -28,18 +41,22 @@ if [ "$3" = "0" ]; then
return 1
;;
esac
echo "Device is ${device}"
else
folder="release-$1-inkplate_extended_case_$2"
folder="release-v$1-inkplate_extended_case_$2"
environment="inkplate_$2_extended_case_release"
fi

if [ -f "$folder.zip" ]; then
echo "File $folder.zip already exist!"
return 1
if [ "$4" = "" ]; then
if [ -f "$folder.zip" ]; then
echo "File $folder.zip already exist!"
return 1
fi
fi

rm bin/*.binEPub-InkPlate.bin
rm -rf build
if [ ! "$4" = "2" ]; then
rm -rf build
fi

idf.py build -DDEVICE=$device -DAPP_VERSION=$1

Expand All @@ -48,6 +65,13 @@ if [ ! -f "build/EPub-InkPlate.bin" ]; then
return 1
fi

if [ ! "$4" = "" ]; then
echo "Compilation only... bld_release completed."
return 0
fi

rm bin/*.bin

mkdir "$folder"

cp build/bootloader/bootloader.bin bin
Expand Down Expand Up @@ -82,4 +106,4 @@ zip -r "$folder.zip" "$folder"

rm -rf "$folder"

echo "Completed."
echo "bld_release completed."
4 changes: 3 additions & 1 deletion components/global/src/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

//#pragma GCC diagnostic error "-Wframe-larger-than=10"

#define APP_VERSION "2.0.1"
#ifndef APP_VERSION
#define APP_VERSION "2.1.0"
#endif

#if !(EPUB_LINUX_BUILD || EPUB_INKPLATE_BUILD)
#error "BUILD_TYPE Not Set."
Expand Down
116 changes: 59 additions & 57 deletions components/inkplate_screen/src/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ Screen::draw_rectangle(
SELECT(1bit);
}
else {
#if INKPLATE_6PLUS | INKPLATE_6PLUSV2 | INKPLATE_6FLICK
#if INKPLATE_6PLUS | INKPLATE_6PLUS_V2 | INKPLATE_6FLICK
color = color == Color::BLACK ? 0 : 7;
#endif

SELECT(3bit);
}

Expand Down Expand Up @@ -217,9 +218,10 @@ Screen::draw_round_rectangle(
SELECT(1bit);
}
else {
#if INKPLATE_6PLUS | INKPLATE_6PLUSV2 | INKPLATE_6FLICK
#if INKPLATE_6PLUS | INKPLATE_6PLUS_V2 | INKPLATE_6FLICK
color = color == Color::BLACK ? 0 : 7;
#endif

SELECT(3bit);
}

Expand Down Expand Up @@ -343,69 +345,69 @@ Screen::colorize_region(
uint8_t color) //, bool show)
{
#if !INKPLATE_10
if (pixel_resolution == PixelResolution::ONE_BIT) {
color = color == Color::BLACK ? 1 : 0;

switch (orientation) {
case Orientation::BOTTOM:
low_colorize_1bit(dim, pos, color);
break;
case Orientation::TOP:
low_colorize_1bit(dim, Pos(width - (pos.x + dim.width), height - (pos.y + dim.height)), color);
break;
case Orientation::LEFT:
low_colorize_1bit(Dim(dim.height, dim.width), Pos(pos.y, width - (pos.x + dim.width)), color);
break;
case Orientation::RIGHT:
low_colorize_1bit(Dim(dim.height, dim.width), Pos(height - (pos.y + dim.height), pos.x), color);
break;
if (pixel_resolution == PixelResolution::ONE_BIT) {
color = color == Color::BLACK ? 1 : 0;

switch (orientation) {
case Orientation::BOTTOM:
low_colorize_1bit(dim, pos, color);
break;
case Orientation::TOP:
low_colorize_1bit(dim, Pos(width - (pos.x + dim.width), height - (pos.y + dim.height)), color);
break;
case Orientation::LEFT:
low_colorize_1bit(Dim(dim.height, dim.width), Pos(pos.y, width - (pos.x + dim.width)), color);
break;
case Orientation::RIGHT:
low_colorize_1bit(Dim(dim.height, dim.width), Pos(height - (pos.y + dim.height), pos.x), color);
break;
}
}
}
else {
#if INKPLATE_6PLUS | INKPLATE_6PLUSV2 | INKPLATE_6FLICK
color = color == Color::BLACK ? 0 : 7;
#endif
switch (orientation) {
case Orientation::BOTTOM:
low_colorize_3bit(dim, pos, color);
break;
case Orientation::TOP:
low_colorize_3bit(dim, Pos(width - (pos.x + dim.width), height - (pos.y + dim.height)), color);
break;
case Orientation::LEFT:
low_colorize_3bit(Dim(dim.height, dim.width), Pos(pos.y, width - (pos.x + dim.width)), color);
break;
case Orientation::RIGHT:
low_colorize_3bit(Dim(dim.height, dim.width), Pos(height - (pos.y + dim.height), pos.x), color);
break;
else {
#if INKPLATE_6PLUS | INKPLATE_6PLUS_V2 | INKPLATE_6FLICK
color = color == Color::BLACK ? 0 : 7;
#endif
switch (orientation) {
case Orientation::BOTTOM:
low_colorize_3bit(dim, pos, color);
break;
case Orientation::TOP:
low_colorize_3bit(dim, Pos(width - (pos.x + dim.width), height - (pos.y + dim.height)), color);
break;
case Orientation::LEFT:
low_colorize_3bit(Dim(dim.height, dim.width), Pos(pos.y, width - (pos.x + dim.width)), color);
break;
case Orientation::RIGHT:
low_colorize_3bit(Dim(dim.height, dim.width), Pos(height - (pos.y + dim.height), pos.x), color);
break;
}
}
}

#else
int16_t x_max = pos.x + dim.width;
int16_t y_max = pos.y + dim.height;
#else
int16_t x_max = pos.x + dim.width;
int16_t y_max = pos.y + dim.height;

if (y_max > height) y_max = height;
if (x_max > width ) x_max = width;
if (y_max > height) y_max = height;
if (x_max > width ) x_max = width;

#define CODE(resolution, orientation) \
for (int j = pos.y; j < y_max; j++) { \
for (int i = pos.x; i < x_max; i++) { \
set_pixel_o_##orientation##_##resolution(i, j, color); \
} \
}
#define CODE(resolution, orientation) \
for (int j = pos.y; j < y_max; j++) { \
for (int i = pos.x; i < x_max; i++) { \
set_pixel_o_##orientation##_##resolution(i, j, color); \
} \
}

if (pixel_resolution == PixelResolution::ONE_BIT) {
color = color == Color::BLACK ? 1 : 0;
SELECT(1bit);
}
else {
SELECT(3bit);
}
if (pixel_resolution == PixelResolution::ONE_BIT) {
color = color == Color::BLACK ? 1 : 0;
SELECT(1bit);
}
else {
SELECT(3bit);
}

#undef CODE
#undef CODE

#endif
#endif
}

void
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(components
memory_pool
pictures
esp_http_server
esp_app_format
pthread
freetype
)
Expand Down
11 changes: 8 additions & 3 deletions src/controllers/common_actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#include "esp.hpp"
#endif

#include "esp_system.h"
#include "esp_app_desc.h"

void
CommonActions::return_to_last()
{
Expand Down Expand Up @@ -73,14 +76,16 @@ CommonActions::power_it_off()
void
CommonActions::about()
{
const esp_app_desc_t * descr = esp_app_get_description();

menu_viewer.clear_highlight();
msg_viewer.show(
MsgViewer::MsgType::BOOK,
false,
false,
"About EPub-InkPlate",
"EPub EBook Reader Version %s for the InkPlate e-paper display devices. "
"EPub EBook Reader Version [%s] for the InkPlate e-paper display devices. "
"This application was made by Guy Turcotte, Quebec, QC, Canada, "
"with great support from e-Radionica.",
APP_VERSION);
"with great support from e-Radionica, and now from Soldered.",
descr == nullptr ? APP_VERSION : descr->version);
}
4 changes: 2 additions & 2 deletions src/viewers/msg_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ void MsgViewer::show(
const char * title,
const char * fmt_str, ...)
{
char buff[200];
char buff[250];

width = Screen::get_width() - 60;

if (page.get_compute_mode() == Page::ComputeMode::LOCATION) return; // Cannot be used durint location computation

va_list args;
va_start(args, fmt_str);
vsnprintf(buff, 200, fmt_str, args);
vsnprintf(buff, 250, fmt_str, args);
va_end(args);

Page::Format fmt = {
Expand Down

0 comments on commit 253ac77

Please sign in to comment.