Skip to content

Commit

Permalink
Merge branch 'uart-workaround-remove' into wait-head-position-equals-…
Browse files Browse the repository at this point in the history
…experiment
  • Loading branch information
tschak909 committed Jul 28, 2023
2 parents 71e27e5 + 7b80cb0 commit f7cbad5
Show file tree
Hide file tree
Showing 77 changed files with 431 additions and 441 deletions.
18 changes: 18 additions & 0 deletions data/webui/config/lolin-d32-dw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
paths:
font_path: /file?
css_path: /file?css
js_path: /file?js
components:
network: true
hardware: true
hosts_list: true
mount_list: true
printer_settings: true
modem_settings: false
hsio_settings: false
timezone: true
udp_stream: true
program_recorder: false
disk_swap: true
boot_settings: true
apetime: false
Binary file modified data/webui/device_specific/BUILD_ATARI/autorun.atr
Binary file not shown.
Binary file added data/webui/device_specific/BUILD_COCO/dw3doscc1.bin
Binary file not shown.
Binary file not shown.
Binary file added data/webui/device_specific/BUILD_COCO/dw3doscc2.bin
Binary file not shown.
Binary file not shown.
Binary file added data/webui/device_specific/BUILD_COCO/dw3doscc3.bin
Binary file not shown.
Binary file not shown.
Binary file added data/webui/device_specific/BUILD_COCO/hdbcc1.wav
Binary file not shown.
Binary file added data/webui/device_specific/BUILD_COCO/hdbcc2.wav
Binary file not shown.
Binary file added data/webui/device_specific/BUILD_COCO/hdbcc3.wav
Binary file not shown.
12 changes: 6 additions & 6 deletions lib/EdUrlParser/EdUrlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ EdUrlParser::~EdUrlParser() {



string EdUrlParser::urlDecode(string str) {
string EdUrlParser::urlDecode(const string &str) {
int _url_errorno = 0;
size_t pos = 0, per = 0;
size_t len = str.size();
Expand Down Expand Up @@ -72,7 +72,7 @@ string EdUrlParser::urlDecode(string str) {

}

string EdUrlParser::urlEncode(string s) {
string EdUrlParser::urlEncode(const string &s) {
const char *ptr = s.c_str();
string enc;
char c;
Expand Down Expand Up @@ -189,7 +189,7 @@ void EdUrlParser::parse() {
}
__END_IGNORE_UNUSEDVARS

EdUrlParser* EdUrlParser::parseUrl(string urlstr) {
EdUrlParser* EdUrlParser::parseUrl(const string &urlstr) {
EdUrlParser *url = new EdUrlParser;
url->mRawUrl = urlstr;
url->parse();
Expand All @@ -216,15 +216,15 @@ bool EdUrlParser::toChar(const char* hex, char *result) {
return true;
}

size_t EdUrlParser::parseKeyValueMap(unordered_map<string, string> *kvmap, string rawstr, bool strict) {
size_t EdUrlParser::parseKeyValueMap(unordered_map<string, string> *kvmap, const string &rawstr, bool strict) {
return parseKeyValue(rawstr, __kv_callback_map, kvmap, strict);
}

size_t EdUrlParser::parseKeyValueList(vector< query_kv_t > *kvvec, string rawstr, bool strict) {
size_t EdUrlParser::parseKeyValueList(vector< query_kv_t > *kvvec, const string &rawstr, bool strict) {
return parseKeyValue(rawstr, __kv_callback_vec, kvvec, strict);
}

size_t EdUrlParser::parseKeyValue(string rawstr, __kv_callback kvcb, void* obj, bool strict) {
size_t EdUrlParser::parseKeyValue(const string &rawstr, __kv_callback kvcb, void* obj, bool strict) {

int _url_errorno = 0;
const char *str = rawstr.c_str();
Expand Down
12 changes: 6 additions & 6 deletions lib/EdUrlParser/EdUrlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ class EdUrlParser {
EdUrlParser();
public:
virtual ~EdUrlParser();
static EdUrlParser* parseUrl(string urlstr);
static EdUrlParser* parseUrl(const string &urlstr);
static int parsePath(vector<string> *pdirlist, string pathstr);
static string urlDecode(string str);
static string urlDecode(const string &str);
static bool toChar(const char* hex, char *result);
static string urlEncode(string s);
static string urlEncode(const string &s);
static void toHex(char *desthex, char c);
static size_t parseKeyValueMap(unordered_map<string, string> *kvmap, string str, bool strict=true);
static size_t parseKeyValueList(vector< query_kv_t > *kvmap, string rawstr, bool strict=true);
static size_t parseKeyValue(string rawstr, __kv_callback kvcb, void* obj, bool strict);
static size_t parseKeyValueMap(unordered_map<string, string> *kvmap, const string &str, bool strict=true);
static size_t parseKeyValueList(vector< query_kv_t > *kvmap, const string &rawstr, bool strict=true);
static size_t parseKeyValue(const string &rawstr, __kv_callback kvcb, void* obj, bool strict);
bool isValidUrl();

private:
Expand Down
4 changes: 2 additions & 2 deletions lib/TNFSlib/tnfslibMountInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ tnfsMountInfo::tnfsMountInfo(const char *host_name, uint16_t host_port)
}

tnfsMountInfo::tnfsMountInfo(in_addr_t host_address, uint16_t host_port)
: host_ip(host_address)
, port(host_port)
{
host_ip = host_address;
port = host_port;
}

// Make sure to clean up any memory we allocated
Expand Down
59 changes: 59 additions & 0 deletions lib/bus/drivewire/drivewire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,46 @@
#include "led.h"
#include "utils.h"

#include <freertos/queue.h>
#include <freertos/task.h>

#include "../../include/pinmap.h"
#include "../../include/debug.h"


static QueueHandle_t drivewire_evt_queue = NULL;

static void IRAM_ATTR drivewire_isr_handler(void* arg)
{
// Generic default interrupt handler
uint32_t gpio_num = (uint32_t) arg;
xQueueSendFromISR(drivewire_evt_queue, &gpio_num, NULL);
}

static void drivewire_intr_task(void* arg)
{
uint32_t gpio_num;

while ( true )
{
if(xQueueReceive(drivewire_evt_queue, &gpio_num, portMAX_DELAY))
{
if ( gpio_num == PIN_CASS_MOTOR && gpio_get_level( (gpio_num_t)gpio_num) )
{
Debug_printv( "Cassette motor enalbed! Send boot loader!" );

// auto cassette = theFuji.cassette();
// FILE *fp = fopen("/dw3doscc1.bin", "r");
// fseek(fp, 0L, SEEK_END);
// auto sz = ftell(fp);
// rewind(fp);
// cassette->mount_cassette_file(fp, sz);
// cassette->drivewire_enable_cassette();
}
}
}
}

// Helper functions outside the class defintions

systemBus virtualDevice::get_bus() { return DRIVEWIRE; }
Expand Down Expand Up @@ -44,6 +84,25 @@ void systemBus::service()
// Setup DRIVEWIRE bus
void systemBus::setup()
{
// Create a queue to handle parallel event from ISR
drivewire_evt_queue = xQueueCreate(10, sizeof(uint32_t));

// Start task
//xTaskCreate(drivewire_intr_task, "drivewire_intr_task", 2048, NULL, 10, NULL);
xTaskCreatePinnedToCore(drivewire_intr_task, "drivewire_intr_task", 4096, NULL, 10, NULL, 0);

// Setup interrupt for cassette motor pin
gpio_config_t io_conf = {
.pin_bit_mask = ( 1ULL << PIN_CASS_MOTOR ), // bit mask of the pins that you want to set
.mode = GPIO_MODE_INPUT, // set as input mode
.pull_up_en = GPIO_PULLUP_DISABLE, // disable pull-up mode
.pull_down_en = GPIO_PULLDOWN_ENABLE, // enable pull-down mode
.intr_type = GPIO_INTR_POSEDGE // interrupt on positive edge
};

//configure GPIO with the given settings
gpio_config(&io_conf);
gpio_isr_handler_add((gpio_num_t)PIN_CASS_MOTOR, drivewire_isr_handler, (void*) PIN_CASS_MOTOR);
}

// Add device to DRIVEWIRE bus
Expand Down
4 changes: 4 additions & 0 deletions lib/bus/drivewire/drivewire.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//
// http://www.boisypitre.com/retrocomputing/drivewire/
// https://www.frontiernet.net/~mmarlette/Cloud-9/Hardware/DriveWire3.html
// https://www.cocopedia.com/wiki/index.php/DRIVEWIRE.ZIP
//
// https://sourceforge.net/projects/drivewireserver/
// https://github.com/qbancoffee/drivewire4
// https://github.com/n6il/toolshed/tree/master/hdbdos
Expand Down
4 changes: 4 additions & 0 deletions lib/bus/sio/sio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ void systemBus::_sio_process_cmd()
if (it != _daisyChain.end())
{
_activeDev = it->second;
// heap_trace_start(HEAP_TRACE_LEAKS);
it->second->sio_process(tempFrame.commanddata, tempFrame.checksum);
// heap_trace_stop();
// Debug_printv("heap trace follows.");
// heap_trace_dump();
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/config/fnConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ class fnConfig
std::string get_wifi_stored_passphrase(int index) { return _wifi_stored[index].passphrase; }
bool get_wifi_stored_enabled(int index) { return _wifi_stored[index].enabled; }

void store_wifi_stored_ssid(int index, std::string ssid); // { _wifi_stored[index].ssid = ssid; }
void store_wifi_stored_passphrase(int index, std::string passphrase);
void store_wifi_stored_ssid(int index, const std::string &ssid); // { _wifi_stored[index].ssid = ssid; }
void store_wifi_stored_passphrase(int index, const std::string &passphrase);
void store_wifi_stored_enabled(int index, bool enabled); // { _wifi_stored[index].enabled = enabled; }

// BLUETOOTH
void store_bt_status(bool status);
bool get_bt_status() { return _bt.bt_status; };
void store_bt_baud(int baud);
int get_bt_baud() { return _bt.bt_baud; };
void store_bt_devname(std::string devname);
void store_bt_devname(const std::string &devname);
std::string get_bt_devname() { return _bt.bt_devname; };

// HOSTS
Expand Down Expand Up @@ -163,7 +163,7 @@ class fnConfig

// CPM
std::string get_ccp_filename(){ return _cpm.ccp; };
void store_ccp_filename(std::string filename);
void store_ccp_filename(const std::string &filename);

// ENABLE/DISABLE DEVICE SLOTS
bool get_device_slot_enable_1();
Expand Down
2 changes: 1 addition & 1 deletion lib/config/fnc_bt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void fnConfig::store_bt_baud(int baud)
_dirty = true;
}

void fnConfig::store_bt_devname(std::string devname)
void fnConfig::store_bt_devname(const std::string &devname)
{
_bt.bt_devname = devname;
_dirty = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/config/fnc_cpm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <cstring>

// Saves CPM Command Control Processor Filename
void fnConfig::store_ccp_filename(std::string filename)
void fnConfig::store_ccp_filename(const std::string &filename)
{
if (_cpm.ccp == filename)
return;
Expand Down
4 changes: 2 additions & 2 deletions lib/config/fnc_wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ void fnConfig::_read_section_wifi_stored(std::stringstream &ss, int index)
}
}

void fnConfig::store_wifi_stored_ssid(int index, std::string ssid)
void fnConfig::store_wifi_stored_ssid(int index, const std::string &ssid)
{
_wifi_stored[index].ssid = ssid;
_dirty = true;
}

void fnConfig::store_wifi_stored_passphrase(int index, std::string passphrase)
void fnConfig::store_wifi_stored_passphrase(int index, const std::string &passphrase)
{
// TODO: check if encryption is an issue here. Should be coming from previous "current" config, which will already be encrypted if enabled.
_wifi_stored[index].passphrase = passphrase;
Expand Down
Loading

0 comments on commit f7cbad5

Please sign in to comment.