mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[Fix] Conflicts
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
QCFG(BYTES_IN_LEN, (1))
|
||||
QCFG(BYTES_IN_HASH, (2))
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Ion QSTR
|
||||
Q(ion)
|
||||
Q(keydown)
|
||||
@@ -188,6 +189,8 @@ Q(time)
|
||||
Q(sleep)
|
||||
Q(monotonic)
|
||||
|
||||
=======
|
||||
>>>>>>> upstream/master
|
||||
// MicroPython QSTRs
|
||||
Q()
|
||||
Q(*)
|
||||
@@ -492,3 +495,176 @@ Q(upper)
|
||||
Q(value)
|
||||
Q(values)
|
||||
Q(zip)
|
||||
|
||||
// Ion QSTR
|
||||
Q(ion)
|
||||
Q(keydown)
|
||||
Q(KEY_LEFT)
|
||||
Q(KEY_UP)
|
||||
Q(KEY_DOWN)
|
||||
Q(KEY_RIGHT)
|
||||
Q(KEY_OK)
|
||||
Q(KEY_BACK)
|
||||
Q(KEY_HOME)
|
||||
Q(KEY_ONOFF)
|
||||
Q(KEY_SHIFT)
|
||||
Q(KEY_ALPHA)
|
||||
Q(KEY_XNT)
|
||||
Q(KEY_VAR)
|
||||
Q(KEY_TOOLBOX)
|
||||
Q(KEY_BACKSPACE)
|
||||
Q(KEY_EXP)
|
||||
Q(KEY_LN)
|
||||
Q(KEY_LOG)
|
||||
Q(KEY_IMAGINARY)
|
||||
Q(KEY_COMMA)
|
||||
Q(KEY_POWER)
|
||||
Q(KEY_SINE)
|
||||
Q(KEY_COSINE)
|
||||
Q(KEY_TANGENT)
|
||||
Q(KEY_PI)
|
||||
Q(KEY_SQRT)
|
||||
Q(KEY_SQUARE)
|
||||
Q(KEY_SEVEN)
|
||||
Q(KEY_EIGHT)
|
||||
Q(KEY_NINE)
|
||||
Q(KEY_LEFTPARENTHESIS)
|
||||
Q(KEY_RIGHTPARENTHESIS)
|
||||
Q(KEY_FOUR)
|
||||
Q(KEY_FIVE)
|
||||
Q(KEY_SIX)
|
||||
Q(KEY_MULTIPLICATION)
|
||||
Q(KEY_DIVISION)
|
||||
Q(KEY_ONE)
|
||||
Q(KEY_TWO)
|
||||
Q(KEY_THREE)
|
||||
Q(KEY_PLUS)
|
||||
Q(KEY_MINUS)
|
||||
Q(KEY_ZERO)
|
||||
Q(KEY_DOT)
|
||||
Q(KEY_EE)
|
||||
Q(KEY_ANS)
|
||||
Q(KEY_EXE)
|
||||
|
||||
// Kandinsky QSTRs
|
||||
Q(kandinsky)
|
||||
Q(color)
|
||||
Q(draw_string)
|
||||
Q(fill_rect)
|
||||
Q(get_pixel)
|
||||
Q(set_pixel)
|
||||
Q(wait_vblank)
|
||||
Q(get_keys)
|
||||
|
||||
// Keys QSTRs
|
||||
Q(left)
|
||||
Q(up)
|
||||
Q(down)
|
||||
Q(right)
|
||||
Q(OK)
|
||||
Q(back)
|
||||
|
||||
Q(home)
|
||||
Q(onOff)
|
||||
Q(shift)
|
||||
Q(alpha)
|
||||
Q(xnt)
|
||||
Q(var)
|
||||
Q(toolbox)
|
||||
Q(backspace)
|
||||
|
||||
Q(exp)
|
||||
Q(ln)
|
||||
Q(log)
|
||||
Q(imaginary)
|
||||
Q(comma)
|
||||
Q(power)
|
||||
|
||||
Q(sin)
|
||||
Q(cos)
|
||||
Q(tan)
|
||||
Q(pi)
|
||||
Q(sqrt)
|
||||
Q(square)
|
||||
|
||||
Q(7)
|
||||
Q(8)
|
||||
Q(9)
|
||||
Q(()
|
||||
Q())
|
||||
|
||||
Q(4)
|
||||
Q(5)
|
||||
Q(6)
|
||||
Q(*)
|
||||
Q(/)
|
||||
|
||||
Q(1)
|
||||
Q(2)
|
||||
Q(3)
|
||||
Q(+)
|
||||
Q(-)
|
||||
|
||||
Q(0)
|
||||
Q(.)
|
||||
Q(EE)
|
||||
Q(Ans)
|
||||
Q(EXE)
|
||||
|
||||
// Matplotlib QSTRs
|
||||
Q(arrow)
|
||||
Q(axis)
|
||||
Q(bar)
|
||||
Q(grid)
|
||||
Q(grid)
|
||||
Q(hist)
|
||||
Q(plot)
|
||||
Q(matplotlib)
|
||||
Q(matplotlib.pyplot)
|
||||
Q(pyplot)
|
||||
Q(scatter)
|
||||
Q(show)
|
||||
Q(text)
|
||||
|
||||
// Turtle QSTRs
|
||||
Q(turtle)
|
||||
Q(forward)
|
||||
Q(fd)
|
||||
Q(backward)
|
||||
Q(bk)
|
||||
Q(back)
|
||||
Q(right)
|
||||
Q(rt)
|
||||
Q(left)
|
||||
Q(lt)
|
||||
Q(goto)
|
||||
Q(setpos)
|
||||
Q(setposition)
|
||||
Q(setheading)
|
||||
Q(seth)
|
||||
Q(circle)
|
||||
Q(speed)
|
||||
Q(position)
|
||||
Q(pos)
|
||||
Q(heading)
|
||||
Q(pendown)
|
||||
Q(pd)
|
||||
Q(down)
|
||||
Q(penup)
|
||||
Q(pu)
|
||||
Q(up)
|
||||
Q(pensize)
|
||||
Q(width)
|
||||
Q(isdown)
|
||||
Q(pencolor)
|
||||
Q(reset)
|
||||
Q(showturtle)
|
||||
Q(st)
|
||||
Q(hideturtle)
|
||||
Q(ht)
|
||||
Q(isvisible)
|
||||
|
||||
// utime QSTRs
|
||||
Q(time)
|
||||
Q(sleep)
|
||||
Q(monotonic)
|
||||
|
||||
@@ -114,7 +114,11 @@ mp_obj_t modpyplot_axis(size_t n_args, const mp_obj_t *args) {
|
||||
} else {
|
||||
mp_raise_ValueError("Unrecognized string given to axis; try 'on', 'off' or 'auto'");
|
||||
}
|
||||
#warning Use mp_obj_is_bool when upgrading uPy
|
||||
#if MICROPY_OBJ_IMMEDIATE_OBJS
|
||||
/* This couldn't be done at the time of writing because mp_obj_is_bool didn't
|
||||
* exist just yet. */
|
||||
#error Use mp_obj_is_bool instead of mp_obj_is_type
|
||||
#endif
|
||||
} else if (mp_obj_is_type(arg, &mp_type_bool)) {
|
||||
sPlotStore->setAxesRequested(mp_obj_is_true(arg));
|
||||
} else if (mp_obj_is_type(arg, &mp_type_tuple) || mp_obj_is_type(arg, &mp_type_list)) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "plot_store.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace Matplotlib {
|
||||
|
||||
@@ -160,15 +161,12 @@ void PlotStore::addLabel(mp_obj_t x, mp_obj_t y, mp_obj_t string) {
|
||||
|
||||
// Axes
|
||||
|
||||
static inline float minFloat(float x, float y) { return x < y ? x : y; }
|
||||
static inline float maxFloat(float x, float y) { return x > y ? x : y; }
|
||||
|
||||
void updateRange(float * xMin, float * xMax, float * yMin, float * yMax, float x, float y) {
|
||||
if (!std::isnan(x) && !std::isinf(x) && !std::isnan(y) && !std::isinf(y)) {
|
||||
*xMin = minFloat(*xMin, x);
|
||||
*xMax = maxFloat(*xMax, x);
|
||||
*yMin = minFloat(*yMin, y);
|
||||
*yMax = maxFloat(*yMax, y);
|
||||
*xMin = std::min(*xMin, x);
|
||||
*xMax = std::max(*xMax, x);
|
||||
*yMin = std::min(*yMin, y);
|
||||
*yMax = std::max(*yMax, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "plot_view.h"
|
||||
#include <algorithm>
|
||||
|
||||
namespace Matplotlib {
|
||||
|
||||
@@ -52,7 +53,6 @@ void PlotView::traceSegment(KDContext * ctx, KDRect r, PlotStore::Segment segmen
|
||||
}
|
||||
}
|
||||
|
||||
static inline KDCoordinate maxKDCoordinate(KDCoordinate x, KDCoordinate y) { return x > y ? x : y; }
|
||||
void PlotView::traceRect(KDContext * ctx, KDRect r, PlotStore::Rect rect) const {
|
||||
KDCoordinate left = std::round(floatToPixel(Axis::Horizontal, rect.left()));
|
||||
KDCoordinate right = std::round(floatToPixel(Axis::Horizontal, rect.right()));
|
||||
@@ -61,7 +61,7 @@ void PlotView::traceRect(KDContext * ctx, KDRect r, PlotStore::Rect rect) const
|
||||
KDRect pixelRect(
|
||||
left,
|
||||
top,
|
||||
maxKDCoordinate(right - left, 1), // Rectangle should at least be visible
|
||||
std::max(right - left, 1), // Rectangle should at least be visible
|
||||
bottom - top
|
||||
);
|
||||
ctx->fillRect(pixelRect, rect.color());
|
||||
@@ -76,5 +76,4 @@ void PlotView::traceLabel(KDContext * ctx, KDRect r, PlotStore::Label label) con
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ void Turtle::left(mp_float_t angle) {
|
||||
|
||||
void Turtle::circle(mp_int_t radius, mp_float_t angle) {
|
||||
mp_float_t oldHeading = heading();
|
||||
mp_float_t length = (angle > 0 ? 1 : -1) * angle * k_headingScale * radius;
|
||||
mp_float_t length = std::fabs(angle * k_headingScale * radius);
|
||||
if (length > 1) {
|
||||
for (int i = 1; i < length; i++) {
|
||||
mp_float_t progress = i / length;
|
||||
@@ -82,7 +82,7 @@ void Turtle::circle(mp_int_t radius, mp_float_t angle) {
|
||||
// Keyboard interruption. Return now to let MicroPython process it.
|
||||
return;
|
||||
}
|
||||
setHeadingPrivate(oldHeading+angle*progress);
|
||||
setHeadingPrivate(oldHeading+std::copysign(angle*progress, radius));
|
||||
}
|
||||
forward(1);
|
||||
setHeading(oldHeading+angle);
|
||||
@@ -377,7 +377,7 @@ void Turtle::drawPaw(PawType type, PawPosition pos) {
|
||||
assert(m_underneathPixelBuffer != nullptr);
|
||||
KDCoordinate pawOffset = 5;
|
||||
constexpr float crawlOffset = 0.6f;
|
||||
constexpr float angles[] = {M_PI_2/2, M_PI_2+M_PI_2/2, -M_PI_2-M_PI_2/2, -M_PI_2/2};
|
||||
constexpr float angles[] = {M_PI_4, 3*M_PI_4, -3*M_PI_4, -M_PI_4};
|
||||
|
||||
// Compute the paw offset from the turtle center
|
||||
float currentAngle = angles[(int) type];
|
||||
|
||||
Reference in New Issue
Block a user