@@ -42,23 +42,22 @@ const monochrome_5by5_t microbit_blank_image = {
42
42
43
43
STATIC void microbit_image_print (const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
44
44
microbit_image_obj_t *self = (microbit_image_obj_t *)self_in;
45
- mp_printf (print, " +" );
46
- for (int x = 0 ; x < self->width (); ++x) {
47
- mp_printf (print, " -" );
48
- }
49
- mp_printf (print, " +\n " );
45
+ mp_printf (print, " Image(" );
46
+ if (kind == PRINT_STR)
47
+ mp_printf (print, " \n " );
48
+ mp_printf (print, " '" );
50
49
for (int y = 0 ; y < self->height (); ++y) {
51
- mp_printf (print, " |" );
52
50
for (int x = 0 ; x < self->width (); ++x) {
53
51
mp_printf (print, " %c" , " 123456789" [self->getPixelValue (x, y)]);
54
52
}
55
- mp_printf (print, " |\n " );
56
- }
57
- mp_printf (print, " +" );
58
- for (int x = 0 ; x < self->width (); ++x) {
59
- mp_printf (print, " -" );
53
+ mp_printf (print, " \\ n" );
54
+ if (kind == PRINT_STR && y < self->height ()-1 )
55
+ mp_printf (print, " '\n '" );
60
56
}
61
- mp_printf (print, " +\n " );
57
+ mp_printf (print, " '" );
58
+ if (kind == PRINT_STR)
59
+ mp_printf (print, " \n " );
60
+ mp_printf (print, " )" );
62
61
}
63
62
64
63
uint8_t monochrome_5by5_t::getPixelValue (mp_int_t x, mp_int_t y) {
@@ -674,6 +673,7 @@ const mp_obj_type_t microbit_sliced_image_type = {
674
673
.buffer_p = {NULL },
675
674
.stream_p = NULL ,
676
675
.bases_tuple = MP_OBJ_NULL,
676
+ MP_OBJ_NULL
677
677
};
678
678
679
679
const mp_obj_type_t microbit_sliced_image_iterator_type = {
@@ -691,6 +691,7 @@ const mp_obj_type_t microbit_sliced_image_iterator_type = {
691
691
.buffer_p = {NULL },
692
692
.stream_p = NULL ,
693
693
.bases_tuple = MP_OBJ_NULL,
694
+ MP_OBJ_NULL
694
695
};
695
696
696
697
typedef struct _scrolling_string_t {
@@ -778,6 +779,7 @@ const mp_obj_type_t microbit_scrolling_string_type = {
778
779
.buffer_p = {NULL },
779
780
.stream_p = NULL ,
780
781
.bases_tuple = MP_OBJ_NULL,
782
+ MP_OBJ_NULL
781
783
};
782
784
783
785
const mp_obj_type_t microbit_scrolling_string_iterator_type = {
@@ -795,6 +797,7 @@ const mp_obj_type_t microbit_scrolling_string_iterator_type = {
795
797
.buffer_p = {NULL },
796
798
.stream_p = NULL ,
797
799
.bases_tuple = MP_OBJ_NULL,
800
+ MP_OBJ_NULL
798
801
};
799
802
800
803
}
0 commit comments