wind intrument

Have done a bit of work on my project and all seems to be working as planned
hoping to be able to load on a pro mini but all is working on an UNO R3 plus
Just wondering if someone would be willing to look over my code and let me know how it looks

#include <SoftwareSerial.h>
#include "LedControl.h"
SoftwareSerial NMEA(8, 9); // RX, TX 
  int v = 0;
  const int delaytime = 100;
  int offset = 0;             //side of 8 digit display 0 left, 4 right
  boolean dp = true;          //Decimal point for led
  int anglePin = A0;                     // wiper on angle sensor connected to analog pin 0
  int speedPin = A1;                     // speed sensor connected to analog pin 1
  float WindAngle  = 0.0;
  float WindSpeed = 0.0;
  String windir="";
  float appangle= 0.0;
  String InNMEA = "";
  String Checksum ="";
  int angleValue = 0.0;
  int speedValue = 0.0;
  int Speed=0.0;
  int angle=100;
  String Wind = "";
  const String WindSpeedUnit = "N,";    // unit for display N = Nautical Miles
  const long interval = 100;            // interval at which to send NMEA Wind (milliseconds)
  unsigned long previousMillis = 0;     // will store last time NMEA Wind sent
  const int AngleCal = 0;               // Calibration of wind angle sensor *10 
  const int SpeedCal = 0;               // Calibration of wind speed sensor *10
  int led=1;
  int ones=0;
  int tens=0;
  int hundreds=0;
  int tenths=0;
/* Bring in analog values 0-5vdc from wind sensors and output nmea 0183 
    Wind direction and speed sentence NMEA 0183
    $WIMWV
    $   String Start 
    WI  Weather Instrument
    MWV Wind Speed and Angle
        1 2 3 4 5
        | | | | |
$WIMWV,x.x,a,x.x,a*hh
1) Wind Angle, 0 to 360 degrees
2) Reference, R = Relative, T = True
3) Wind Speed
4) Wind Speed Units, K/M/N
5) Status, A = Data Valid
6) Checksum
*/
LedControl lc=LedControl(12,11,10,2);
/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(4800);
  NMEA.begin(4800);
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  lc.shutdown(1,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,6);
  lc.setIntensity(1,6);
  /* and clear the display */
  lc.clearDisplay(0);
  lc.clearDisplay(1);
}
// the loop routine runs over and over again forever:
void loop() {

if (Serial.available()) {                                                                     // If anything comes in Serial (USB),
  InNMEA = Serial.readStringUntil('\n');                                                      // read nmea in and output string
  NMEA.print(InNMEA);                                                                         //Print Incoming NMEA put to NMEA port
}       //if (Serial.available() close

  unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {                                             //Checks time past since last send of Wind NMEA and if > interval sends annother NMEA string
  previousMillis = currentMillis;                                                             //sets time to new value  
    Speed = ReadSpeed();
    angle = ReadAngle();
// build the nmea 0183 string for wind instrument and add checksum 
  Wind = "WIMWV,";                                                                            // WI = Weather instrument MWV wind data 
  WindAngle  = (angle+AngleCal)/10.0;                                                         //Apply Angle Calibration Variable and /10 to get 1 dec place
  WindSpeed = (Speed+SpeedCal)/10.0;                                                          //Apply Speed Calibration Variable and /10 to get 1 dec place
  Wind=Wind+String(WindAngle, 1)+",R,"+String(WindSpeed, 1)+","+WindSpeedUnit+"A";            // Builds string data without line start, end, or Checksum to send to NMEA out port
  Checksum = Checksumcalc();
    Wind="$" + Wind + "*" + Checksum;                                                         // add line start and end with checksum
    // test value
    //WindAngle=190.0;
    if (WindAngle > 185) {
      windir="Port";
      offset=6;
      appangle=360-WindAngle;
      if (WindAngle > 240) {
       offset=7; 
      }
    }
    else if (WindAngle < 175) {
      windir="Stbd";
      appangle = WindAngle;
      offset=4;
      if (WindAngle < 120) {
       offset=3; 
      }
    }
    else {
      windir="DDW";
      appangle = WindAngle;
      offset=5;
//      delay (500);
    }
    
    
    NMEA.println(Wind);                                                                       // print string to NMEA Output port
    }       //if (currentMillis - previousMillis >= interval) close
/*  Serial.print("Wind Speed\t");
    Serial.print(String(WindSpeed, 1));
    Serial.print("\tKnots\t");
    Serial.print("Wind Angle\t");
    Serial.print(String(appangle, 1));
    Serial.print("\t");
    Serial.println(windir);
*/
    lc.clearDisplay(0);
    led=0;
    v = appangle*10;
    printNumber(v);
    led=1;
    offset=5;
    v = WindSpeed*10;
    printNumber(v);
    delay(delaytime);

}       //loop close
int ReadSpeed(){                                       
  speedValue = analogRead(speedPin);                                                          // Reads Value from Analog pin 1 for wind speed
  Speed = map(speedValue, 0, 1023, 0.0, 833.334);                                             // remaps speed value to 0 - 833.334 Knots*10
  /*if (Speed < 833) {
    Speed = Speed + 1;
  }
  else {
    Speed = 1;
  }
*/
return Speed;
}
int ReadAngle(){
  angleValue =analogRead(anglePin);                                                           // Reads Value from Analog pin 0 for wind angle
  angle = map(angleValue, 0, 1023, 3500.0, 100.0);                                            // remaps angle value to 100 - 3500 Degrees*10 
/*  
  if (angle < 3500) {
    angle = angle + 5;
  }
  else {
    angle = 100; 
  }
*/
  return angle;
}
String Checksumcalc(){
  String data = Wind; 
  byte crc = 0;
  for(int i=0;i<data.length();i++){                   // creates Checksum for string
    crc=crc^data[i];
    Checksum=String(crc,HEX);
  }//checksum calc close
return Checksum;
}
int printNumber(int v) {
    if(v < -9999 || v > 9999) 
       return;
    tenths=v%10;
    v=v/10;
    ones=v%10;
    v=v/10;
    tens=v%10;
    v=v/10;
    hundreds=v;     
    
    //Now print the number digit by digit
    lc.setDigit(led,7-offset+3,(byte)hundreds,false);
    lc.setDigit(led,7-offset+2,(byte)tens,false);
    lc.setDigit(led,7-offset+1,(byte)ones,true);
    lc.setDigit(led,7-offset+0,(byte)tenths,false);
}

1.) Your code is very messy and not the easiest to read
2.) Use whitespace between functions
3.) Use whitespace between variable declarations of different types
4.) Don't comment out blocks of code and keep it unless you have a REALLY good reason to (ie don't)
5.) Try to limit the use of "magic numbers" - declare a const variable at the top of your code and use it instead of having hard-coded numbers in your functions. Not that you can't have any "magic numbers", but the fewer the better.
6.) (This is personal preference, but) Try to line up the equal signs of expressions on consecutive lines of code

Check out the formatting of this library cpp file as an example:

#include "SerialTransfer.h"




/*
 void SerialTransfer::begin(Stream &_port)
 Description:
 ------------
  * Constructor for the SerialTransfer Class
 Inputs:
 -------
  * Stream *_port - Pointer to Serial port to
  communicate over
 Return:
 -------
  * void
*/
void SerialTransfer::begin(Stream &_port)
{
	port = &_port;
}




/*
 bool SerialTransfer::sendData(uint8_t messageLen)
 Description:
 ------------
  * Send a specified number of bytes in packetized form
 Inputs:
 -------
  * uint8_t messageLen - Number of values in txBuff to
  send as the payload in the next packet
 Return:
 -------
  * bool - Whether or not messageLen was an acceptable
  value
*/
bool SerialTransfer::sendData(uint8_t messageLen)
{
	if (messageLen <= MAX_PACKET_SIZE)
	{
		calcOverhead(txBuff, messageLen);
		stuffPacket(txBuff, messageLen);
		uint8_t checksum = findChecksum(txBuff, messageLen);

		port->write(START_BYTE);
		port->write(overheadByte);
		port->write(messageLen);
		port->write(txBuff, messageLen);
		port->write(checksum);
		port->write(STOP_BYTE);

		return true;
	}
	
	return false;
}




/*
 uint8_t SerialTransfer::findChecksum(uint8_t arr[], uint8_t len)
 Description:
 ------------
  * Determine the 8-bit checksum of a given number of elements of
  a given array
 Inputs:
 -------
  * uint8_t arr[] - Array of values the checksum is to be calculated
  over
  * uint8_t len - Number of elements in arr[]
  over
 Return:
  * uint8_t - 8-bit checksum of the given number of elements of
  the given array
 -------
  *
*/
uint8_t SerialTransfer::findChecksum(uint8_t arr[], uint8_t len)
{
	uint8_t checksum = 0;

	for (uint8_t i = 0; i < len; i++)
		checksum += arr[i];

	checksum = ~checksum;

	return checksum;
}




/*
 void SerialTransfer::calcOverhead(uint8_t arr[], uint8_t len)
 Description:
 ------------
  * Calculates the COBS (Consistent Overhead Stuffing) Overhead
  byte and stores it in the class's overheadByte variable. This
  variable holds the byte position (within the payload) of the
  first payload byte equal to that of START_BYTE
 Inputs:
 -------
  * uint8_t arr[] - Array of values the overhead is to be calculated
  over
  * uint8_t len - Number of elements in arr[]
 Return:
 -------
  * void
*/
void SerialTransfer::calcOverhead(uint8_t arr[], uint8_t len)
{
	overheadByte = 0xFF;

	for (uint8_t i = 0; i < len; i++)
		if (arr[i] == START_BYTE)
			overheadByte = i;
}




/*
 int16_t SerialTransfer::packetStuffing(uint8_t arr[], uint8_t len)
 Description:
 ------------
  * Finds last instance of the value START_BYTE within the given
  packet array
 Inputs:
 -------
  * uint8_t arr[] - Packet array
  * uint8_t len - Number of elements in arr[]
 Return:
 -------
  * int16_t - 
*/
int16_t SerialTransfer::findLast(uint8_t arr[], uint8_t len)
{
	for (uint8_t i = (len - 1); i != 0xFF; i--)
		if (arr[i] == START_BYTE)
			return i;

	return -1;
}




/*
 void SerialTransfer::stuffPacket(uint8_t arr[], uint8_t len)
 Description:
 ------------
  * Enforces the COBS (Consistent Overhead Stuffing) ruleset across
  all bytes in the packet against the value of START_BYTE
 Inputs:
 -------
  * uint8_t arr[] - Array of values to stuff
  * uint8_t len - Number of elements in arr[]
 Return:
 -------
  * void
*/
void SerialTransfer::stuffPacket(uint8_t arr[], uint8_t len)
{
	int16_t refByte = findLast(arr, len);

	if (refByte != -1)
	{
		for (uint8_t i = (len - 1); i != 0xFF; i--)
		{
			if (arr[i] == START_BYTE)
			{
				arr[i] = refByte - i;
				refByte = i;
			}
		}
	}
}




/*
 void SerialTransfer::unpackPacket(uint8_t arr[], uint8_t len)
 Description:
 ------------
  * Unpacks all COBS-stuffed bytes within the array
 Inputs:
 -------
  * uint8_t arr[] - Array of values to unpack
  * uint8_t len - Number of elements in arr[]
 Return:
 -------
  * void
*/
void SerialTransfer::unpackPacket(uint8_t arr[], uint8_t len)
{
	uint8_t testIndex = recOverheadByte;
	uint8_t delta = 0;

	if (testIndex <= MAX_PACKET_SIZE)
	{
		while (arr[testIndex])
		{
			delta = arr[testIndex];
			arr[testIndex] = START_BYTE;
			testIndex += delta;
		}
		arr[testIndex] = START_BYTE;
	}
}




/*
 int8_t SerialTransfer::available()
 Description:
 ------------
  * Parses incoming serial data, analyzes packet contents,
  and reports errors/successful packet reception
 Inputs:
 -------
  * void
 Return:
 -------
  * int8_t - Error code
*/
int8_t SerialTransfer::available()
{
	if (port->available())
	{
		while (port->available())
		{
			uint8_t recChar = port->read();

			switch (state)
			{
				case find_start_byte://///////////////////////////////////////
				{
					if (recChar == START_BYTE)
						state = find_overhead_byte;
					break;
				}

				case find_overhead_byte://////////////////////////////////////
				{
					recOverheadByte = recChar;
					state = find_payload_len;
					break;
				}

				case find_payload_len:////////////////////////////////////////
				{
					if (recChar <= MAX_PACKET_SIZE)
					{
						bytesToRec = recChar;
						state = find_payload;
					}
					else
					{
						state = find_start_byte;
						return PAYLOAD_ERROR;
					}
					break;
				}

				case find_payload:////////////////////////////////////////////
				{
					if (payIndex < bytesToRec)
					{
						rxBuff[payIndex] = recChar;
						payIndex++;

						if (payIndex == bytesToRec)
						{
							payIndex = 0;
							state = find_checksum;
						}
					}
					break;
				}

				case find_checksum:///////////////////////////////////////////
				{
					uint8_t calcChecksum = findChecksum(rxBuff, bytesToRec);

					if (calcChecksum == recChar)
						state = find_end_byte;
					else
					{
						state = find_start_byte;
						return CHECKSUM_ERROR;
					}
				
					break;
				}

				case find_end_byte:///////////////////////////////////////////
				{
					state = find_start_byte;

					if (recChar == STOP_BYTE)
					{
						unpackPacket(rxBuff, bytesToRec);
						return NEW_DATA;
					}

					return STOP_BYTE_ERROR;
					break;
				}

				default:
				{
					Serial.print("ERROR: Undefined state: ");
					Serial.println(state);
					state = find_start_byte;
					break;
				}
			}
		}
	}
	else
		return NO_DATA;

	return CONTINUE;
}

There are also a lot of unnecessary comments. If your code is easy to read, 90% comments are not needed (apart from function "docstrings")

And try your best not to use "String" variables

The most important question is what You want Your code to do and what it us doing. If code does the job You want... Then You have made it.
Yes, there are good orogramming rules to make the code more robust, easier to read etc.
Suppose You want to update Your code some years later... You will have trouble to understand how You were thinking. Make comments that a total newbie would understand.
I have some code being 30 years old and it us not easy to read it today....

I have to go with railroader, if it works, then 99.999% of the work is done.
and excessive comments can bring sense to a future you.

things like this are confusing :

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(4800);

and then there is this :

   v = appangle*10;
    printNumber(v);
    led=1;
    offset=5;
    v = WindSpeed*10;
    printNumber(v);
    delay(delaytime);

using the same variable seems to be a bad habbit
what happens if you ;
printNumber(WindSpeed*10) ;

int printNumber(int v) {
    if(v < -9999 || v > 9999) 
       return;
    tenths=v%10;
    v=v/10;
    ones=v%10;
    v=v/10;
    tens=v%10;
    v=v/10;
    hundreds=v;

saving memory is good, but there is a chance that it can cause problems