Standardize more error messages to save space
This commit is contained in:
parent
6311f13e8e
commit
8426773af4
12 changed files with 45 additions and 70 deletions
|
|
@ -497,7 +497,6 @@ msgstr ""
|
|||
#: ports/nrf/common-hal/countio/Counter.c
|
||||
#: ports/nrf/common-hal/pulseio/PulseIn.c
|
||||
#: ports/nrf/common-hal/rotaryio/IncrementalEncoder.c
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
msgid "All channels in use"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -520,13 +519,11 @@ msgid "All sync event channels in use"
|
|||
msgstr ""
|
||||
|
||||
#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
msgid "All timers for this pin are in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/_pew/PewPew.c
|
||||
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
|
||||
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
|
||||
#: ports/cxd56/common-hal/pulseio/PulseOut.c
|
||||
|
|
@ -537,7 +534,7 @@ msgstr ""
|
|||
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
|
||||
#: ports/nrf/common-hal/pulseio/PulseIn.c ports/nrf/peripherals/nrf/timers.c
|
||||
#: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c
|
||||
#: ports/stm/peripherals/timers.c shared-bindings/pwmio/PWMOut.c
|
||||
#: ports/stm/peripherals/timers.c
|
||||
msgid "All timers in use"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -776,12 +773,6 @@ msgstr ""
|
|||
msgid "Cannot remount '/' when visible via USB."
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/microcontroller/__init__.c
|
||||
#: ports/cxd56/common-hal/microcontroller/__init__.c
|
||||
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
|
||||
msgid "Cannot reset into bootloader because no bootloader is present"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/socketpool/Socket.c
|
||||
msgid "Cannot set socket options"
|
||||
msgstr ""
|
||||
|
|
@ -799,10 +790,6 @@ msgstr ""
|
|||
msgid "Cannot subclass slice"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
msgid "Cannot vary frequency on a timer that is already in use"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/alarm/pin/PinAlarm.c
|
||||
msgid "Cannot wake on pin edge, only level"
|
||||
msgstr ""
|
||||
|
|
@ -845,10 +832,6 @@ msgstr ""
|
|||
msgid "Could not set address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
msgid "Could not start PWM"
|
||||
msgstr ""
|
||||
|
||||
#: ports/stm/common-hal/busio/UART.c
|
||||
msgid "Could not start interrupt, RX busy"
|
||||
msgstr ""
|
||||
|
|
@ -940,16 +923,6 @@ msgstr ""
|
|||
msgid "ESP-IDF memory allocation failed"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
|
||||
#: ports/atmel-samd/common-hal/countio/Counter.c
|
||||
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
|
||||
#: ports/atmel-samd/common-hal/ps2io/Ps2.c
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
|
||||
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
|
||||
#: ports/cxd56/common-hal/pulseio/PulseIn.c
|
||||
msgid "EXTINT channel already in use"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/modre.c
|
||||
msgid "Error in regex"
|
||||
msgstr ""
|
||||
|
|
@ -1082,10 +1055,6 @@ msgid ""
|
|||
"Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
msgid "Frequency must match existing PWMOut using this timer"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c
|
||||
#: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c
|
||||
msgid "Function requires lock"
|
||||
|
|
@ -1195,7 +1164,7 @@ msgid "Internal define error"
|
|||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/paralleldisplaybus/ParallelBus.c
|
||||
#: shared-module/os/getenv.c
|
||||
#: shared-bindings/pwmio/PWMOut.c shared-module/os/getenv.c
|
||||
msgid "Internal error"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -1204,6 +1173,16 @@ msgstr ""
|
|||
msgid "Internal error #%d"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
|
||||
#: ports/atmel-samd/common-hal/countio/Counter.c
|
||||
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
|
||||
#: ports/atmel-samd/common-hal/ps2io/Ps2.c
|
||||
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
|
||||
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
|
||||
#: ports/cxd56/common-hal/pulseio/PulseIn.c shared-bindings/pwmio/PWMOut.c
|
||||
msgid "Internal resource(s) in use"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/safe_mode.c
|
||||
msgid "Internal watchdog timer expired."
|
||||
msgstr ""
|
||||
|
|
@ -1221,7 +1200,7 @@ msgstr ""
|
|||
#: ports/raspberrypi/bindings/picodvi/Framebuffer.c
|
||||
#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c
|
||||
#: shared-bindings/digitalio/DigitalInOut.c
|
||||
#: shared-bindings/epaperdisplay/EPaperDisplay.c
|
||||
#: shared-bindings/epaperdisplay/EPaperDisplay.c shared-bindings/pwmio/PWMOut.c
|
||||
msgid "Invalid %q"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -1457,8 +1436,10 @@ msgstr ""
|
|||
msgid "No IP"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
|
||||
msgid "No available clocks"
|
||||
#: ports/atmel-samd/common-hal/microcontroller/__init__.c
|
||||
#: ports/cxd56/common-hal/microcontroller/__init__.c
|
||||
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
|
||||
msgid "No bootloader present"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
|
||||
|
|
@ -1681,11 +1662,6 @@ msgstr ""
|
|||
msgid "Out-buffer elements must be <= 4 bytes long"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/pwmio/PWMOut.c
|
||||
msgid ""
|
||||
"PWM frequency not writable when variable_frequency is False on construction."
|
||||
msgstr ""
|
||||
|
||||
#: ports/stm/common-hal/pwmio/PWMOut.c
|
||||
msgid "PWM restart"
|
||||
msgstr ""
|
||||
|
|
@ -1731,11 +1707,6 @@ msgstr ""
|
|||
msgid "Pin must be on PWM Channel B"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/countio/Counter.c
|
||||
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
|
||||
msgid "Pin must support hardware interrupts"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/rgbmatrix/RGBMatrix.c
|
||||
#, c-format
|
||||
msgid ""
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ static void pinalarm_set_alarms_light(size_t n_alarms, const mp_obj_t *alarms) {
|
|||
case PINALARM_ERR_NOEXTINT:
|
||||
raise_ValueError_invalid_pin();
|
||||
case PINALARM_ERR_NOCHANNEL:
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
default:
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Unknown reason."));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#include "common-hal/countio/Counter.h"
|
||||
#include "shared-bindings/countio/Counter.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "atmel_start_pins.h"
|
||||
|
||||
|
|
@ -11,13 +12,13 @@
|
|||
void common_hal_countio_counter_construct(countio_counter_obj_t *self,
|
||||
const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) {
|
||||
if (!pin->has_extint) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Pin must support hardware interrupts"));
|
||||
raise_ValueError_invalid_pin();
|
||||
}
|
||||
|
||||
|
||||
if (eic_get_enable()) {
|
||||
if (!eic_channel_free(pin->extint_channel)) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
} else {
|
||||
turn_on_external_interrupt_controller();
|
||||
|
|
|
|||
|
|
@ -295,12 +295,12 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t*
|
|||
#ifdef SAM_D5X_E5X
|
||||
((EIC->INTENSET.bit.EXTINT & mask) != 0 || (EIC->EVCTRL.bit.EXTINTEO & mask) != 0)) {
|
||||
#endif
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
|
||||
uint8_t timer_index = find_free_timer();
|
||||
if (timer_index == 0xff) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("All timers in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
Tc *tc = tc_insts[timer_index];
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t*
|
|||
frequencyin_samd51_start_dpll();
|
||||
if (dpll_gclk == 0xff && !clock_get_enabled(0, GCLK_SOURCE_DPLL1)) {
|
||||
common_hal_frequencyio_frequencyin_deinit(self);
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("No available clocks"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
set_timer_handler(timer_index, dpll_gclk, TC_HANDLER_NO_INTERRUPT);
|
||||
turn_on_clocks(true, timer_index, dpll_gclk);
|
||||
|
|
@ -399,7 +399,7 @@ void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t*
|
|||
reference_tc = find_free_timer();
|
||||
if (reference_tc == 0xff) {
|
||||
common_hal_frequencyio_frequencyin_deinit(self);
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("All timers in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
frequencyin_reference_tc_init();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ void common_hal_mcu_enable_interrupts(void) {
|
|||
void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
|
||||
if ((runmode == RUNMODE_BOOTLOADER) || (runmode == RUNMODE_UF2)) {
|
||||
if (!bootloader_available()) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Cannot reset into bootloader because no bootloader is present"));
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("No bootloader present"));
|
||||
}
|
||||
// Pretend to be the first of the two reset presses needed to enter the
|
||||
// bootloader. That way one reset will end in the bootloader.
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t *self,
|
|||
mp_arg_error_invalid(MP_QSTR_clock_pin);
|
||||
}
|
||||
if (eic_get_enable() && !eic_channel_free(clock_pin->extint_channel)) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
|
||||
clk_hi(self);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self,
|
|||
raise_ValueError_invalid_pin();
|
||||
}
|
||||
if (eic_get_enable() && !eic_channel_free(pin->extint_channel)) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
|
||||
self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "common-hal/rotaryio/IncrementalEncoder.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
|
||||
#include "shared-module/rotaryio/IncrementalEncoder.h"
|
||||
|
||||
|
|
@ -36,8 +37,11 @@
|
|||
|
||||
void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t *self,
|
||||
const mcu_pin_obj_t *pin_a, const mcu_pin_obj_t *pin_b) {
|
||||
if (!pin_a->has_extint || !pin_b->has_extint) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Pin must support hardware interrupts"));
|
||||
if (!pin_a->has_extint) {
|
||||
raise_ValueError_invalid_pin_name(MP_QSTR_pin_a);
|
||||
}
|
||||
if (!pin_b->has_extint) {
|
||||
raise_ValueError_invalid_pin_name(MP_QSTR_pin_b);
|
||||
}
|
||||
|
||||
// TODO: The SAMD51 has a peripheral dedicated to quadrature encoder debugging. Use it instead
|
||||
|
|
@ -45,7 +49,7 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode
|
|||
|
||||
if (eic_get_enable()) {
|
||||
if (!eic_channel_free(pin_a->extint_channel) || !eic_channel_free(pin_b->extint_channel)) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
}
|
||||
} else {
|
||||
turn_on_external_interrupt_controller();
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ void common_hal_mcu_enable_interrupts(void) {
|
|||
|
||||
void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
|
||||
if (runmode == RUNMODE_BOOTLOADER) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Cannot reset into bootloader because no bootloader is present"));
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("No bootloader present"));
|
||||
} else if (runmode == RUNMODE_SAFE_MODE) {
|
||||
safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self,
|
|||
|
||||
int irq = pulsein_set_config(self, true);
|
||||
if (irq < 0) {
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("EXTINT channel already in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
} else {
|
||||
pulsein_objects[irq - CXD56_IRQ_EXDEVICE_0] = self;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void PLACE_IN_ITCM(common_hal_mcu_enable_interrupts)(void) {
|
|||
void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
|
||||
if (runmode == RUNMODE_BOOTLOADER) {
|
||||
if (!bootloader_available()) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Cannot reset into bootloader because no bootloader is present"));
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("No bootloader present"));
|
||||
}
|
||||
// Pretend to be the first of the two reset presses needed to enter the
|
||||
// bootloader. That way one reset will end in the bootloader.
|
||||
|
|
|
|||
|
|
@ -46,23 +46,23 @@ void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) {
|
|||
mp_arg_error_invalid(MP_QSTR_frequency);
|
||||
break;
|
||||
case PWMOUT_INVALID_FREQUENCY_ON_PIN:
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Frequency must match existing PWMOut using this timer"));
|
||||
mp_arg_error_invalid(MP_QSTR_frequency);
|
||||
break;
|
||||
case PWMOUT_VARIABLE_FREQUENCY_NOT_AVAILABLE:
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("Cannot vary frequency on a timer that is already in use"));
|
||||
mp_arg_error_invalid(MP_QSTR_variable_frequency);
|
||||
break;
|
||||
case PWMOUT_ALL_TIMERS_ON_PIN_IN_USE:
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("All timers for this pin are in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
break;
|
||||
case PWMOUT_ALL_TIMERS_IN_USE:
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("All timers in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
break;
|
||||
case PWMOUT_ALL_CHANNELS_IN_USE:
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("All channels in use"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal resource(s) in use"));
|
||||
break;
|
||||
default:
|
||||
case PWMOUT_INITIALIZATION_ERROR:
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Could not start PWM"));
|
||||
mp_raise_RuntimeError(MP_ERROR_TEXT("Internal error"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,8 +268,7 @@ STATIC mp_obj_t pwmio_pwmout_obj_set_frequency(mp_obj_t self_in, mp_obj_t freque
|
|||
pwmio_pwmout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
if (!common_hal_pwmio_pwmout_get_variable_frequency(self)) {
|
||||
mp_raise_AttributeError(MP_ERROR_TEXT(
|
||||
"PWM frequency not writable when variable_frequency is False on construction."));
|
||||
mp_raise_msg_varg(&mp_type_AttributeError, MP_ERROR_TEXT("Invalid %q"), MP_QSTR_variable_frequency);
|
||||
}
|
||||
mp_int_t freq = mp_obj_get_int(frequency);
|
||||
if (freq == 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue