Updated to work with removal of Arduino.h

This commit is contained in:
CommanderRedYT
2022-05-30 15:34:27 +02:00
parent 7bb09e4085
commit 89e5428af2
11 changed files with 28 additions and 20 deletions

View File

@ -1,8 +1,5 @@
#include "settingsmenu.h"
// Arduino includes
#include <Arduino.h>
// 3rdparty lib includes
#include "actions/pushscreenaction.h"
#include "actions/popscreenaction.h"

View File

@ -1,10 +1,15 @@
#include "spirodisplay.h"
// 3rdparty lib includes
#include <randomutils.h>
#include <cpputils.h>
#include <esprandom.h>
#include <tftinstance.h>
#include <randomutils.h>
#include <screenmanager.h>
#include <tftinstance.h>
namespace {
typedef unsigned char byte;
} // namespace
void SpiroDisplay::initScreen()
{
@ -39,7 +44,7 @@ void SpiroDisplay::redraw()
sx = std::sin(((i % 360) - 90) * DEG2RAD);
x1 = sx * r + x0;
yy1 = sy * r + yy0;
espgui::tft.drawPixel(x1, yy1, rainbow(map(i%360,0,360,0,127))); //colour);
espgui::tft.drawPixel(x1, yy1, rainbow(cpputils::mapValue<uint16_t>(i%360,0,360,0,127))); //colour);
}
if (i == (360 * n))
@ -61,7 +66,7 @@ void SpiroDisplay::redraw()
sx = std::sin(((new_i % 360) - 90) * DEG2RAD);
x1 = sx * r + x0;
yy1 = sy * r + yy0;
espgui::tft.drawPixel(x1, yy1, rainbow(map(new_i%360,0,360,0,127))); //colour);
espgui::tft.drawPixel(x1, yy1, rainbow(cpputils::mapValue<uint16_t>(new_i%360,0,360,0,127))); //colour);
}
i++;

View File

@ -4,7 +4,7 @@
#include <tuple>
// Arduino includes
#include <Arduino.h>
#include <esp32-hal-gpio.h>
// 3rdparty lib includes
#include <espchrono.h>

View File

@ -4,7 +4,7 @@
#include <array>
// Arduino includes
#include <Arduino.h>
#include <esp32-hal-gpio.h>
// 3rdparty lib includes
#include <espchrono.h>

View File

@ -4,7 +4,8 @@
#include <array>
// Arduino includes
#include <Arduino.h>
#include <esp32-hal-gpio.h>
#include <esp32-hal-misc.h>
// 3rdparty lib includes
#include <espchrono.h>

View File

@ -4,7 +4,8 @@
#include <array>
// Arduino includes
#include <Arduino.h>
#include <esp32-hal-gpio.h>
#include <esp32-hal-misc.h>
// 3rdparty lib includes
#include <espchrono.h>

View File

@ -4,7 +4,8 @@
#include <array>
// Arduino includes
#include <Arduino.h>
#include <esp32-hal-gpio.h>
#include <esp32-hal-misc.h>
// 3rdparty lib includes
#include <espchrono.h>

View File

@ -1,7 +1,10 @@
#include "mickmode.h"
// system includes
#include <cmath>
#include "espchrono.h"
#include "mickmode.h"
// 3rdparty lib includes
#include <espchrono.h>
// local includes
#include "globals.h"
@ -43,7 +46,7 @@ void MickMode::update()
float alpha = 1.f - expf(-timeDelta / profileSettings.mickMode.smoothing);
// Fall back to fixed smoothing if this calculation fails
if (!isfinite(alpha) || alpha < 0.f || alpha > 1.f)
if (!std::isfinite(alpha) || alpha < 0.f || alpha > 1.f)
alpha = 0.02f;
// Limit time constant to below 3 s at update rate of 20 ms to make stopping possible
// if misconfiguration or corruption happens
@ -53,7 +56,7 @@ void MickMode::update()
float gasOf1500 = *gas * 1500.f / 1000.f;
float brakeOf1500 = *brems * 1500.f / 1000.f;
float controlInput = gasOf1500 - brakeOf1500;
if (!isfinite(controlInput) || controlInput > 1500.f || controlInput < -1500.f)
if (!std::isfinite(controlInput) || controlInput > 1500.f || controlInput < -1500.f)
controlInput = 0.f;
pwm_ = pwm_ * (1.f-alpha) + controlInput * alpha;
@ -62,7 +65,7 @@ void MickMode::update()
// This should not happen either, but make sure our state can not get persistently broken
// in case of corruption. Set to 0 as a last resort (may lead to a hard stop).
if (!isfinite(pwm_))
if (!std::isfinite(pwm_))
pwm_ = 0.f;
for (bobbycar::protocol::serial::MotorState &motor : motors())

View File

@ -1,10 +1,10 @@
#pragma once
// 3rdparty lib includes
#include <bobbycar-common.h>
#include <espchrono.h>
// local includes
#include "bobbycar-common.h"
#include "modeinterface.h"
class MickMode : public ModeInterface

View File

@ -1,7 +1,7 @@
#include "mosfets.h"
// Arduino includes
#include <Arduino.h>
#include <esp32-hal-gpio.h>
#ifdef FEATURE_MOSFETS
void init_mosfets()

View File

@ -1,7 +1,7 @@
#include "potis.h"
// 3rdparty lib includes
#include <Arduino.h>
#include <esp32-hal-adc.h>
#include <cpputils.h>
// local includes