[python/turtle] Fix speed type

This commit is contained in:
Léa Saviot
2018-12-06 13:38:05 +01:00
parent e769255c05
commit d530637591
2 changed files with 3 additions and 4 deletions

View File

@@ -73,7 +73,7 @@ void Turtle::setHeading(mp_float_t angle) {
}
void Turtle::setSpeed(mp_int_t speed) {
if (speed < k_minSpeed || speed > k_maxSpeed) {
if (speed < 0 || speed > k_maxSpeed) {
m_speed = 0;
} else {
m_speed = speed;

View File

@@ -70,9 +70,8 @@ private:
static constexpr KDCoordinate k_xOffset = Ion::Display::Width / 2;
static constexpr KDCoordinate k_yOffset = (Ion::Display::Height - 18) / 2;
static constexpr int k_numberOfIcons = 8;
static constexpr float k_minSpeed = 0.5f;
static constexpr float k_defaultSpeed = 3.0f;
static constexpr float k_maxSpeed = 10.0f;
static constexpr uint8_t k_defaultSpeed = 3;
static constexpr uint8_t k_maxSpeed = 10;
KDPoint position(mp_float_t x, mp_float_t y) const;
KDPoint position() const { return position(m_x, m_y); }