Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esp32s2 usb host mode #181

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: |
sudo apt-get install rename
python -m pip install --upgrade pip
pip install -U platformio==5.2.5
pip install -U platformio==6.1.6
- name: Run PlatformIO
run: |
set -x
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(WirelessPrinting)
20 changes: 20 additions & 0 deletions ESP8266WirelessPrintAsync/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was automatically generated for projects
# without default 'CMakeLists.txt' file.

FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/ESP8266WirelessPrintAsync/*.*)

idf_component_register(
SRCS ${app_sources}
INCLUDE_DIRS "." "../components/usb_host_ch34x_vcp/include/usb"
REQUIRES usb_host_ch34x_vcp usb_host_cdc_acm usb_host_cp210x_vcp usb_host_vcp usb_host_ftdi_vcp
)

# Use of usb_host_vcp requires c++14, -fconcepts
# as we are importing a header using the `auto` symbol
# Additionally -fexceptions was enabled in components/usb_host_vcp/CMakeLists.txt to support exception handling which platformio apparently disables by default?
set_target_properties(${COMPONENT_LIB} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)
target_compile_options(${COMPONENT_LIB} PRIVATE -fconcepts)

9 changes: 7 additions & 2 deletions ESP8266WirelessPrintAsync/CommandQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ int CommandQueue::getFreeSlots() {
// Tries to Add a command to the queue, returns true if possible
bool CommandQueue::push(const String command) {
int next = nextBufferSlot(head);
if (next == tail || command == "")
if (next == tail || command == "") {
log_w("Ignoring command; empty cmd or full buffer");
return false;
}

commandBuffer[head] = command;
head = next;
//log_i("PUSH %s", command.c_str());

return true;
}
Expand All @@ -38,7 +41,8 @@ String CommandQueue::popSend() {

const String command = commandBuffer[sendTail];
sendTail = nextBufferSlot(sendTail);

//log_i("POPSEND %s", command.c_str());

return command;
}

Expand All @@ -49,6 +53,7 @@ String CommandQueue::popAcknowledge() {

const String command = commandBuffer[tail];
tail = nextBufferSlot(tail);
//log_i("ACK %s", command.c_str());

return command;
}
Loading