Browse Source

last functions

master
gituser 10 months ago
parent
commit
d03170f640
2 changed files with 5 additions and 8 deletions
  1. 4
    7
      FSRemotePowerSwitch.ino
  2. 1
    1
      sloeber.ino.cpp

+ 4
- 7
FSRemotePowerSwitch.ino View File

@@ -41,7 +41,6 @@ const int PWR_CAM_PIN = 6;

JsonDocument msg;
String stepperVelocity;
int actAzi = 0;

// Define motor interface type
#define motorInterfaceType AccelStepper::MotorInterfaceType::HALF4WIRE
@@ -55,11 +54,11 @@ void setup() {
pinMode(PWR_RELAY_PIN, OUTPUT);
pinMode(PWR_CAM_PIN, OUTPUT);

digitalWrite(PWR_RELAY_PIN, HIGH);
digitalWrite(PWR_CAM_PIN, HIGH);

setSlowStepperVelocity(); // Slow: Acc: 500 / Fast: MaxSpeed: 1000
// Slow: Acc: 200 / Fast: MaxSpeed: 500

digitalWrite(PWR_RELAY_PIN, HIGH);
digitalWrite(PWR_CAM_PIN, HIGH);
}

/* The loop function runs over and and checks the serial port for receiving a Json of following format:
@@ -155,7 +154,6 @@ void loop() {

} else if (sdr == CMD_SENDER_PC && cmd == CMD_ZERO_CAM) {
stepper.setCurrentPosition(0);
actAzi = 0;
sendZeroCamStatus(String(stepper.currentPosition()));

} else if (sdr == CMD_SENDER_PC && cmd == CMD_VELOCITY_CAM) {
@@ -170,12 +168,11 @@ void loop() {
sendCamVelocityStatus();

} else if (sdr == CMD_SENDER_PC && cmd == CMD_ACT_AZIMUT_CAM) {
actAzi = round(stepper.currentPosition() / (4076.0 / 360.0) * -1);
int actAzi = round(stepper.currentPosition() / (4076.0 / 360.0) * -1);
sendCamActAzimut(String(actAzi));

} else if (sdr == CMD_SENDER_PC && cmd == CMD_AZIMUT_CAM) {
if (digitalRead(PWR_CAM_PIN) == LOW) {
actAzi = val.toInt();
long target = round((4076.0 / 360.0) * val.toDouble() * -1);
stepper.moveTo(target);
stepper.run();

+ 1
- 1
sloeber.ino.cpp View File

@@ -2,7 +2,7 @@
//This is a automatic generated file
//Please do not modify this file
//If you touch this file your change will be overwritten during the next build
//This file has been generated on 2025-01-22 18:08:22
//This file has been generated on 2025-01-22 22:57:08

#include "Arduino.h"
#include "Arduino.h"

Loading…
Cancel
Save