Skip to content

Commit

Permalink
Merge branch 'master' into pclink
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzwald committed Jul 12, 2023
2 parents 9ac36e8 + 61f6ef4 commit 408bc2f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 17 deletions.
1 change: 1 addition & 0 deletions lib/FileSystem/fnFsSPIFFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,5 @@ bool FileSystemSPIFFS::start()

return _started;
}

#endif // FLASH_SPIFFS
2 changes: 2 additions & 0 deletions lib/bus/drivewire/drivewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// https://www.cocopedia.com/wiki/index.php/Main_Page
// https://github.com/qbancoffee/coco_motherboards
// https://archive.worldofdragon.org/index.php?title=Main_Page
// https://sites.google.com/site/dabarnstudio/drivewire-4-3-4e
// https://sites.google.com/site/dabarnstudio/coco-midi-drivewire
//

#ifndef COCO_H
Expand Down
7 changes: 6 additions & 1 deletion lib/bus/iec/iec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ static void IRAM_ATTR cbm_on_attention_isr_handler(void *arg)
{
systemBus *b = (systemBus *)arg;

//b->pull(PIN_IEC_SRQ);

// Go to listener mode and get command
b->release(PIN_IEC_CLK_OUT);
b->pull(PIN_IEC_DATA_OUT);

b->flags |= ATN_PULLED;
//if ( b->bus_state < BUS_ACTIVE )
b->bus_state = BUS_ACTIVE;

//fnSystem.delay_microseconds(4);
//b->release(PIN_IEC_SRQ);
}

/**
Expand Down Expand Up @@ -355,7 +360,7 @@ void systemBus::read_payload()
/* Sometimes ATN isn't released immediately. Wait for ATN to be
released before trying to read payload. Long ATN delay (>1.5ms)
seems to occur more frequently with VIC-20. */
protocol->timeoutWait(PIN_IEC_ATN, RELEASED, FOREVER);
protocol->timeoutWait(PIN_IEC_ATN, RELEASED, FOREVER, false);

while (IEC.status(PIN_IEC_ATN) != PULLED)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/bus/iec/protocol/iecProtocolSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ bool IecProtocolSerial::sendByte(uint8_t data, bool eoi)
// happened. If EOI was sent or received in this last transmission, both talker and listener "letgo." After a suitable pause,
// the Clock and Data lines are RELEASED to false and transmission stops.

if ( eoi )
IEC.release ( PIN_IEC_CLK_OUT );
// if ( eoi )
// IEC.release ( PIN_IEC_CLK_OUT );

timeoutWait( PIN_IEC_DATA_IN, RELEASED, TIMING_Tbb);

Expand Down
1 change: 1 addition & 0 deletions lib/device/iec/disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ uint16_t iecDisk::sendHeader(std::string header, std::string id)
std::string path = p.pathToFile();
std::string archive = "";
std::string image = p.name;
Debug_printv("path[%s] size[%d]", path.c_str(), path.size());

// Send List HEADER
uint8_t space_cnt = 0;
Expand Down
26 changes: 13 additions & 13 deletions lib/device/iec/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void iecFuji::set_boot_config()

if (t.size() < 2)
{
Debug_printf("Invalid # of parameters.\n");
Debug_printf("Invalid # of parameters.\r\n");
response = "invalid # of parameters";
return;
}
Expand Down Expand Up @@ -488,7 +488,7 @@ void iecFuji::set_boot_mode()

if (t.size() < 2)
{
Debug_printf("Invalid # of parameters.\n");
Debug_printf("Invalid # of parameters.\r\n");
// send error
response = "invalid # of parameters";
return;
Expand Down Expand Up @@ -517,7 +517,7 @@ char *_generate_appkey_filename(appkey *info)
*/
void iecFuji::open_app_key()
{
Debug_print("Fuji cmd: OPEN APPKEY\n");
Debug_print("Fuji cmd: OPEN APPKEY\r\n");

// The data expected for this command
if (payload[0] == FUJICMD_OPEN_APPKEY)
Expand All @@ -529,7 +529,7 @@ void iecFuji::open_app_key()

if (t.size() < 5)
{
Debug_printf("Incorrect number of parameters.\n");
Debug_printf("Incorrect number of parameters.\r\n");
response = "invalid # of parameters";
// send error.
}
Expand Down Expand Up @@ -563,7 +563,7 @@ void iecFuji::open_app_key()
return;
}

Debug_printf("App key creator = 0x%04hx, app = 0x%02hhx, key = 0x%02hhx, mode = %hhu, filename = \"%s\"\n",
Debug_printf("App key creator = 0x%04hx, app = 0x%02hhx, key = 0x%02hhx, mode = %hhu, filename = \"%s\"\r\n",
_current_appkey.creator, _current_appkey.app, _current_appkey.key, _current_appkey.mode,
_generate_appkey_filename(&_current_appkey));

Expand All @@ -577,7 +577,7 @@ void iecFuji::open_app_key()
*/
void iecFuji::close_app_key()
{
Debug_print("Fuji cmd: CLOSE APPKEY\n");
Debug_print("Fuji cmd: CLOSE APPKEY\r\n");
_current_appkey.creator = 0;
_current_appkey.mode = APPKEYMODE_INVALID;
response = "ok";
Expand Down Expand Up @@ -613,7 +613,7 @@ void iecFuji::write_app_key()
}
}

Debug_printf("Fuji cmd: WRITE APPKEY (keylen = %hu)\n", keylen);
Debug_printf("Fuji cmd: WRITE APPKEY (keylen = %hu)\r\n", keylen);

// Make sure we have valid app key information
if (_current_appkey.creator == 0 || _current_appkey.mode != APPKEYMODE_WRITE)
Expand All @@ -639,15 +639,15 @@ void iecFuji::write_app_key()
_current_appkey.creator = 0;
_current_appkey.mode = APPKEYMODE_INVALID;

Debug_printf("Writing appkey to \"%s\"\n", filename);
Debug_printf("Writing appkey to \"%s\"\r\n", filename);

// Make sure we have a "/FujiNet" directory, since that's where we're putting these files
fnSDFAT.create_path("/FujiNet");

FILE *fOut = fnSDFAT.file_open(filename, "w");
if (fOut == nullptr)
{
Debug_printf("Failed to open/create output file: errno=%d\n", errno);
Debug_printf("Failed to open/create output file: errno=%d\r\n", errno);
// Send error
char e[8];
itoa(errno, e, 10);
Expand Down Expand Up @@ -697,13 +697,13 @@ void iecFuji::read_app_key()

char *filename = _generate_appkey_filename(&_current_appkey);

Debug_printf("Reading appkey from \"%s\"\n", filename);
Debug_printf("Reading appkey from \"%s\"\r\n", filename);

FILE *fIn = fnSDFAT.file_open(filename, "r");
if (fIn == nullptr)
{
char e[128];
sprintf(e, "failed to open input file: errno=%d\n", errno);
sprintf(e, "Failed to open input file: errno=%d\r\n", errno);
// Send error
response = std::string(e);
return;
Expand All @@ -719,7 +719,7 @@ void iecFuji::read_app_key()
size_t count = fread(_r.value, 1, sizeof(_r.value), fIn);

fclose(fIn);
Debug_printf("Read %d bytes from input file\n", count);
Debug_printf("Read %d bytes from input file\r\n", count);

_r.size = count;

Expand Down Expand Up @@ -1060,7 +1060,7 @@ void iecFuji::close_directory()
// Get network adapter configuration
void iecFuji::get_adapter_config()
{
Debug_printf("get_adapter_config()\n");
Debug_printf("get_adapter_config()\r\n");

memset(&cfg, 0, sizeof(cfg));

Expand Down
2 changes: 1 addition & 1 deletion lib/device/sio/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void sioFuji::sio_net_set_ssid()
fnWiFi.connect(cfg.ssid, cfg.password);

// Only save these if we're asked to, otherwise assume it was a test for connectivity
if (save && fnWiFi.connected() )
if (save)
{
// 1. if this is a new SSID and not in the old stored, we should push the current one to the top of the stored configs, and everything else down.
// 2. If this was already in the stored configs, push the stored one to the top, remove the new one from stored so it becomes current only.
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define STRING_UTILS_H

#include <string>
#include <string_view>

#include <vector>

void copyString(const std::string& input, char *dst, size_t dst_size);
Expand Down

0 comments on commit 408bc2f

Please sign in to comment.