fix more errors, update comment syntax / spacing

This commit is contained in:
classicrocker883 2025-02-25 14:53:49 -05:00
parent 47de47d1d9
commit e8b7dff62d
7 changed files with 38 additions and 29 deletions

View file

@ -225,7 +225,7 @@ struct Flags<N, false> {
// Flag bits for more than 64 states
template<size_t N>
struct Flags<N, true> {
uint8_t bitmask[(N+7)>>3];
uint8_t bitmask[(N + 7) >> 3];
// Proxy class for handling bit assignment
class BitProxy {
public:

View file

@ -97,7 +97,7 @@
static uint8_t CRC7(const uint8_t *data, uint8_t n) {
uint8_t crc = 0;
while (n > 0) {
crc = pgm_read_byte(&crctab7[ (crc << 1) ^ *data++ ]);
crc = pgm_read_byte(&crctab7[(crc << 1) ^ *data++ ]);
n--;
}
return (crc << 1) | 1;

View file

@ -643,9 +643,9 @@ bool SdBaseFile::open(SdBaseFile * const dirFile, const uint8_t dname[11]
emptyIndex = 0,
reqEntriesNum = useLFN ? getLFNEntriesNum((char*)dlname) + 1 : 1,
lfnNameLength = useLFN ? strlen((char*)dlname) : 0,
lfnName[LONG_FILENAME_LENGTH],
lfnSequenceNumber = 0,
lfnChecksum = 0;
uint8_t lfnName[LONG_FILENAME_LENGTH];
#endif
// Rewind this dir

View file

@ -87,7 +87,8 @@ IF_DISABLED(NO_SD_AUTOSTART, uint8_t CardReader::autofile_index); // = 0
// private:
MediaFile CardReader::root, CardReader::workDir, CardReader::workDirParents[MAX_DIR_DEPTH];
MediaFile CardReader::root, CardReader::workDir;
MediaFile CardReader::workDirParents[MAX_DIR_DEPTH];
uint8_t CardReader::workDirDepth;
int16_t CardReader::nrItems = -1;
@ -123,7 +124,7 @@ int16_t CardReader::nrItems = -1;
#if ENABLED(SDSORT_DYNAMIC_RAM)
uint8_t *CardReader::isDir;
#elif ENABLED(SDSORT_CACHE_NAMES) || DISABLED(SDSORT_USES_STACK)
uint8_t CardReader::isDir[(SDSORT_LIMIT+7)>>3];
uint8_t CardReader::isDir[(SDSORT_LIMIT + 7) >> 3];
#endif
#define IS_DIR(n) TEST(isDir[(n) >> 3], (n) & 0x07)
#endif

View file

@ -271,7 +271,8 @@ private:
//
// Working directory and parents
//
static MediaFile root, workDir, workDirParents[MAX_DIR_DEPTH];
static MediaFile root, workDir;
static MediaFile workDirParents[MAX_DIR_DEPTH];
static uint8_t workDirDepth;
static int16_t nrItems; // Cache the total count

View file

@ -160,7 +160,7 @@ uint8_t UHS_USB_HOST_BASE::doSoftReset(uint8_t parent, uint8_t port, uint8_t add
return rcode;
}
/*
/**
* Pseudo code so you may understand the code flow.
*
* reset; (happens at the lower level)
@ -168,7 +168,7 @@ uint8_t UHS_USB_HOST_BASE::doSoftReset(uint8_t parent, uint8_t port, uint8_t add
* reset;
* If there are no configuration descriptors {
* //
* // Note: I know of no device that does this.
* // NOTE: I know of no device that does this.
* // I suppose there could be one though.
* //
* try to enumerate.
@ -1003,7 +1003,7 @@ uint8_t UHS_USB_HOST_BASE::ctrlReq(uint8_t addr, uint64_t Request, uint16_t nbyt
rcode = ctrlReqRead(pep, &left, &read, nbytes, dataptr);
#if UHS_DEVICE_WINDOWS_USB_SPEC_VIOLATION_DESCRIPTOR_DEVICE
HOST_DEBUG("RESULT: 0x%2.2x 0x%2.2x 0x%2.2x 0x%8.8lx%8.8lx\r\n", rcode, addr, read, (uint32_t)((Request>>32)&0xFFFFFFFFLU), (uint32_t)(Request&0xFFFFFFFFLU));
HOST_DEBUG("RESULT: 0x%2.2x 0x%2.2x 0x%2.2x 0x%8.8lx%8.8lx\r\n", rcode, addr, read, (uint32_t)((Request >> 32) & 0xFFFFFFFFLU), (uint32_t)(Request & 0xFFFFFFFFLU));
// Should only be used for GET_DESCRIPTOR USB_DESCRIPTOR_DEVICE
constexpr uint32_t req_match = ((uint32_t)USB_DESCRIPTOR_DEVICE << 24) |
((uint32_t)USB_REQUEST_GET_DESCRIPTOR << 8);
@ -1167,10 +1167,11 @@ uint8_t UHS_NI UHS_VSI::SetInterface(ENUMERATION_INFO *ei) {
#if 0
/* TO-DO: Move this silliness to a NONE driver.
/**
* TODO: Move this silliness to a NONE driver.
* When we have a generic NONE driver we can:
* o Extract ALL device information to help users with a new device.
* o Use an unknown device from a sketch, kind of like usblib does.
* - Extract ALL device information to help users with a new device.
* - Use an unknown device from a sketch, kind of like usblib does.
* This will aid in making more drivers in a faster way.
*/
uint8_t UHS_USB_HOST_BASE::DefaultAddressing(uint8_t parent, uint8_t port, uint8_t speed) {

View file

@ -18,7 +18,7 @@ def glyph_bits(size_x, size_y, font, glyph_ord):
v = row
rpad = size_x - glyph.bbW
if rpad < 0: rpad = 0
if glyph.bbW > size_x: v = v >> (glyph.bbW - size_x) # some glyphs are actually too wide to fit!
if glyph.bbW > size_x: v = v >> (glyph.bbW - size_x) # some glyphs are actually too wide to fit!
v = v << (glyph_bytes * 8) - size_x + rpad
v = v >> glyph.bbX
bits[y + desc + glyph.bbY] |= v
@ -30,23 +30,28 @@ def glyph_bits(size_x, size_y, font, glyph_ord):
def marlin_font_hzk():
fonts = [
[6,12,'marlin-6x12-3.bdf'],
[8,16,'marlin-8x16.bdf'],
[10,20,'marlin-10x20.bdf'],
[12,24,'marlin-12x24.bdf'],
[14,28,'marlin-14x28.bdf'],
[16,32,'marlin-16x32.bdf'],
[20,40,'marlin-20x40.bdf'],
[24,48,'marlin-24x48.bdf'],
[28,56,'marlin-28x56.bdf'],
[32,64,'marlin-32x64.bdf']
[ 6, 12, 'marlin-6x12-3.bdf'],
[ 8, 16, 'marlin-8x16.bdf'],
[10, 20, 'marlin-10x20.bdf'],
[12, 24, 'marlin-12x24.bdf'],
[14, 28, 'marlin-14x28.bdf'],
[16, 32, 'marlin-16x32.bdf'],
[20, 40, 'marlin-20x40.bdf'],
[24, 48, 'marlin-24x48.bdf'],
[28, 56, 'marlin-28x56.bdf'],
[32, 64, 'marlin-32x64.bdf']
]
with open('marlin_fixed.hzk','wb') as output:
with open('marlin_fixed.hzk', 'wb') as output:
for f in fonts:
with open(f[2], 'rb') as file:
print(f'{f[0]}x{f[1]}')
print(f"{f[0]}x{f[1]}")
font = bdflib.reader.read_bdf(file)
if font is None:
print(f"Failed to read font from {f[2]}")
continue # Skip this font and move to the next one
for glyph in range(128):
bits = glyph_bits(f[0], f[1], font, glyph)
glyph_bytes = math.ceil(f[0]/8)
@ -56,8 +61,9 @@ def marlin_font_hzk():
z = b.to_bytes(glyph_bytes, 'big')
output.write(z)
except OverflowError:
print('Overflow')
print(f'{glyph}')
print(font[glyph])
for b in bits: print(f'{b:0{f[0]}b}')
print("Overflow")
print(f"{glyph}")
if font and glyph in font: print(font[glyph])
else: print(f"Glyph {glyph} not found in the font or font is None")
for b in bits: print(f"{b:0{f[0]}b}")
return