Merge branch 'master' into new_freq_in
This commit is contained in:
commit
9d20380bd4
4
Makefile
4
Makefile
@ -194,10 +194,10 @@ pseudoxml:
|
||||
all-source:
|
||||
|
||||
locale/circuitpython.pot: all-source
|
||||
find . -iname "*.c" | xargs xgettext -L C --keyword=translate -F -o circuitpython.pot -p locale
|
||||
find . -iname "*.c" | xargs xgettext -L C -s --no-location --keyword=translate -o circuitpython.pot -p locale
|
||||
|
||||
translate: locale/circuitpython.pot
|
||||
for po in $(shell ls locale/*.po); do msgmerge -U -F $$po locale/circuitpython.pot; done
|
||||
for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --no-location locale/circuitpython.pot; done
|
||||
|
||||
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
|
||||
$(PYTHON) tools/check_translations.py $^
|
||||
|
4694
locale/ID.po
4694
locale/ID.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4665
locale/de_DE.po
4665
locale/de_DE.po
File diff suppressed because it is too large
Load Diff
4039
locale/en_US.po
4039
locale/en_US.po
File diff suppressed because it is too large
Load Diff
4818
locale/es.po
4818
locale/es.po
File diff suppressed because it is too large
Load Diff
4440
locale/fil.po
4440
locale/fil.po
File diff suppressed because it is too large
Load Diff
4801
locale/fr.po
4801
locale/fr.po
File diff suppressed because it is too large
Load Diff
4644
locale/it_IT.po
4644
locale/it_IT.po
File diff suppressed because it is too large
Load Diff
4488
locale/pt_BR.po
4488
locale/pt_BR.po
File diff suppressed because it is too large
Load Diff
@ -16,3 +16,6 @@ CHIP_FAMILY = samd21
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
|
||||
# To keep the build small
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
|
@ -10,14 +10,15 @@
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_AUDIO_OUT), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, // analog out/in
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PA27) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA07) },
|
||||
|
||||
// STEMMA connectors
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB02) }, // SDA
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB03) }, // SCL
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, // D3
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA04) }, // D3
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, // D4
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA04) }, // A1/D3
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA05) }, // D4
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, // A4/D4
|
||||
|
||||
// Indicator LED
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA27) },
|
||||
@ -49,10 +50,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_TOUCH_XR), MP_ROM_PTR(&pin_PB08) },
|
||||
|
||||
// ESP control
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB16) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_PB16) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_PB17) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_PA15) },
|
||||
|
||||
// UART
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB12) },
|
||||
|
@ -61,6 +61,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_ESP_BOOT_MODE), MP_ROM_PTR(&pin_P0_16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ESP_WIFI_EN), MP_ROM_PTR(&pin_P0_24) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ESP_HOST_WK), MP_ROM_PTR(&pin_P0_07) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
|
||||
|
||||
};
|
||||
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
||||
|
@ -59,6 +59,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_UBLOX_POWER_MONITOR), MP_ROM_PTR(&pin_P0_02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UBLOX_RESET), MP_ROM_PTR(&pin_P0_12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UBLOX_POWER_ON), MP_ROM_PTR(&pin_P0_16) },
|
||||
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
||||
|
@ -52,6 +52,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ANTENNA_EXTERNAL), MP_ROM_PTR(&pin_P0_25) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ANTENNA_PCB), MP_ROM_PTR(&pin_P0_24) },
|
||||
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
||||
|
@ -48,6 +48,9 @@ enum {
|
||||
DescriptorUuidTimeTriggerSetting = 0x290E,
|
||||
};
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Descriptor` -- BLE descriptor
|
||||
|
@ -43,6 +43,9 @@
|
||||
#include "shared-module/bleio/Device.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Device` -- BLE device
|
||||
|
@ -37,6 +37,9 @@
|
||||
#include "shared-module/bleio/AdvertisementData.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`ScanEntry` -- BLE scan response entry
|
||||
|
@ -32,6 +32,9 @@
|
||||
#define DEFAULT_INTERVAL 100
|
||||
#define DEFAULT_WINDOW 100
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Scanner` -- scan for nearby BLE devices
|
||||
|
@ -60,11 +60,12 @@
|
||||
//| Broadcaster
|
||||
//| Characteristic
|
||||
//| CharacteristicBuffer
|
||||
//| Descriptor
|
||||
//| Device
|
||||
// Work-in-progress classes are omitted, and marked as :orphan: in their files.
|
||||
// Descriptor
|
||||
// Device
|
||||
//| Peripheral
|
||||
//| ScanEntry
|
||||
//| Scanner
|
||||
// ScanEntry
|
||||
// Scanner
|
||||
//| Service
|
||||
//| UUID
|
||||
//|
|
||||
@ -82,10 +83,11 @@ STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_Broadcaster), MP_ROM_PTR(&bleio_broadcaster_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Characteristic), MP_ROM_PTR(&bleio_characteristic_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CharacteristicBuffer), MP_ROM_PTR(&bleio_characteristic_buffer_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Descriptor), MP_ROM_PTR(&bleio_descriptor_type) },
|
||||
// { MP_ROM_QSTR(MP_QSTR_Descriptor), MP_ROM_PTR(&bleio_descriptor_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Peripheral), MP_ROM_PTR(&bleio_peripheral_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ScanEntry), MP_ROM_PTR(&bleio_scanentry_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Scanner), MP_ROM_PTR(&bleio_scanner_type) },
|
||||
// Hide work-in-progress.
|
||||
// { MP_ROM_QSTR(MP_QSTR_ScanEntry), MP_ROM_PTR(&bleio_scanentry_type) },
|
||||
// { MP_ROM_QSTR(MP_QSTR_Scanner), MP_ROM_PTR(&bleio_scanner_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Service), MP_ROM_PTR(&bleio_service_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UUID), MP_ROM_PTR(&bleio_uuid_type) },
|
||||
|
||||
|
@ -38,13 +38,13 @@ static uint32_t read_word(uint16_t* bmp_header, uint16_t index) {
|
||||
void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, pyb_file_obj_t* file) {
|
||||
// Load the wave
|
||||
self->file = file;
|
||||
uint16_t bmp_header[24];
|
||||
uint16_t bmp_header[69];
|
||||
f_rewind(&self->file->fp);
|
||||
UINT bytes_read;
|
||||
if (f_read(&self->file->fp, bmp_header, 48, &bytes_read) != FR_OK) {
|
||||
if (f_read(&self->file->fp, bmp_header, 138, &bytes_read) != FR_OK) {
|
||||
mp_raise_OSError(MP_EIO);
|
||||
}
|
||||
if (bytes_read != 48 ||
|
||||
if (bytes_read != 138 ||
|
||||
memcmp(bmp_header, "BM", 2) != 0) {
|
||||
mp_raise_ValueError(translate("Invalid BMP file"));
|
||||
}
|
||||
@ -53,15 +53,35 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self,
|
||||
self->data_offset = read_word(bmp_header, 5);
|
||||
|
||||
uint32_t header_size = read_word(bmp_header, 7);
|
||||
uint16_t bits_per_pixel = bmp_header[14];
|
||||
uint32_t compression = read_word(bmp_header, 15);
|
||||
if (!(header_size == 12 || header_size == 40 || header_size == 108 || header_size == 124) ||
|
||||
uint32_t number_of_colors = read_word(bmp_header, 23);
|
||||
self->bitfield_compressed = (compression == 3);
|
||||
|
||||
self->grayscale = ((bits_per_pixel == 8) && (number_of_colors == 256));
|
||||
if (bits_per_pixel == 16){
|
||||
if (((header_size == 124) || (header_size == 56)) && (self->bitfield_compressed)) {
|
||||
self->r_bitmask = read_word(bmp_header, 27);
|
||||
self->g_bitmask = read_word(bmp_header, 29);
|
||||
self->b_bitmask = read_word(bmp_header, 31);
|
||||
|
||||
if (!((self->r_bitmask == 0xf800) && (self->g_bitmask == 0x07e0) && (self->b_bitmask == 0x001f))){
|
||||
mp_raise_ValueError_varg(translate("Only 16bpp RGB 565 supported for bitfield compressed BMPs; R:%x G:%x B:%x"),
|
||||
self->r_bitmask, self->g_bitmask, self->b_bitmask);
|
||||
}
|
||||
} else if (header_size == 40){ // no bitmasks means 5:5:5
|
||||
self->r_bitmask = 0x7c00;
|
||||
self->g_bitmask = 0x3e0;
|
||||
self->b_bitmask = 0x1f;
|
||||
}
|
||||
|
||||
} else if (!(header_size == 12 || header_size == 40 || header_size == 108 || header_size == 124) ||
|
||||
!(compression == 0)) {
|
||||
mp_raise_ValueError_varg(translate("Only Windows format, uncompressed BMP supported %d"), header_size);
|
||||
}
|
||||
// TODO(tannewt): Support bitfield compressed colors since RGB565 can be produced by the GIMP.
|
||||
uint16_t bits_per_pixel = bmp_header[14];
|
||||
if (bits_per_pixel < 24) {
|
||||
mp_raise_ValueError_varg(translate("Only true color (24 bpp or higher) BMP supported %x"), bits_per_pixel);
|
||||
|
||||
if (bits_per_pixel < 16 && !(self->grayscale)) {
|
||||
mp_raise_ValueError_varg(translate("Only true color (24 bpp or higher), 16bpp 565 and 555, and 8bpp grayscale BMP supported %d"), bits_per_pixel);
|
||||
}
|
||||
self->bytes_per_pixel = bits_per_pixel / 8;
|
||||
self->width = read_word(bmp_header, 9);
|
||||
@ -87,7 +107,32 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *s
|
||||
uint32_t pixel = 0;
|
||||
uint32_t result = f_read(&self->file->fp, &pixel, self->bytes_per_pixel, &bytes_read);
|
||||
if (result == FR_OK) {
|
||||
return pixel;
|
||||
uint32_t tmp = 0;
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
if (self->grayscale){
|
||||
red = pixel;
|
||||
green = pixel;
|
||||
blue = pixel;
|
||||
tmp = (red << 16 | green << 8 | blue);
|
||||
return tmp;
|
||||
} else if (self->bytes_per_pixel == 2) {
|
||||
if (self->bitfield_compressed){
|
||||
red =((pixel & self->r_bitmask) >>11);
|
||||
green = ((pixel & self->g_bitmask) >>5);
|
||||
blue = ((pixel & self->b_bitmask) >> 0);
|
||||
} else {
|
||||
red =((pixel & self->r_bitmask) >>10);
|
||||
green = ((pixel & self->g_bitmask) >>4);
|
||||
blue = ((pixel & self->b_bitmask) >> 0);
|
||||
}
|
||||
tmp = (red << 19 | green << 10 | blue << 3);
|
||||
return tmp;
|
||||
}else {
|
||||
return pixel;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,6 +40,11 @@ typedef struct {
|
||||
uint16_t height;
|
||||
uint16_t data_offset;
|
||||
uint16_t stride;
|
||||
uint32_t r_bitmask;
|
||||
uint32_t g_bitmask;
|
||||
uint32_t b_bitmask;
|
||||
bool bitfield_compressed;
|
||||
bool grayscale;
|
||||
pyb_file_obj_t* file;
|
||||
uint8_t bytes_per_pixel;
|
||||
} displayio_ondiskbitmap_t;
|
||||
|
85
tools/fixup_translations.py
Normal file
85
tools/fixup_translations.py
Normal file
@ -0,0 +1,85 @@
|
||||
# Validate that all entries in the .pot are in every .po. Only the .pot is updated so we can detect
|
||||
# if a translation was added to the source but isn't in a .po. This ensures translators can grab
|
||||
# complete files to work on.
|
||||
|
||||
import git
|
||||
import sys
|
||||
import polib
|
||||
|
||||
po_filenames = sys.argv[1:]
|
||||
repo = git.Repo()
|
||||
|
||||
NO_TRANSLATION_WHITELIST = ["ffi_prep_closure_loc"]
|
||||
|
||||
bad_commits = {}
|
||||
for po_filename in po_filenames:
|
||||
print("Checking", po_filename)
|
||||
|
||||
commits = repo.iter_commits(paths=po_filename, reverse=True, topo_order=True)
|
||||
first_translations = None
|
||||
fixed_ids = set()
|
||||
for commit in commits:
|
||||
try:
|
||||
blob = commit.tree / po_filename
|
||||
except KeyError:
|
||||
continue
|
||||
try:
|
||||
current_file = polib.pofile(blob.data_stream.read().decode("utf-8"))
|
||||
except OSError:
|
||||
print("skipping invalid po in", commit)
|
||||
continue
|
||||
if not first_translations:
|
||||
first_translations = current_file
|
||||
continue
|
||||
print(commit.authored_date, commit)
|
||||
first_translations.metadata = current_file.metadata
|
||||
first_translations.header = current_file.header
|
||||
for entry in first_translations:
|
||||
newer_entry = current_file.find(entry.msgid)
|
||||
|
||||
if newer_entry and entry.msgid == "":
|
||||
entry.merge(newer_entry)
|
||||
print(entry)
|
||||
elif newer_entry and entry.msgstr != newer_entry.msgstr:
|
||||
if newer_entry.msgstr != "" and (newer_entry.msgstr != entry.msgid or entry.msgid in NO_TRANSLATION_WHITELIST):
|
||||
entry.merge(newer_entry)
|
||||
entry.msgstr = newer_entry.msgstr
|
||||
if "fuzzy" not in newer_entry.flags and "fuzzy" in entry.flags:
|
||||
entry.flags.remove("fuzzy")
|
||||
elif entry.msgid not in fixed_ids:
|
||||
if commit not in bad_commits:
|
||||
bad_commits[commit] = set()
|
||||
bad_commits[commit].add(po_filename)
|
||||
fixed_ids.add(entry.msgid)
|
||||
#print(entry.msgid, "\"" + entry.msgstr + "\"", "\"" + newer_entry.msgstr + "\"",)
|
||||
elif newer_entry and newer_entry.flags != entry.flags:
|
||||
entry.flags = newer_entry.flags
|
||||
elif newer_entry and newer_entry.obsolete != entry.obsolete:
|
||||
entry.obsolete = newer_entry.obsolete
|
||||
elif not newer_entry:
|
||||
entry.obsolete = True
|
||||
|
||||
# Add new entries to the modified pofile.
|
||||
for entry in current_file:
|
||||
old_entry = first_translations.find(entry.msgid, include_obsolete_entries=True)
|
||||
if old_entry:
|
||||
continue
|
||||
first_translations.append(entry)
|
||||
|
||||
# Remove obsolete translations. We can always use this script to revive them from the git history.
|
||||
to_remove = []
|
||||
for entry in first_translations:
|
||||
if entry.obsolete:
|
||||
to_remove.append(entry)
|
||||
|
||||
for remove in to_remove:
|
||||
first_translations.remove(remove)
|
||||
|
||||
first_translations.save(po_filename)
|
||||
|
||||
print()
|
||||
for commit in bad_commits:
|
||||
files = bad_commits[commit]
|
||||
print(commit)
|
||||
for file in files:
|
||||
print("\t",file)
|
Loading…
x
Reference in New Issue
Block a user