Skip to content
Merged
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
1 change: 1 addition & 0 deletions include/fujiCommandID.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ enum fujiCommandID_t {
FUJICMD_PERCOM_READ = 0x4E, // N
FUJICMD_UNLISTEN = 0x4D, // M
FUJICMD_LISTEN = 0x4C, // L
FUJICMD_CPM_INIT = 0x47, // G
FUJICMD_GET_ERROR = 0x45, // E
FUJICMD_SET_DESTINATION = 0x44, // D
FUJICMD_SET_DUMP = 0x44, // D
Expand Down
1 change: 1 addition & 0 deletions lib/bus/mac/mac_ll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void IRAM_ATTR encode_rmt_bitstream(const void* src, rmt_item32_t* dest, size_t
*item_num = wanted_num;
}

#ifdef NOT_IWM_LL_SUBCLASSS
/*
* Initialize the RMT Tx channel
*/
Expand Down
17 changes: 4 additions & 13 deletions lib/bus/rs232/FujiBusPacket.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "FujiBusPacket.h"

#include "../../include/debug.h"
#include "utils.h"

typedef struct {
uint8_t device; /* Destination Device */
Expand All @@ -17,14 +18,6 @@ typedef struct {
static uint8_t fieldSizeTable[] = {0, 1, 1, 1, 1, 2, 2, 4};
static uint8_t numFieldsTable[] = {0, 1, 2, 3, 4, 1, 2, 1};

FujiBusPacket::FujiBusPacket(const std::string &slipEncoded)
{
if (!parse(slipEncoded))
throw std::invalid_argument("Invalid FujiBusPacket data");

return;
}

std::string FujiBusPacket::decodeSLIP(const std::string &input)
{
unsigned int idx;
Expand Down Expand Up @@ -203,10 +196,8 @@ std::string FujiBusPacket::serialize()

std::unique_ptr<FujiBusPacket> FujiBusPacket::fromSerialized(const std::string &input)
{
try {
return std::make_unique<FujiBusPacket>(input);
}
catch (const std::invalid_argument&) {
auto packet = std::make_unique<FujiBusPacket>();
if (!packet->parse(input))
return nullptr;
}
return packet;
}
2 changes: 1 addition & 1 deletion lib/bus/rs232/FujiBusPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class FujiBusPacket
uint8_t calcChecksum(const std::string &buf);

public:
FujiBusPacket(const std::string &slipEncoded);
FujiBusPacket() = default;
FujiBusPacket(fujiDeviceID_t dev, fujiCommandID_t cmd, const std::string &dbuf) :
_device(dev), _command(cmd), _data(dbuf) {}

Expand Down
2 changes: 1 addition & 1 deletion lib/bus/rs232/rs232.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ void systemBus::setUltraHigh(bool _enable, int _ultraHighBaud)
void systemBus::sendReplyPacket(fujiDeviceID_t source, bool ack, void *data, size_t length)
{
FujiBusPacket packet(source, ack ? FUJICMD_ACK : FUJICMD_NAK,
ack ? std::string(static_cast<const char*>(data), length) : nullptr);
ack ? std::string(static_cast<const char*>(data), length) : "");
std::string encoded = packet.serialize();
_port->write(encoded.data(), encoded.size());
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/console/Commands/VFSCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ int mount(int argc, char **argv)
int did = atoi(argv[1]);
fprintf(stdout, "Mounted %d -> %s\r\n", did, argv[2]);

theFuji->mount_all();
theFuji->fujicmd_mount_all_success();

return EXIT_SUCCESS;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/device/fujiDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
#include "compat_string.h"

#include "fuji_endian.h"
#ifndef ESP_PLATFORM // why ESP does not like it? it throws a linker error undefined reference to 'basename'
#include <libgen.h>
#endif /* ESP_PLATFORM */

#ifdef UNUSED
#define ADDITIONAL_DETAILS_BYTES 10
Expand Down
43 changes: 11 additions & 32 deletions lib/device/rs232/apetime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

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

char * ape_timezone = NULL;

void rs232ApeTime::_rs232_get_time(bool use_timezone)
{
char old_tz[64];
Expand All @@ -24,16 +22,16 @@ void rs232ApeTime::_rs232_get_time(bool use_timezone)

time_t tt = time(nullptr);

if (ape_timezone != NULL && use_timezone) {
if (ape_timezone.size() && use_timezone) {
Debug_printf("Using time zone %s\n", ape_timezone);
strncpy(old_tz, getenv("TZ"), sizeof(old_tz));
setenv("TZ", ape_timezone, 1);
setenv("TZ", ape_timezone.c_str(), 1);
tzset();
}

struct tm * now = localtime(&tt);

if (ape_timezone != NULL && use_timezone) {
if (ape_timezone.size() && use_timezone) {
setenv("TZ", old_tz, 1);
tzset();
}
Expand All @@ -53,35 +51,16 @@ void rs232ApeTime::_rs232_get_time(bool use_timezone)
bus_to_computer(rs232_reply, sizeof(rs232_reply), false);
}

void rs232ApeTime::_rs232_set_tz()
void rs232ApeTime::_rs232_set_tz(std::string newTZ)
{
int bufsz;

Debug_println("APETIME set TZ request");

if (ape_timezone != NULL) {
free(ape_timezone);
if (newTZ.size())
{
ape_timezone = newTZ;
Debug_printf("TZ set to <%s>\n", ape_timezone.c_str());
}

#ifdef OBSOLETE
bufsz = rs232_get_aux16_lo();
#endif /* OBSOLETE */
if (bufsz > 0) {
ape_timezone = (char *) malloc((bufsz + 1) * sizeof(char));

uint8_t ck = bus_to_peripheral((uint8_t *) ape_timezone, bufsz);
if (rs232_checksum((uint8_t *) ape_timezone, bufsz) != ck) {
rs232_error();
} else {
ape_timezone[bufsz] = '\0';

rs232_complete();

Debug_printf("TZ set to <%s>\n", ape_timezone);
}
} else {
else
Debug_printf("TZ unset\n");
}
return;
}

void rs232ApeTime::rs232_process(FujiBusPacket &packet)
Expand All @@ -94,7 +73,7 @@ void rs232ApeTime::rs232_process(FujiBusPacket &packet)
break;
case FUJICMD_SETTZ:
rs232_ack();
_rs232_set_tz();
_rs232_set_tz(packet.data().value_or(""));
break;
case FUJICMD_GETTZTIME:
rs232_ack();
Expand Down
4 changes: 3 additions & 1 deletion lib/device/rs232/apetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
class rs232ApeTime : public virtualDevice
{
private:
std::string ape_timezone;

void _rs232_get_time(bool use_timezone);
void _rs232_set_tz();
void _rs232_set_tz(std::string newTZ);

public:
void rs232_process(FujiBusPacket &packet) override;
Expand Down
2 changes: 1 addition & 1 deletion lib/device/rs232/rs232cpm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void rs232CPM::rs232_process(FujiBusPacket &packet)
{
switch (packet.command())
{
case 'G':
case FUJICMD_CPM_INIT:
rs232_ack();
fnSystem.delay(10);
rs232_complete();
Expand Down
2 changes: 1 addition & 1 deletion lib/http/httpService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ esp_err_t fnHttpService::get_handler_mount(httpd_req_t *req)
{
uint8_t mode = qp.query_parsed["mode"] == "2" ?
DISK_ACCESS_MODE_WRITE : DISK_ACCESS_MODE_READ;
if (!theFuji->fujicore_disk_image_mount_success(ds, mode))
if (!theFuji->fujicore_mount_disk_image_success(ds, mode))
{
fnHTTPD.addToErrMsg("<li>Could not mount disk: " + qp.query_parsed["filename"] + "</li>");
}
Expand Down
2 changes: 2 additions & 0 deletions lib/network-protocol/TCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ netProtoErr_t NetworkProtocolTCP::special_00(fujiCommandID_t cmd, uint8_t httpCh
Debug_printf("CLOSING CLIENT CONNECTION!!!\n");
return special_close_client_connection();
break;
default:
break;
}
return NETPROTO_ERR_UNSPECIFIED; // error
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/endianness.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef USE_ENDIAN_H
#warning Use endian.h
//#warning Use endian.h
// Retruns a uint16 value given two bytes in high-low order
#define UINT16_FROM_HILOBYTES(high, low) ((uint16_t)high << 8 | low)

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ std::string util_entry(std::string crunched, size_t fileSize, bool is_dir, bool
else
{
snprintf(e, sizeof(e),
"%-8s %-3s %10lu %2u-%02u-%02u %2u:%02u%c",
"%-8s %-3s %10zu %2u-%02u-%02u %2u:%02u%c",
basename.c_str(),
ext.c_str(),
fileSize,
Expand Down
Loading