Skip to content

Commit

Permalink
authorities, schedules, histories (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
dadleyy committed Jul 1, 2023
1 parent 2fe5bec commit 6338a28
Show file tree
Hide file tree
Showing 75 changed files with 3,173 additions and 632 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: "(srv-test) test"
run: cargo test
- name: "(srv-test) doc"
run: cargo doc
run: cargo doc --document-private-items
- name: "(srv-test) bundle: prepare"
run: mkdir -p beetle-srv-docs
- name: "(srv-test) bundle: copy"
Expand Down Expand Up @@ -172,9 +172,10 @@ jobs:
BEETLE_VERSION: "${{ github.sha }}"
# note: These are specific paths related to nginx hosting config. When developing locally,
# it is more likely you will be serving from a root `/`.
BEETLE_UI_ROOT: "/beetle/"
BEETLE_API_ROOT: "/beetle/api/"
BEETLE_LOGIN_URL: "https://www.krumpled.com/beetle/api/auth/redirect"
BEETLE_UI_ROOT: ${{ secrets.BEETLE_UI_ROOT }}
BEETLE_API_ROOT: ${{ secrets.BEETLE_API_ROOT }}
BEETLE_LOGIN_URL: ${{ secrets.BEETLE_LOGIN_URL }}
BEETLE_LOGOUT_URL: ${{ secrets.BEETLE_LOGOUT_URL }}
defaults:
run:
working-directory: src/beetle-ui
Expand Down Expand Up @@ -354,7 +355,7 @@ jobs:
with:
name: "beetle-pio-${{ steps.vars.outputs.SHORT_SHA }}.tar.gz"

- name: "awscli: prepare"
- name: "(aws) upload all artifacts"
run: |
mkdir -p _awscli-download
pushd _awscli-download
Expand Down Expand Up @@ -392,9 +393,6 @@ jobs:
popd
- name: printall
run: ls -lah

- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ orient-beetle-ci.key
.env
env.toml
.storage
*.png
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions demo-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"beetle:kind": "split",
"beetle:content": {
"left": {
"beetle:kind": "messages",
"beetle:content": [{
"size": 20,
"message": "10am - 11:30am",
"font": { "beetle:kind": "roboto" }
}, {
"size": 20,
"message": "two",
"font": { "beetle:kind": "roboto" }
}, {
"size": 20,
"message": "three",
"font": { "beetle:kind": "deja_vu" }
}]
},
"right": {
"beetle:kind": "scannable",
"beetle:content": {
"contents": "https://google.com"
}
}
}
}
66 changes: 66 additions & 0 deletions event-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"beetle:kind": "split",
"beetle:content": {
"ratio": 75,
"left": {
"beetle:kind": "messages",
"beetle:content": [
{
"message": "This is some kind of really long event",
"margin": { "bottom": 0, "top": 10, "left": 10 },
"padding": { "left": 5, "top": 5, "bottom": 5 },
"border": { "left": 2 },
"size": 34
},
{
"message": "10:30AM - 11:00AM",
"margin": { "bottom": 10, "top": 0, "left": 10 },
"padding": { "left": 5, "top": 5, "bottom": 5 },
"border": { "left": 2 },
"size": 28
},

{
"message": "Second event",
"margin": { "bottom": 0, "top": 10, "left": 10 },
"padding": { "left": 5, "top": 5, "bottom": 5 },
"border": { "left": 2 },
"size": 34
},
{
"message": "1:00PM - 2:00PM",
"margin": { "bottom": 10, "top": 0, "left": 10 },
"padding": { "left": 5, "top": 5, "bottom": 5 },
"border": { "left": 2 },
"size": 28
},

{
"message": "Third event for all",
"margin": { "bottom": 0, "top": 10, "left": 10 },
"padding": { "left": 5, "top": 5, "bottom": 5 },
"border": { "left": 2 },
"size": 34
},
{
"message": "1:00PM - 2:00PM",
"margin": { "bottom": 10, "top": 0, "left": 10 },
"padding": { "left": 5, "top": 5, "bottom": 5 },
"border": { "left": 2 },
"size": 28
}
]
},
"right": {
"beetle:kind": "messages",
"beetle:content": [
{
"message": "-Danny",
"font": { "beetle:kind": "roboto" },
"margin": { "left": 10, "top": 200 },
"size": 30
}
]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added hardware/stl/case-top.stl
Binary file not shown.
Binary file added hardware/stl/holder-insert.stl
Binary file not shown.
Binary file added hardware/stl/left-peg.stl
Binary file not shown.
8 changes: 6 additions & 2 deletions src/beetle-pio/lib/redis-events/redis-events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ namespace redisevents {
uint8_t copy_id(char *, uint8_t);

private:
constexpr static const uint32_t FRAMEBUFFER_SIZE = 2828 * 3;
constexpr static const uint32_t PARSED_MESSAGE_SIZE = 2828 * 3;
// These two amounts are the size of memory allocations used for receiving data from our redis
// client, and storing the parsed value.
constexpr static const uint32_t FRAMEBUFFER_SIZE = 1024 * 20;
constexpr static const uint32_t PARSED_MESSAGE_SIZE = 1024 * 20;

constexpr static const uint32_t MAX_ID_SIZE = 36;

// The amount of attempts to read from our tls connection that return no data
// before we attempt to reconnect.
constexpr static const uint32_t MAX_EMPTY_READ_RESET = 100;

// The messages we send back are pretty small.
constexpr static const uint8_t OUTBOUND_BUFFER_SIZE = 200;

// The amount of times we reset our connection before we will re-request a new device id.
Expand Down
9 changes: 5 additions & 4 deletions src/beetle-pio/platformio.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[platformio]
default_envs = xiao
default_envs=xiao

[env]
framework=arduino
Expand All @@ -21,7 +21,7 @@ monitor_filters=esp32_exception_decoder

[env:xiao]
platform=espressif32@6.1.0
board = seeed_xiao_esp32c3
board=seeed_xiao_esp32c3
lib_deps=
zinggjm/GxEPD2
adafruit/Adafruit GFX Library
Expand All @@ -34,6 +34,8 @@ build_flags=
-DXIAO
-DDISABLE_PROXIMITY

# DEPRECATED: The project took a turn and is now using an e-ink display with an esp32-c3
# development board. This configuration is being left here for posterity.
[env:firebeetle]
platform=espressif32@4.0.0
board=firebeetle32
Expand All @@ -54,11 +56,10 @@ build_flags=
-DTFT_MOSI=23
-DTFT_SCLK=18
# lvgl macros; this allows us to avoid using a `lv_conf.h` file.
# -DLV_FONT_UNSCII_16=1
-DLV_CONF_SKIP=1
-DLV_USE_LOG=1
-DLV_FONT=1
lib_deps =
lib_deps=
Bodmer/TFT_eSPI@^2.4
lvgl/lvgl@^8.3
adafruit/Adafruit_VCNL4010@^1.1.0
Expand Down
5 changes: 5 additions & 0 deletions src/beetle-pio/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,17 @@ bool failed = false;
bool prox_ready = false;

void setup(void) {
#ifdef XIAO
pinMode(XIAO_NEOPIXEL_PIN, OUTPUT);
#endif

#ifndef RELEASE
Serial.begin(115200);
#endif

unsigned char i = 0;


while (i < 12) {
#ifdef XIAO
lights.boot(i);
Expand Down
12 changes: 6 additions & 6 deletions src/beetle-pio/src/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ Message::~Message() {
}

Working::Working(uint16_t size):
id_content((char *) malloc(sizeof(char) * MAX_ID_SIZE)),
id_content((char *) malloc(sizeof(char) * states::MAX_ID_SIZE)),
id_size(size),
messages({}),
_has_new(false) {
log_d("creating working state");
memset(id_content, '\0', MAX_ID_SIZE);
memset(id_content, '\0', states::MAX_ID_SIZE);
}

Working::Working(Working&& other): messages(std::move(other.messages)) {
Expand All @@ -73,22 +73,22 @@ Working& Working::operator=(Working&& other) {
return *this;
}

std::array<Message, Working::MESSAGE_COUNT>::const_iterator Working::end(void) const {
std::array<Message, states::MESSAGE_COUNT>::const_iterator Working::end(void) const {
return messages.cend();
}

// When requesting an iterator to our messages while in the `Working`, we will assume that subsequent
// requests are no interested in anything they have read since the last iterator was requested.
std::array<Message, Working::MESSAGE_COUNT>::const_iterator Working::begin(void) const {
std::array<Message, states::MESSAGE_COUNT>::const_iterator Working::begin(void) const {
return _has_new ? messages.cbegin() : messages.cend();
}

// Get a reference to the next available message.
Message& Working::next(void) {
std::swap(messages[0], messages[Working::MESSAGE_COUNT-1]);
std::swap(messages[0], messages[states::MESSAGE_COUNT-1]);
_has_new = true;

for (uint8_t i = Working::MESSAGE_COUNT - 1; i > 1; i--) {
for (uint8_t i = states::MESSAGE_COUNT - 1; i > 1; i--) {
std::swap(messages[i], messages[i-1]);
}

Expand Down
21 changes: 13 additions & 8 deletions src/beetle-pio/src/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@

namespace states {

constexpr const uint32_t MAX_MESSAGE_SIZE = 2828 * 3;
// The size of our allocated memory per message.
constexpr const uint32_t MAX_MESSAGE_SIZE = 1024 * 20;

// The size of our allocated memory for the device id.
constexpr const uint16_t MAX_ID_SIZE = 40;

// The amount of messages to maintain at any given point of time.
constexpr const uint8_t MESSAGE_COUNT = 1;

// Forward declarations used for `friend` related things.
struct State;
struct Unknown;
struct Configuring;
struct Connecting;
struct Connected;
struct Working;

using StateT = std::variant<Unknown, Configuring, Connecting, Connected, Working>;

// Reserve a state to deal with displaying to the user some fatal looking screen.
Expand Down Expand Up @@ -88,10 +97,6 @@ struct Message final {

struct Working final {
public:
constexpr static const uint16_t WORKING_BUFFER_SIZE = 10;
constexpr static const uint16_t MAX_ID_SIZE = 40;
static constexpr const uint8_t MESSAGE_COUNT = 2;

explicit Working(uint16_t);
~Working();
Working(Working&&);
Expand All @@ -100,15 +105,15 @@ struct Working final {
Working(const Working&) = delete;
Working& operator=(const Working&) = delete;

std::array<Message, MESSAGE_COUNT>::const_iterator begin(void) const;
std::array<Message, MESSAGE_COUNT>::const_iterator end(void) const;
std::array<Message, states::MESSAGE_COUNT>::const_iterator begin(void) const;
std::array<Message, states::MESSAGE_COUNT>::const_iterator end(void) const;
Message& next(void);

char * id_content;
uint16_t id_size;

private:
std::array<Message, MESSAGE_COUNT> messages;
std::array<Message, states::MESSAGE_COUNT> messages;
mutable bool _has_new;

friend State;
Expand Down
4 changes: 2 additions & 2 deletions src/beetle-pio/src/xiao-lighting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace lighting {
public:
Lighting():
_override(false),
_pixels(XIAO_NEOPIXEL_COUNT, XIAO_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ400) {}
_pixels(XIAO_NEOPIXEL_COUNT, XIAO_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800) {}
~Lighting() = default;

Lighting(const Lighting&) = delete;
Expand Down Expand Up @@ -80,7 +80,7 @@ namespace lighting {
_pixels.begin();
}

_pixels.setBrightness(50);
_pixels.setBrightness(100);
_pixels.clear();

for(uint8_t i = 0; i < XIAO_NEOPIXEL_COUNT; i++) {
Expand Down
Binary file added src/beetle-srv/Barlow-Bold.ttf
Binary file not shown.
4 changes: 4 additions & 0 deletions src/beetle-srv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ imageproc = { version = "^0.23" }
image = { version = "^0.24" }
rusttype = { version = "^0.9" }
qrencode = { version = "^0.14" }
anyhow = "1.0.71"
url = "2.3.1"

[features]
# Enabling this feature will allow developers to use a "naked" tcp stream for redis connections, instead of
# the default, which is to use `async_tls`.
redis-insecure = []

[patch.crates-io]
Expand Down
Binary file added src/beetle-srv/Roboto-Regular.ttf
Binary file not shown.
Binary file added src/beetle-srv/Teko-Regular.ttf
Binary file not shown.
Loading

0 comments on commit 6338a28

Please sign in to comment.