Clean up comments, USB flash, NULLs

This commit is contained in:
Scott Lahteine
2020-10-24 17:13:10 -05:00
parent 00fbe50bbe
commit ec23e37a4a
45 changed files with 231 additions and 238 deletions

View File

@ -40,7 +40,7 @@ size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_start() {
const char eeprom_erase_value = 0xFF;
FILE * eeprom_file = fopen(filename, "rb");
if (eeprom_file == nullptr) return false;
if (!eeprom_file) return false;
fseek(eeprom_file, 0L, SEEK_END);
std::size_t file_size = ftell(eeprom_file);
@ -59,7 +59,7 @@ bool PersistentStore::access_start() {
bool PersistentStore::access_finish() {
FILE * eeprom_file = fopen(filename, "wb");
if (eeprom_file == nullptr) return false;
if (!eeprom_file) return false;
fwrite(buffer, sizeof(uint8_t), sizeof(buffer), eeprom_file);
fclose(eeprom_file);
return true;

View File

@ -86,10 +86,10 @@ public:
GpioEvent::Type evt_type = value > 1 ? GpioEvent::SET_VALUE : value > pin_map[pin].value ? GpioEvent::RISE : value < pin_map[pin].value ? GpioEvent::FALL : GpioEvent::NOP;
pin_map[pin].value = value;
GpioEvent evt(Clock::nanos(), pin, evt_type);
if (pin_map[pin].cb != nullptr) {
if (pin_map[pin].cb) {
pin_map[pin].cb->interrupt(evt);
}
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
if (Gpio::logger) Gpio::logger->log(evt);
}
static uint16_t get(pin_type pin) {
@ -105,8 +105,8 @@ public:
if (!valid_pin(pin)) return;
pin_map[pin].mode = value;
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETM);
if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt);
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
if (pin_map[pin].cb) pin_map[pin].cb->interrupt(evt);
if (Gpio::logger) Gpio::logger->log(evt);
}
static uint8_t getMode(pin_type pin) {
@ -118,8 +118,8 @@ public:
if (!valid_pin(pin)) return;
pin_map[pin].dir = value;
GpioEvent evt(Clock::nanos(), pin, GpioEvent::Type::SETD);
if (pin_map[pin].cb != nullptr) pin_map[pin].cb->interrupt(evt);
if (Gpio::logger != nullptr) Gpio::logger->log(evt);
if (pin_map[pin].cb) pin_map[pin].cb->interrupt(evt);
if (Gpio::logger) Gpio::logger->log(evt);
}
static uint8_t getDir(pin_type pin) {