summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--stm/adc.c2
-rw-r--r--stm/printf.c2
-rw-r--r--stm/servo.c4
3 files changed, 7 insertions, 1 deletions
diff --git a/stm/adc.c b/stm/adc.c
index cd915b1724..e50b3bf663 100644
--- a/stm/adc.c
+++ b/stm/adc.c
@@ -300,7 +300,7 @@ static mp_obj_t adc_all_read_core_vbat(mp_obj_t self_in) {
pyb_obj_adc_all_t *self = self_in;
if (self->is_enabled) {
- float data = adc_read_core_vbat();
+ float data = adc_read_core_vbat();
return mp_obj_new_float(data);
} else {
return mp_const_none;
diff --git a/stm/printf.c b/stm/printf.c
index cfe4204b61..abbc58b669 100644
--- a/stm/printf.c
+++ b/stm/printf.c
@@ -209,6 +209,7 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, va_list args) {
case 'P': // ?
chrs += pfenv_print_int(pfenv, va_arg(args, int), 0, 16, 'A', flags, width);
break;
+#if MICROPY_ENABLE_FLOAT
case 'g':
{
// This is a very hacky approach to printing floats. Micropython
@@ -234,6 +235,7 @@ int pfenv_printf(const pfenv_t *pfenv, const char *fmt, va_list args) {
}
break;
}
+#endif
default:
pfenv->print_strn(pfenv->data, fmt, 1);
chrs += 1;
diff --git a/stm/servo.c b/stm/servo.c
index 4943a64425..4edac0c86d 100644
--- a/stm/servo.c
+++ b/stm/servo.c
@@ -124,7 +124,11 @@ static void servo_obj_print(void (*print)(void *env, const char *fmt, ...), void
static mp_obj_t servo_obj_angle(mp_obj_t self_in, mp_obj_t angle) {
pyb_servo_obj_t *self = self_in;
+#if MICROPY_ENABLE_FLOAT
machine_int_t v = 152 + 85.0 * mp_obj_get_float(angle) / 90.0;
+#else
+ machine_int_t v = 152 + 85 * mp_obj_get_int(angle) / 90;
+#endif
if (v < 65) { v = 65; }
if (v > 210) { v = 210; }
switch (self->servo_id) {