kopia lustrzana https://github.com/Hamlib/Hamlib
				
				
				
			Add M2 RC2800 Az-only model
Promote RC2800 to stable https://github.com/Hamlib/Hamlib/issues/451pull/453/head
							rodzic
							
								
									d1f857c131
								
							
						
					
					
						commit
						c16be1c264
					
				|  | @ -325,6 +325,7 @@ | ||||||
| #define ROT_BACKEND_M2 "m2" | #define ROT_BACKEND_M2 "m2" | ||||||
| //! @endcond
 | //! @endcond
 | ||||||
| #define ROT_MODEL_RC2800 ROT_MAKE_MODEL(ROT_M2, 1) | #define ROT_MODEL_RC2800 ROT_MAKE_MODEL(ROT_M2, 1) | ||||||
|  | #define ROT_MODEL_RC2800AZ ROT_MAKE_MODEL(ROT_M2, 2) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
|  | @ -216,6 +216,7 @@ transaction_write: | ||||||
| 
 | 
 | ||||||
|         goto transaction_quit; |         goto transaction_quit; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|     /* then comes the answer */ |     /* then comes the answer */ | ||||||
|  | @ -242,22 +243,25 @@ static int | ||||||
| rc2800_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) | rc2800_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) | ||||||
| { | { | ||||||
|     char cmdstr[64]; |     char cmdstr[64]; | ||||||
|     int retval1, retval2; |     int retval1, retval2 = RIG_OK; | ||||||
| 
 | 
 | ||||||
|     rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); |     rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); | ||||||
| 
 | 
 | ||||||
|     num_sprintf(cmdstr, "A%3.1f"CR, az); |     num_sprintf(cmdstr, "A%3.1f"CR, az); | ||||||
|     retval1 = rc2800_transaction(rot, cmdstr, NULL, 0); |     retval1 = rc2800_transaction(rot, cmdstr, NULL, 0); | ||||||
| 
 | 
 | ||||||
|     /* do not overwhelm the MCU? */ |     if (rot->caps->rot_model == ROT_MODEL_RC2800) | ||||||
|     hl_usleep(200 * 1000); |  | ||||||
| 
 |  | ||||||
|     num_sprintf(cmdstr, "E%3.1f"CR, el); |  | ||||||
|     retval2 = rc2800_transaction(rot, cmdstr, NULL, 0); |  | ||||||
| 
 |  | ||||||
|     if (retval1 == retval2) |  | ||||||
|     { |     { | ||||||
|         return retval1; |         /* do not overwhelm the MCU? */ | ||||||
|  |         hl_usleep(200 * 1000); | ||||||
|  | 
 | ||||||
|  |         num_sprintf(cmdstr, "E%3.1f"CR, el); | ||||||
|  |         retval2 = rc2800_transaction(rot, cmdstr, NULL, 0); | ||||||
|  | 
 | ||||||
|  |         if (retval1 == retval2) | ||||||
|  |         { | ||||||
|  |             return retval1; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return (retval1 != RIG_OK ? retval1 : retval2); |     return (retval1 != RIG_OK ? retval1 : retval2); | ||||||
|  | @ -292,27 +296,36 @@ rc2800_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     retval = rc2800_transaction(rot, "E" CR, posbuf, sizeof(posbuf)); |     if (rot->caps->rot_model == ROT_MODEL_RC2800) | ||||||
| 
 |  | ||||||
|     if (retval != RIG_OK || strlen(posbuf) < 5) |  | ||||||
|     { |     { | ||||||
|         return retval < 0 ? retval : -RIG_EPROTO; |         retval = rc2800_transaction(rot, "E" CR, posbuf, sizeof(posbuf)); | ||||||
|  | 
 | ||||||
|  |         if (retval != RIG_OK || strlen(posbuf) < 5) | ||||||
|  |         { | ||||||
|  |             return retval < 0 ? retval : -RIG_EPROTO; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (rc2800_parse(posbuf, &device, &value) == RIG_OK) | ||||||
|  |         { | ||||||
|  |             if (device == 'E') | ||||||
|  |             { | ||||||
|  |                 *el = (elevation_t) value; | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 return -RIG_EPROTO; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", | ||||||
|  |                   __func__, *az, *el); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         rig_debug(RIG_DEBUG_TRACE, "%s: (az) = (%.1f)\n", | ||||||
|  |                   __func__, *az); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (rc2800_parse(posbuf, &device, &value) == RIG_OK) |  | ||||||
|     { |  | ||||||
|         if (device == 'E') |  | ||||||
|         { |  | ||||||
|             *el = (elevation_t) value; |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             return -RIG_EPROTO; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", |  | ||||||
|               __func__, *az, *el); |  | ||||||
| 
 | 
 | ||||||
|     return RIG_OK; |     return RIG_OK; | ||||||
| } | } | ||||||
|  | @ -367,9 +380,9 @@ const struct rot_caps rc2800_rot_caps = | ||||||
|     ROT_MODEL(ROT_MODEL_RC2800), |     ROT_MODEL(ROT_MODEL_RC2800), | ||||||
|     .model_name =     "RC2800", |     .model_name =     "RC2800", | ||||||
|     .mfg_name =       "M2", |     .mfg_name =       "M2", | ||||||
|     .version =        "20201127.0", |     .version =        "20201128.0", | ||||||
|     .copyright =      "LGPL", |     .copyright =      "LGPL", | ||||||
|     .status =         RIG_STATUS_BETA, |     .status =         RIG_STATUS_STABLE, | ||||||
|     .rot_type =       ROT_TYPE_AZEL, |     .rot_type =       ROT_TYPE_AZEL, | ||||||
|     .port_type =      RIG_PORT_SERIAL, |     .port_type =      RIG_PORT_SERIAL, | ||||||
|     .serial_rate_min  = 9600, |     .serial_rate_min  = 9600, | ||||||
|  | @ -393,6 +406,37 @@ const struct rot_caps rc2800_rot_caps = | ||||||
|     .stop         = rc2800_rot_stop, |     .stop         = rc2800_rot_stop, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | const struct rot_caps rc2800az_rot_caps = | ||||||
|  | { | ||||||
|  |     ROT_MODEL(ROT_MODEL_RC2800AZ), | ||||||
|  |     .model_name =     "RC2800AZ", | ||||||
|  |     .mfg_name =       "M2", | ||||||
|  |     .version =        "20201128.0", | ||||||
|  |     .copyright =      "LGPL", | ||||||
|  |     .status =         RIG_STATUS_STABLE, | ||||||
|  |     .rot_type =       ROT_TYPE_AZIMUTH, | ||||||
|  |     .port_type =      RIG_PORT_SERIAL, | ||||||
|  |     .serial_rate_min  = 9600, | ||||||
|  |     .serial_rate_max  = 9600, | ||||||
|  |     .serial_data_bits = 8, | ||||||
|  |     .serial_stop_bits = 1, | ||||||
|  |     .serial_parity    = RIG_PARITY_NONE, | ||||||
|  |     .serial_handshake = RIG_HANDSHAKE_NONE, | ||||||
|  |     .write_delay      = 0, | ||||||
|  |     .post_write_delay = 0, | ||||||
|  |     .timeout          = 1000, | ||||||
|  |     .retry            = 3, | ||||||
|  | 
 | ||||||
|  |     .min_az =     0.0, | ||||||
|  |     .max_az =     360.0, | ||||||
|  |     .min_el =     0.0, | ||||||
|  |     .max_el =     180.0, | ||||||
|  | 
 | ||||||
|  |     .get_position = rc2800_rot_get_position, | ||||||
|  |     .set_position = rc2800_rot_set_position, | ||||||
|  |     .stop         = rc2800_rot_stop, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| /* ************************************************************************* */ | /* ************************************************************************* */ | ||||||
| 
 | 
 | ||||||
| DECLARE_INITROT_BACKEND(m2) | DECLARE_INITROT_BACKEND(m2) | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Michael Black W9MDB
						Michael Black W9MDB